mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	options fixes
This commit is contained in:
		| @@ -1332,6 +1332,10 @@ class Note extends AbstractEntity { | |||||||
|         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts']; |         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts']; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     isOptions() { | ||||||
|  |         return this.noteId.startsWith("options"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     get isDeleted() { |     get isDeleted() { | ||||||
|         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; |         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -830,6 +830,10 @@ class NoteShort { | |||||||
|     isLaunchBarConfig() { |     isLaunchBarConfig() { | ||||||
|         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts'].includes(this.noteId); |         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts'].includes(this.noteId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     isOptions() { | ||||||
|  |         return this.noteId.startsWith("options"); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default NoteShort; | export default NoteShort; | ||||||
|   | |||||||
| @@ -398,7 +398,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|                 autoExpandMS: 600, |                 autoExpandMS: 600, | ||||||
|                 preventLazyParents: false, |                 preventLazyParents: false, | ||||||
|                 dragStart: (node, data) => { |                 dragStart: (node, data) => { | ||||||
|                     if (['root', 'hidden', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(node.data.noteId)) { |                     if (['root', 'hidden', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(node.data.noteId) | ||||||
|  |                         || node.data.noteId.startsWith("options")) { | ||||||
|                         return false; |                         return false; | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
| @@ -428,6 +429,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|                         return false; |                         return false; | ||||||
|                     } else if (node.data.noteId === 'lbRoot') { |                     } else if (node.data.noteId === 'lbRoot') { | ||||||
|                         return false; |                         return false; | ||||||
|  |                     } else if (node.data.noteId.startsWith('options')) { | ||||||
|  |                         return false; | ||||||
|                     } else if (node.data.noteType === 'launcher') { |                     } else if (node.data.noteType === 'launcher') { | ||||||
|                         return ['before', 'after']; |                         return ['before', 'after']; | ||||||
|                     } else { |                     } else { | ||||||
| @@ -565,7 +568,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|                     $span.append($refreshSearchButton); |                     $span.append($refreshSearchButton); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (!['search', 'launcher'].includes(note.type)) { |                 if (!['search', 'launcher'].includes(note.type) && !note.isOptions()) { | ||||||
|                     const $createChildNoteButton = $('<span class="tree-item-button add-note-button bx bx-plus" title="Create child note"></span>'); |                     const $createChildNoteButton = $('<span class="tree-item-button add-note-button bx bx-plus" title="Create child note"></span>'); | ||||||
|  |  | ||||||
|                     $span.append($createChildNoteButton); |                     $span.append($createChildNoteButton); | ||||||
|   | |||||||
| @@ -114,14 +114,10 @@ function getAndValidateParent(params) { | |||||||
|         throw new Error(`Launchers should not have child notes.`); |         throw new Error(`Launchers should not have child notes.`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (!params.ignoreForbiddenParents && ['lbRoot'].includes(parentNote.noteId)) { |     if (!params.ignoreForbiddenParents && (parentNote.isLaunchBarConfig() || parentNote.isOptions())) { | ||||||
|         throw new Error(`Creating child notes into '${parentNote.noteId}' is not allowed.`); |         throw new Error(`Creating child notes into '${parentNote.noteId}' is not allowed.`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (['lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(parentNote.noteId) && params.type !== 'launcher') { |  | ||||||
|         throw new Error(`Creating child notes into '${parentNote.noteId}' is only possible for type 'launcher'.`); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return parentNote; |     return parentNote; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user