mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
clean up code
This commit is contained in:
parent
a37d75a08f
commit
1a4bc0b989
@ -30,10 +30,7 @@ app.use(express.urlencoded({extended: false}));
|
|||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
app.use('/libraries', express.static(path.join(__dirname, '..', 'libraries')));
|
app.use('/libraries', express.static(path.join(__dirname, '..', 'libraries')));
|
||||||
/**
|
// node_modules required for excalidraw-view mode in shared notes
|
||||||
* FIXME: is it (~~crazy~~) insecure to expose node_modules globally without auth?
|
|
||||||
* without out is required for excalidraw-view mode in shared notes
|
|
||||||
*/
|
|
||||||
app.use('/node_modules', express.static(path.join(__dirname, '..', 'node_modules')));
|
app.use('/node_modules', express.static(path.join(__dirname, '..', 'node_modules')));
|
||||||
app.use('/images', express.static(path.join(__dirname, '..', 'images')));
|
app.use('/images', express.static(path.join(__dirname, '..', 'images')));
|
||||||
const sessionParser = session({
|
const sessionParser = session({
|
||||||
|
@ -54,15 +54,6 @@ const TPL = `
|
|||||||
* (However, using trilium desktop instance, does not care too much about bandwidth. Size increase is probably
|
* (However, using trilium desktop instance, does not care too much about bandwidth. Size increase is probably
|
||||||
* acceptable, as a trade off.)
|
* acceptable, as a trade off.)
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* FIXME: Buttons from one excalidraw get activated. Problems with instance?! (maybe it is only visually, once
|
|
||||||
* mouse is over one instance they change?)
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* FIXME: FONTS from unpkg.com are loaded. Change font to HELVETICA?
|
|
||||||
* See: https://www.npmjs.com/package/@excalidraw/excalidraw => FONT_FAMILY
|
|
||||||
* => window.EXCALIDRAW_ASSET_PATH is set, however svg still contains wrong link (to excalidraw.com)
|
|
||||||
*/
|
|
||||||
export default class ExcalidrawTypeWidget extends TypeWidget {
|
export default class ExcalidrawTypeWidget extends TypeWidget {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -418,18 +409,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
detectScroll: false,
|
detectScroll: false,
|
||||||
handleKeyboardGlobally: false,
|
handleKeyboardGlobally: false,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
// renderTopRightUI: () => {
|
|
||||||
// return React.createElement(
|
|
||||||
// React.Fragment,
|
|
||||||
// null,
|
|
||||||
// React.createElement(
|
|
||||||
// "div",
|
|
||||||
// {
|
|
||||||
// className: "excalidraw-top-right-ui",
|
|
||||||
// },
|
|
||||||
// synchronized?"✔️":"⏳ unsaved changes"
|
|
||||||
// ));
|
|
||||||
// },
|
|
||||||
onLinkOpen,
|
onLinkOpen,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -20,11 +20,10 @@ function returnImage(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* special "image" type. the canvas-note is actually type application/json but can be
|
* special "image" type. the canvas-note is actually type application/json
|
||||||
* rendered on the fly to svg.
|
* to avoid bitrot and enable usage as referenced image the svg is included.
|
||||||
*/
|
*/
|
||||||
if (image.type === 'canvas-note') {
|
if (image.type === 'canvas-note') {
|
||||||
// render the svg in node.js using excalidraw and jsdom
|
|
||||||
const content = image.getContent();
|
const content = image.getContent();
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(content);
|
const data = JSON.parse(content);
|
||||||
|
@ -122,13 +122,14 @@ function register(router) {
|
|||||||
return res.status(400).send("Requested note is not a shareable image");
|
return res.status(400).send("Requested note is not a shareable image");
|
||||||
} else if (image.type === "canvas-note") {
|
} else if (image.type === "canvas-note") {
|
||||||
/**
|
/**
|
||||||
* FIXME: deduplicate the code from api/image.js
|
* special "image" type. the canvas-note is actually type application/json
|
||||||
|
* to avoid bitrot and enable usage as referenced image the svg is included.
|
||||||
*/
|
*/
|
||||||
// render the svg in node.js using excalidraw and jsdom
|
|
||||||
const content = image.getContent();
|
const content = image.getContent();
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content);
|
||||||
const svg = data.svg || '<svg />'
|
|
||||||
|
const svg = data.svg || '<svg />';
|
||||||
addNoIndexHeader(image, res);
|
addNoIndexHeader(image, res);
|
||||||
res.set('Content-Type', "image/svg+xml");
|
res.set('Content-Type', "image/svg+xml");
|
||||||
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
@ -38,7 +38,8 @@ class Attribute extends AbstractEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: why can we have branch is undefined? issue when
|
* FIXME: why can we have branch is undefined? issue when
|
||||||
* sharing and not sharing notes? canvas-note specific?
|
* sharing and not sharing notes? canvas-note specific?
|
||||||
|
* This error occured during development.
|
||||||
*/
|
*/
|
||||||
if(branch) {
|
if(branch) {
|
||||||
branch.isHidden = true;
|
branch.isHidden = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user