diff --git a/frontend/app.js b/frontend/app.js index 0aaafb5..636e6a3 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -277,6 +277,16 @@ function noteApp() { // Initialize app async init() { + // Store global reference for native event handlers in x-html content + window.$root = this; + + // ESC key to cancel drag operations + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape' && (this.draggedNote || this.draggedFolder || this.draggedItem)) { + this.cancelDrag(); + } + }); + await this.loadConfig(); await this.loadThemes(); await this.initTheme(); @@ -976,30 +986,24 @@ function noteApp() { const isExpanded = this.expandedFolders.has(folder.path); // Render this folder's header + // Note: Using native event handlers (ondragstart, onclick, etc.) instead of Alpine directives + // because x-html doesn't process Alpine directives in dynamically generated content + const escapedPath = folder.path.replace(/'/g, "\\'").replace(/\\/g, "\\\\"); html += `