mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	fixes
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| FROM node:12.14.0-alpine | FROM node:12.14.1-alpine | ||||||
|  |  | ||||||
| # Create app directory | # Create app directory | ||||||
| WORKDIR /usr/src/app | WORKDIR /usr/src/app | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
|  |  | ||||||
| PKG_DIR=dist/trilium-linux-x64-server | PKG_DIR=dist/trilium-linux-x64-server | ||||||
| NODE_VERSION=12.14.0 | NODE_VERSION=12.14.1 | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | if [ "$1" != "DONTCOPY" ] | ||||||
| then | then | ||||||
|   | |||||||
| @@ -105,7 +105,7 @@ class AppContext { | |||||||
|             new TabCachingWidget(this, () => new LinkMapWidget(this)), |             new TabCachingWidget(this, () => new LinkMapWidget(this)), | ||||||
|             new TabCachingWidget(this, () => new NoteRevisionsWidget(this)), |             new TabCachingWidget(this, () => new NoteRevisionsWidget(this)), | ||||||
|             new TabCachingWidget(this, () => new SimilarNotesWidget(this)), |             new TabCachingWidget(this, () => new SimilarNotesWidget(this)), | ||||||
|             new TabCachingWidget(this, () => new WhatLinksHereWidget(this)), |             new TabCachingWidget(this, () => new WhatLinksHereWidget(this)) | ||||||
|         ]; |         ]; | ||||||
|  |  | ||||||
|         for (const widget of rightPaneWidgets) { |         for (const widget of rightPaneWidgets) { | ||||||
| @@ -320,7 +320,7 @@ class AppContext { | |||||||
|  |  | ||||||
|         this.activeTabId = tabId; |         this.activeTabId = tabId; | ||||||
|  |  | ||||||
|         this.trigger('activeTabChanged', { oldActiveTabId }); |         this.trigger('activeTabChanged', { oldActiveTabId, newActiveTabId: tabId }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     newTabListener() { |     newTabListener() { | ||||||
|   | |||||||
| @@ -7,8 +7,10 @@ export default class SpacedUpdate { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     scheduleUpdate() { |     scheduleUpdate() { | ||||||
|         this.changed = true; |         if (!this.changeForbidden) { | ||||||
|         setTimeout(() => this.triggerUpdate()) |             this.changed = true; | ||||||
|  |             setTimeout(() => this.triggerUpdate()); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async updateNowIfNecessary() { |     async updateNowIfNecessary() { | ||||||
| @@ -33,4 +35,15 @@ export default class SpacedUpdate { | |||||||
|             this.scheduleUpdate(); |             this.scheduleUpdate(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     allowUpdateWithoutChange(callback) { | ||||||
|  |         this.changeForbidden = true; | ||||||
|  |  | ||||||
|  |         try { | ||||||
|  |             callback(); | ||||||
|  |         } | ||||||
|  |         finally { | ||||||
|  |             this.changeForbidden = false; | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default class Component { | |||||||
|     async eventReceived(name, data, sync = false) { |     async eventReceived(name, data, sync = false) { | ||||||
|         await this.initialized; |         await this.initialized; | ||||||
|  |  | ||||||
| //        console.log(`Received ${name} to ${this.componentId}`); |         console.log(`Received ${name} to ${this.componentId}`); | ||||||
|  |  | ||||||
|         const fun = this[name + 'Listener']; |         const fun = this[name + 'Listener']; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -138,12 +138,11 @@ export default class NoteDetailWidget extends TabAwareWidget { | |||||||
|         const clazz = await import(typeWidgetClasses[type]); |         const clazz = await import(typeWidgetClasses[type]); | ||||||
|  |  | ||||||
|         const typeWidget = this.typeWidgets[type] = new clazz.default(this.appContext); |         const typeWidget = this.typeWidgets[type] = new clazz.default(this.appContext); | ||||||
|  |         typeWidget.spacedUpdate = this.spacedUpdate; | ||||||
|  |  | ||||||
|         this.children.push(typeWidget); |         this.children.push(typeWidget); | ||||||
|  |  | ||||||
|         this.$widget.append(typeWidget.render()); |         this.$widget.append(typeWidget.render()); | ||||||
|  |  | ||||||
|         typeWidget.onNoteChange(() => this.spacedUpdate.scheduleUpdate()); |  | ||||||
|  |  | ||||||
|         typeWidget.eventReceived('setTabContext', {tabContext: this.tabContext}); |         typeWidget.eventReceived('setTabContext', {tabContext: this.tabContext}); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -464,8 +464,8 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|         return !!this.activeTabEl; |         return !!this.activeTabEl; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     activeTabChangedListener({tabId}) { |     activeTabChangedListener({newActiveTabId}) { | ||||||
|         const tabEl = this.getTabById(tabId)[0]; |         const tabEl = this.getTabById(newActiveTabId)[0]; | ||||||
|         const activeTabEl = this.activeTabEl; |         const activeTabEl = this.activeTabEl; | ||||||
|         if (activeTabEl === tabEl) return; |         if (activeTabEl === tabEl) return; | ||||||
|         if (activeTabEl) activeTabEl.removeAttribute('active'); |         if (activeTabEl) activeTabEl.removeAttribute('active'); | ||||||
|   | |||||||
| @@ -39,6 +39,7 @@ const TPL = ` | |||||||
|     .note-detail-book { |     .note-detail-book { | ||||||
|         height: 100%; |         height: 100%; | ||||||
|         padding: 10px; |         padding: 10px; | ||||||
|  |         position: relative; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     .note-detail-book-content { |     .note-detail-book-content { | ||||||
| @@ -280,14 +281,8 @@ export default class BookTypeWidget extends TypeWidget { | |||||||
|         return ""; |         return ""; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() { |  | ||||||
|         this.$widget.show(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() { |     cleanup() { | ||||||
|         this.$content.empty(); |         this.$content.empty(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -68,20 +68,22 @@ export default class CodeTypeWidget extends TypeWidget { | |||||||
|             dragDrop: false // with true the editor inlines dropped files which is not what we expect |             dragDrop: false // with true the editor inlines dropped files which is not what we expect | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         //this.onNoteChange(() => this.tabContext.noteChanged()); |         this.codeEditor.on('change', () => this.spacedUpdate.scheduleUpdate()); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     doRefresh(note) { |     doRefresh(note) { | ||||||
|         // CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check) |         this.spacedUpdate.allowUpdateWithoutChange(() => { | ||||||
|         // we provide fallback |             // CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check) | ||||||
|         this.codeEditor.setValue(note.content || ""); |             // we provide fallback | ||||||
|  |             this.codeEditor.setValue(note.content || ""); | ||||||
|  |  | ||||||
|         const info = CodeMirror.findModeByMIME(note.mime); |             const info = CodeMirror.findModeByMIME(note.mime); | ||||||
|  |  | ||||||
|         if (info) { |             if (info) { | ||||||
|             this.codeEditor.setOption("mode", info.mime); |                 this.codeEditor.setOption("mode", info.mime); | ||||||
|             CodeMirror.autoLoadMode(this.codeEditor, info.mode); |                 CodeMirror.autoLoadMode(this.codeEditor, info.mode); | ||||||
|         } |             } | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         this.show(); |         this.show(); | ||||||
|     } |     } | ||||||
| @@ -123,12 +125,6 @@ export default class CodeTypeWidget extends TypeWidget { | |||||||
|         toastService.showMessage("Note executed"); |         toastService.showMessage("Note executed"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async onNoteChange(func) { |  | ||||||
|         await this.initialized; |  | ||||||
|  |  | ||||||
|         this.codeEditor.on('change', func); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     cleanup() { |     cleanup() { | ||||||
|         if (this.codeEditor) { |         if (this.codeEditor) { | ||||||
|             this.codeEditor.setValue(''); |             this.codeEditor.setValue(''); | ||||||
|   | |||||||
| @@ -40,14 +40,10 @@ export default class EmptyTypeWidget extends TypeWidget { | |||||||
|         this.toggle(!this.tabContext.note); |         this.toggle(!this.tabContext.note); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|  |  | ||||||
|     scrollToTop() {} |     scrollToTop() {} | ||||||
|   | |||||||
| @@ -144,14 +144,10 @@ export default class FileTypeWidget extends TypeWidget { | |||||||
|         return utils.getUrlForDownload("api/notes/" + this.tabContext.note.noteId + "/download"); |         return utils.getUrlForDownload("api/notes/" + this.tabContext.note.noteId + "/download"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|  |  | ||||||
|     scrollToTop() {} |     scrollToTop() {} | ||||||
|   | |||||||
| @@ -149,14 +149,10 @@ class NoteDetailImage extends TypeWidget { | |||||||
|         return utils.getUrlForDownload(`api/notes/${this.tabContext.note.noteId}/download`); |         return utils.getUrlForDownload(`api/notes/${this.tabContext.note.noteId}/download`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|  |  | ||||||
|     scrollToTop() { |     scrollToTop() { | ||||||
|   | |||||||
| @@ -40,14 +40,10 @@ export default class ProtectedSessionTypeWidget extends TypeWidget { | |||||||
|         return this.$widget; |         return this.$widget; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|  |  | ||||||
|     scrollToTop() { |     scrollToTop() { | ||||||
|   | |||||||
| @@ -644,11 +644,7 @@ export default class RelationMapTypeWidget extends TypeWidget { | |||||||
|         return JSON.stringify(this.mapData); |         return JSON.stringify(this.mapData); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     scrollToTop() {} |     scrollToTop() {} | ||||||
| } | } | ||||||
| @@ -40,12 +40,8 @@ export default class RenderTypeWidget extends TypeWidget { | |||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() { |     cleanup() { | ||||||
|         this.$noteDetailRenderContent.empty(); |         this.$noteDetailRenderContent.empty(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -65,10 +65,6 @@ export default class SearchTypeWidget extends TypeWidget { | |||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     show() {} |  | ||||||
|  |  | ||||||
|     onNoteChange() {} |  | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|  |  | ||||||
|     scrollToTop() {} |     scrollToTop() {} | ||||||
|   | |||||||
| @@ -128,6 +128,8 @@ export default class TextTypeWidget extends TypeWidget { | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  |         this.textEditor.model.document.on('change:data', () => this.spacedUpdate.scheduleUpdate()); | ||||||
|  |  | ||||||
|         if (glob.isDev && ENABLE_INSPECTOR) { |         if (glob.isDev && ENABLE_INSPECTOR) { | ||||||
|             await import('../../libraries/ckeditor/inspector.js'); |             await import('../../libraries/ckeditor/inspector.js'); | ||||||
|             CKEditorInspector.attach(this.textEditor); |             CKEditorInspector.attach(this.textEditor); | ||||||
| @@ -137,9 +139,9 @@ export default class TextTypeWidget extends TypeWidget { | |||||||
|     async doRefresh(note) { |     async doRefresh(note) { | ||||||
|         this.textEditor.isReadOnly = await this.isReadOnly(); |         this.textEditor.isReadOnly = await this.isReadOnly(); | ||||||
|  |  | ||||||
|         this.$widget.show(); |         this.spacedUpdate.allowUpdateWithoutChange(() => { | ||||||
|  |             this.textEditor.setData(note.content); | ||||||
|         this.textEditor.setData(note.content); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     getContent() { |     getContent() { | ||||||
| @@ -174,12 +176,6 @@ export default class TextTypeWidget extends TypeWidget { | |||||||
|         return this.textEditor; |         return this.textEditor; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async onNoteChange(func) { |  | ||||||
|         await this.initialized; |  | ||||||
|  |  | ||||||
|         this.textEditor.model.document.on('change:data', func); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     cleanup() { |     cleanup() { | ||||||
|         if (this.textEditor) { |         if (this.textEditor) { | ||||||
|             this.textEditor.setData(''); |             this.textEditor.setData(''); | ||||||
|   | |||||||
| @@ -92,7 +92,9 @@ async function fillInAdditionalProperties(sync) { | |||||||
| } | } | ||||||
|  |  | ||||||
| async function sendPing(client) { | async function sendPing(client) { | ||||||
|     const syncData = require('./sync_table').getEntitySyncsNewerThan(lastAcceptedSyncIds[client.id]); |     const syncData = require('./sync_table') | ||||||
|  |         .getEntitySyncsNewerThan(lastAcceptedSyncIds[client.id]) | ||||||
|  |         .filter(r => r.entityName !== 'recent_notes'); // only noise ... | ||||||
|  |  | ||||||
|     for (const sync of syncData) { |     for (const sync of syncData) { | ||||||
|         try { |         try { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user