mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
remove commented logs to clean up code
This commit is contained in:
parent
81e0c6dcc2
commit
160bd0a790
@ -123,10 +123,8 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
*/
|
*/
|
||||||
async doRefresh(note) {
|
async doRefresh(note) {
|
||||||
// see if note changed, since we do not get a new class for a new note
|
// see if note changed, since we do not get a new class for a new note
|
||||||
// this.log("doRefresh note", this.currentNoteId, note.noteId);
|
|
||||||
const noteChanged = this.currentNoteId !== note.noteId;
|
const noteChanged = this.currentNoteId !== note.noteId;
|
||||||
if (noteChanged) {
|
if (noteChanged) {
|
||||||
// this.log("doRefresh resetCurrentSceneVersion = -1");
|
|
||||||
// reset scene to omit unnecessary onchange handler
|
// reset scene to omit unnecessary onchange handler
|
||||||
this.currentSceneVersion = this.SCENE_VERSION_INITIAL;
|
this.currentSceneVersion = this.SCENE_VERSION_INITIAL;
|
||||||
}
|
}
|
||||||
@ -134,13 +132,10 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
// get note from backend and put into canvas
|
// get note from backend and put into canvas
|
||||||
const noteComplement = await froca.getNoteComplement(note.noteId);
|
const noteComplement = await froca.getNoteComplement(note.noteId);
|
||||||
// this.log('doRefresh', note, noteComplement);
|
|
||||||
|
|
||||||
/**
|
// before we load content into excalidraw, make sure excalidraw has loaded
|
||||||
* before we load content into excalidraw, make sure excalidraw has loaded
|
|
||||||
*/
|
|
||||||
while (!this.excalidrawRef || !this.excalidrawRef.current) {
|
while (!this.excalidrawRef || !this.excalidrawRef.current) {
|
||||||
this.log("excalidrawref not yet loeaded, sleep 200ms...");
|
this.log("excalidrawRef not yet loeaded, sleep 200ms...");
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,8 +193,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
fileArray.push(file);
|
fileArray.push(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.log("doRefresh(note) sceneData, files", sceneData, files, fileArray);
|
|
||||||
|
|
||||||
this.sceneVersion = window.Excalidraw.getSceneVersion(elements);
|
this.sceneVersion = window.Excalidraw.getSceneVersion(elements);
|
||||||
|
|
||||||
this.excalidrawRef.current.updateScene(sceneData);
|
this.excalidrawRef.current.updateScene(sceneData);
|
||||||
@ -264,7 +257,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const contentString = JSON.stringify(content);
|
const contentString = JSON.stringify(content);
|
||||||
// this.log("getContent note size content.svg/content", `~${content.svg.length/1024}kB/${contentString.length/1024}kB`, content.svg.length/contentString.length, "% of svg");
|
|
||||||
|
|
||||||
return contentString;
|
return contentString;
|
||||||
}
|
}
|
||||||
@ -279,7 +271,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChangeHandler() {
|
onChangeHandler() {
|
||||||
// this.log("onChangeHandler() =================", new Date(), this.isNewSceneVersion());
|
|
||||||
const appState = this.excalidrawRef.current.getAppState() || {};
|
const appState = this.excalidrawRef.current.getAppState() || {};
|
||||||
|
|
||||||
// changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc.
|
// changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc.
|
||||||
@ -326,7 +317,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
width: excalidrawWrapperRef.current.getBoundingClientRect().width,
|
width: excalidrawWrapperRef.current.getBoundingClientRect().width,
|
||||||
height: excalidrawWrapperRef.current.getBoundingClientRect().height
|
height: excalidrawWrapperRef.current.getBoundingClientRect().height
|
||||||
};
|
};
|
||||||
// this.log('effect, setdimensions', dimensions);
|
|
||||||
setDimensions(dimensions);
|
setDimensions(dimensions);
|
||||||
|
|
||||||
const onResize = () => {
|
const onResize = () => {
|
||||||
@ -334,7 +324,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
width: excalidrawWrapperRef.current.getBoundingClientRect().width,
|
width: excalidrawWrapperRef.current.getBoundingClientRect().width,
|
||||||
height: excalidrawWrapperRef.current.getBoundingClientRect().height
|
height: excalidrawWrapperRef.current.getBoundingClientRect().height
|
||||||
};
|
};
|
||||||
// this.log('onResize, setdimensions', dimensions);
|
|
||||||
setDimensions(dimensions);
|
setDimensions(dimensions);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -348,10 +337,8 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
const { nativeEvent } = event.detail;
|
const { nativeEvent } = event.detail;
|
||||||
const isNewTab = nativeEvent.ctrlKey || nativeEvent.metaKey;
|
const isNewTab = nativeEvent.ctrlKey || nativeEvent.metaKey;
|
||||||
const isNewWindow = nativeEvent.shiftKey;
|
const isNewWindow = nativeEvent.shiftKey;
|
||||||
const isInternalLink =
|
const isInternalLink = link.startsWith("/")
|
||||||
link.startsWith("/") || link.includes(window.location.origin);
|
|| link.includes(window.location.origin);
|
||||||
|
|
||||||
// this.log("onLinkOpen", element, event, nativeEvent, "isinternallink", isInternalLink);
|
|
||||||
|
|
||||||
if (isInternalLink && !isNewTab && !isNewWindow) {
|
if (isInternalLink && !isNewTab && !isNewWindow) {
|
||||||
// signal that we're handling the redirect ourselves
|
// signal that we're handling the redirect ourselves
|
||||||
@ -378,7 +365,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
height: dimensions.height,
|
height: dimensions.height,
|
||||||
// initialData: InitialData,
|
// initialData: InitialData,
|
||||||
onPaste: (data, event) => {
|
onPaste: (data, event) => {
|
||||||
this.log("excalidraw internal paste", data, event);
|
this.log("Verbose: excalidraw internal paste. No trilium action implemented.", data, event);
|
||||||
},
|
},
|
||||||
onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER),
|
onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER),
|
||||||
// onPointerUpdate: (payload) => console.log(payload),
|
// onPointerUpdate: (payload) => console.log(payload),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user