Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
remove debug helper with uniqueId
Tom92adcf82e4bd
diff --git a/src/public/app/widgets/type_widgets/canvas-note-utils/lodash.uniqueId.js b/src/public/app/widgets/type_widgets/canvas-note-utils/lodash.uniqueId.jsdeleted file mode 100644index 8ec8a0754a..0000000000--- a/src/public/app/widgets/type_widgets/canvas-note-utils/lodash.uniqueId.js+++ /dev/null@@ -1,33 +0,0 @@-/** Used to generate unique IDs. */-const idCounter = {}--/**- * Generates a unique ID. If `prefix` is given, the ID is appended to it.- *- * @since 0.1.0- * @category Util- * @param {string} [prefix=''] The value to prefix the ID with.- * @returns {string} Returns the unique ID.- * @see random- * @example- *- * uniqueId('contact_')- * // => 'contact_104'- *- * uniqueId()- * // => '105'- */-function uniqueId(prefix='$lodash$') {- if (!idCounter[prefix]) {- idCounter[prefix] = 0- }-- const id =++idCounter[prefix]- if (prefix === '$lodash$') {- return `${id}`- }-- return `${prefix}${id}`-}--export default uniqueId\ No newline at end of filediff --git a/src/public/app/widgets/type_widgets/canvas_note.js b/src/public/app/widgets/type_widgets/canvas_note.jsindex 2a11171c6e..e06951f923 100644--- a/src/public/app/widgets/type_widgets/canvas_note.js+++ b/src/public/app/widgets/type_widgets/canvas_note.js@@ -3,7 +3,6 @@ import TypeWidget from "./type_widget.js";import utils from '../../services/utils.js';import froca from "../../services/froca.js";import debounce from "./canvas-note-utils/lodash.debounce.js";-import uniqueId from "./canvas-note-utils/lodash.uniqueId.js";import replaceExternalAssets from "./canvas-note-utils/replaceExternalAssets.js";const {sleep} = utils;@@ -60,18 +59,18 @@ export default class ExcalidrawTypeWidget extends TypeWidget {constructor() {super();- // CONSTANTS+ // constantsthis.SCENE_VERSION_INITIAL = -1;this.SCENE_VERSION_ERROR = -2;// config- this.debounceTimeOnchangeHandler = 750; // ms+ this.DEBOUNCE_TIME_ONCHANGEHANDLER = 750; // ms// ensure that assets are loaded from triliumwindow.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`;// temporary varsthis.currentNoteId = "";- this.currentSceneVersion = SCENE_VERSION_INITIAL;+ this.currentSceneVersion = this.SCENE_VERSION_INITIAL;// will be overwrittenthis.excalidrawRef;@@ -89,15 +88,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {this.isNewSceneVersion = this.isNewSceneVersion.bind(this);this.updateSceneVersion = this.updateSceneVersion.bind(this);this.getSceneVersion = this.getSceneVersion.bind(this);-- // debugging helper - delete this block or comment- this.uniqueId = uniqueId();- console.log("uniqueId", this.uniqueId);- if (!window.triliumexcalidraw) {- window.triliumexcalidraw = [];- }- window.triliumexcalidraw[this.uniqueId] = this;- // end debug}/**@@ -401,7 +391,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {onPaste: (data, event) => {this.log("excalidraw internal paste", data, event);},- onChange: debounce(this.onChangeHandler, this.debounceTimeOnchangeHandler),+ onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER),// onPointerUpdate: (payload) => console.log(payload),onCollabButtonClick: () => {window.alert("You clicked on collab button")