mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	rename note types to camelCase
This commit is contained in:
		
							
								
								
									
										3
									
								
								db/migrations/0205__rename_note_types.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								db/migrations/0205__rename_note_types.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | UPDATE notes SET type = 'relationMap' WHERE type = 'relation-map'; | ||||||
|  | UPDATE notes SET type = 'noteMap' WHERE type = 'note-map'; | ||||||
|  | UPDATE notes SET type = 'webView' WHERE type = 'web-view'; | ||||||
							
								
								
									
										15
									
								
								db/migrations/0206__rename_noteIds.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								db/migrations/0206__rename_noteIds.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | UPDATE notes SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap'; | ||||||
|  | UPDATE notes SET noteId = 'bulkAction' WHERE noteId = 'bulkaction'; | ||||||
|  | UPDATE notes SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole'; | ||||||
|  |  | ||||||
|  | UPDATE branches SET branchId = 'globalNoteMap' WHERE branchId = 'globalnotemap'; | ||||||
|  | UPDATE branches SET branchId = 'bulkAction' WHERE branchId = 'bulkaction'; | ||||||
|  | UPDATE branches SET branchId = 'sqlConsole' WHERE branchId = 'sqlconsole'; | ||||||
|  |  | ||||||
|  | UPDATE branches SET parentNoteId = 'globalNoteMap' WHERE parentNoteId = 'globalnotemap'; | ||||||
|  | UPDATE branches SET parentNoteId = 'bulkAction' WHERE parentNoteId = 'bulkaction'; | ||||||
|  | UPDATE branches SET parentNoteId = 'sqlConsole' WHERE parentNoteId = 'sqlconsole'; | ||||||
|  |  | ||||||
|  | UPDATE attributes SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap'; | ||||||
|  | UPDATE attributes SET noteId = 'bulkAction' WHERE noteId = 'bulkaction'; | ||||||
|  | UPDATE attributes SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole'; | ||||||
| @@ -709,7 +709,7 @@ components: | |||||||
|             - image |             - image | ||||||
|             - search |             - search | ||||||
|             - book |             - book | ||||||
|             - relation-map |             - relationMap | ||||||
|             - render |             - render | ||||||
|         mime: |         mime: | ||||||
|           type: string |           type: string | ||||||
| @@ -747,7 +747,7 @@ components: | |||||||
|           type: string |           type: string | ||||||
|         type: |         type: | ||||||
|           type: string |           type: string | ||||||
|           enum: [text, code, render, file, image, search, relation-map, book, note-map, mermaid, web-view, shortcut] |           enum: [text, code, render, file, image, search, relationMap, book, noteMap, mermaid, webView, shortcut] | ||||||
|         mime: |         mime: | ||||||
|           type: string |           type: string | ||||||
|         isProtected: |         isProtected: | ||||||
|   | |||||||
| @@ -15,15 +15,15 @@ const NOTE_TYPE_ICONS = { | |||||||
|     "code": "bx bx-code", |     "code": "bx bx-code", | ||||||
|     "render": "bx bx-extension", |     "render": "bx bx-extension", | ||||||
|     "search": "bx bx-file-find", |     "search": "bx bx-file-find", | ||||||
|     "relation-map": "bx bx-map-alt", |     "relationMap": "bx bx-map-alt", | ||||||
|     "book": "bx bx-book", |     "book": "bx bx-book", | ||||||
|     "note-map": "bx bx-map-alt", |     "noteMap": "bx bx-map-alt", | ||||||
|     "mermaid": "bx bx-selection", |     "mermaid": "bx bx-selection", | ||||||
|     "canvas": "bx bx-pen", |     "canvas": "bx bx-pen", | ||||||
|     "web-view": "bx bx-globe-alt", |     "webView": "bx bx-globe-alt", | ||||||
|     "launcher": "bx bx-link", |     "launcher": "bx bx-link", | ||||||
|     "doc": "bx bxs-file-doc", |     "doc": "bx bxs-file-doc", | ||||||
|     "content-widget": "bx bxs-widget" |     "contentWidget": "bx bxs-widget" | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -148,7 +148,7 @@ async function getRenderedContent(note, options = {}) { | |||||||
|     else if (type === 'book') { |     else if (type === 'book') { | ||||||
|         // nothing, book doesn't have its own content |         // nothing, book doesn't have its own content | ||||||
|     } |     } | ||||||
|     else if (!options.tooltip && type === 'protected-session') { |     else if (!options.tooltip && type === 'protectedSession') { | ||||||
|         const $button = $(`<button class="btn btn-sm"><span class="bx bx-log-in"></span> Enter protected session</button>`) |         const $button = $(`<button class="btn btn-sm"><span class="bx bx-log-in"></span> Enter protected session</button>`) | ||||||
|             .on('click', protectedSessionService.enterProtectedSession); |             .on('click', protectedSessionService.enterProtectedSession); | ||||||
|  |  | ||||||
| @@ -219,7 +219,7 @@ function getRenderingType(note) { | |||||||
|             protectedSessionHolder.touchProtectedSession(); |             protectedSessionHolder.touchProtectedSession(); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             type = 'protected-session'; |             type = 'protectedSession'; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ const TPL = ` | |||||||
|         border: 1px solid var(--main-border-color); |         border: 1px solid var(--main-border-color); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     .note-book-content.type-image, .note-book-content.type-file, .note-book-content.type-protected-session { |     .note-book-content.type-image, .note-book-content.type-file, .note-book-content.type-protectedSession { | ||||||
|         display: flex; |         display: flex; | ||||||
|         align-items: center; |         align-items: center; | ||||||
|         justify-content: center; |         justify-content: center; | ||||||
|   | |||||||
| @@ -6,13 +6,13 @@ async function getNoteTypeItems(command) { | |||||||
|         { title: "Text", command: command, type: "text", uiIcon: "bx bx-note" }, |         { title: "Text", command: command, type: "text", uiIcon: "bx bx-note" }, | ||||||
|         { title: "Code", command: command, type: "code", uiIcon: "bx bx-code" }, |         { title: "Code", command: command, type: "code", uiIcon: "bx bx-code" }, | ||||||
|         { title: "Saved Search", command: command, type: "search", uiIcon: "bx bx-file-find" }, |         { title: "Saved Search", command: command, type: "search", uiIcon: "bx bx-file-find" }, | ||||||
|         { title: "Relation Map", command: command, type: "relation-map", uiIcon: "bx bx-map-alt" }, |         { title: "Relation Map", command: command, type: "relationMap", uiIcon: "bx bx-map-alt" }, | ||||||
|         { title: "Note Map", command: command, type: "note-map", uiIcon: "bx bx-map-alt" }, |         { title: "Note Map", command: command, type: "noteMap", uiIcon: "bx bx-map-alt" }, | ||||||
|         { title: "Render Note", command: command, type: "render", uiIcon: "bx bx-extension" }, |         { title: "Render Note", command: command, type: "render", uiIcon: "bx bx-extension" }, | ||||||
|         { title: "Book", command: command, type: "book", uiIcon: "bx bx-book" }, |         { title: "Book", command: command, type: "book", uiIcon: "bx bx-book" }, | ||||||
|         { title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" }, |         { title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" }, | ||||||
|         { title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" }, |         { title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" }, | ||||||
|         { title: "Web View", command: command, type: "web-view", uiIcon: "bx bx-globe-alt" }, |         { title: "Web View", command: command, type: "webView", uiIcon: "bx bx-globe-alt" }, | ||||||
|     ]; |     ]; | ||||||
|  |  | ||||||
|     const templateNoteIds = await server.get("search-templates"); |     const templateNoteIds = await server.get("search-templates"); | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { | |||||||
|     refreshWithNote(note) { |     refreshWithNote(note) { | ||||||
|         this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book', 'search'].includes(note.type)); |         this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book', 'search'].includes(note.type)); | ||||||
|  |  | ||||||
|         this.toggleDisabled(this.$showSourceButton, ['text', 'relation-map', 'search', 'code'].includes(note.type)); |         this.toggleDisabled(this.$showSourceButton, ['text', 'relationMap', 'search', 'code'].includes(note.type)); | ||||||
|  |  | ||||||
|         this.toggleDisabled(this.$printActiveNoteButton, ['text', 'code'].includes(note.type)); |         this.toggleDisabled(this.$printActiveNoteButton, ['text', 'code'].includes(note.type)); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -83,7 +83,7 @@ export default class BulkActionsDialog extends BasicWidget { | |||||||
|         this.$widget.on('click', '[data-action-add]', async event => { |         this.$widget.on('click', '[data-action-add]', async event => { | ||||||
|             const actionName = $(event.target).attr('data-action-add'); |             const actionName = $(event.target).attr('data-action-add'); | ||||||
|  |  | ||||||
|             await bulkActionService.addAction('bulkaction', actionName); |             await bulkActionService.addAction('bulkAction', actionName); | ||||||
|  |  | ||||||
|             await this.refresh(); |             await this.refresh(); | ||||||
|         }); |         }); | ||||||
| @@ -111,7 +111,7 @@ export default class BulkActionsDialog extends BasicWidget { | |||||||
|  |  | ||||||
|         this.$affectedNoteCount.text(affectedNoteCount); |         this.$affectedNoteCount.text(affectedNoteCount); | ||||||
|  |  | ||||||
|         const bulkActionNote = await froca.getNote('bulkaction'); |         const bulkActionNote = await froca.getNote('bulkAction'); | ||||||
|  |  | ||||||
|         const actions = bulkActionService.parseActions(bulkActionNote); |         const actions = bulkActionService.parseActions(bulkActionNote); | ||||||
|  |  | ||||||
| @@ -150,7 +150,7 @@ export default class BulkActionsDialog extends BasicWidget { | |||||||
|         if (loadResults.getAttributes().find(attr => |         if (loadResults.getAttributes().find(attr => | ||||||
|             attr.type === 'label' |             attr.type === 'label' | ||||||
|             && attr.name === 'action' |             && attr.name === 'action' | ||||||
|             && attr.noteId === 'bulkaction' |             && attr.noteId === 'bulkAction' | ||||||
|             && attr.isDeleted)) { |             && attr.isDeleted)) { | ||||||
|  |  | ||||||
|             // this may be triggered from e.g. sync without open widget, then no need to refresh the widget |             // this may be triggered from e.g. sync without open widget, then no need to refresh the widget | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ const TPL = ` | |||||||
|  |  | ||||||
| export default class RelationMapButtons extends NoteContextAwareWidget { | export default class RelationMapButtons extends NoteContextAwareWidget { | ||||||
|     isEnabled() { |     isEnabled() { | ||||||
|         return super.isEnabled() && this.note?.type === 'relation-map'; |         return super.isEnabled() && this.note?.type === 'relationMap'; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|   | |||||||
| @@ -46,22 +46,22 @@ const TPL = ` | |||||||
| const typeWidgetClasses = { | const typeWidgetClasses = { | ||||||
|     'empty': EmptyTypeWidget, |     'empty': EmptyTypeWidget, | ||||||
|     'deleted': DeletedTypeWidget, |     'deleted': DeletedTypeWidget, | ||||||
|     'editable-text': EditableTextTypeWidget, |     'editableText': EditableTextTypeWidget, | ||||||
|     'read-only-text': ReadOnlyTextTypeWidget, |     'readOnlyText': ReadOnlyTextTypeWidget, | ||||||
|     'editable-code': EditableCodeTypeWidget, |     'editableCode': EditableCodeTypeWidget, | ||||||
|     'read-only-code': ReadOnlyCodeTypeWidget, |     'readOnlyCode': ReadOnlyCodeTypeWidget, | ||||||
|     'file': FileTypeWidget, |     'file': FileTypeWidget, | ||||||
|     'image': ImageTypeWidget, |     'image': ImageTypeWidget, | ||||||
|     'search': NoneTypeWidget, |     'search': NoneTypeWidget, | ||||||
|     'render': RenderTypeWidget, |     'render': RenderTypeWidget, | ||||||
|     'relation-map': RelationMapTypeWidget, |     'relationMap': RelationMapTypeWidget, | ||||||
|     'canvas': CanvasTypeWidget, |     'canvas': CanvasTypeWidget, | ||||||
|     'protected-session': ProtectedSessionTypeWidget, |     'protectedSession': ProtectedSessionTypeWidget, | ||||||
|     'book': BookTypeWidget, |     'book': BookTypeWidget, | ||||||
|     'note-map': NoteMapTypeWidget, |     'note-map': NoteMapTypeWidget, | ||||||
|     'web-view': WebViewTypeWidget, |     'webView': WebViewTypeWidget, | ||||||
|     'doc': DocTypeWidget, |     'doc': DocTypeWidget, | ||||||
|     'content-widget': ContentWidgetTypeWidget |     'contentWidget': ContentWidgetTypeWidget | ||||||
| }; | }; | ||||||
|  |  | ||||||
| export default class NoteDetailWidget extends NoteContextAwareWidget { | export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||||
| @@ -164,7 +164,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | |||||||
|         // https://github.com/zadam/trilium/issues/2522 |         // https://github.com/zadam/trilium/issues/2522 | ||||||
|         this.$widget.toggleClass("full-height", |         this.$widget.toggleClass("full-height", | ||||||
|             !this.noteContext.hasNoteList() |             !this.noteContext.hasNoteList() | ||||||
|             && ['editable-text', 'editable-code', 'canvas', 'web-view', 'note-map'].includes(this.type) |             && ['editableText', 'editableCode', 'canvas', 'webView', 'noteMap'].includes(this.type) | ||||||
|             && this.mime !== 'text/x-sqlite;schema=trilium'); |             && this.mime !== 'text/x-sqlite;schema=trilium'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -188,19 +188,19 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | |||||||
|         let type = note.type; |         let type = note.type; | ||||||
|  |  | ||||||
|         if (type === 'text' && await this.noteContext.isReadOnly()) { |         if (type === 'text' && await this.noteContext.isReadOnly()) { | ||||||
|             type = 'read-only-text'; |             type = 'readOnlyText'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ((type === 'code' || type === 'mermaid') && await this.noteContext.isReadOnly()) { |         if ((type === 'code' || type === 'mermaid') && await this.noteContext.isReadOnly()) { | ||||||
|             type = 'read-only-code'; |             type = 'readOnlyCode'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (type === 'text') { |         if (type === 'text') { | ||||||
|             type = 'editable-text'; |             type = 'editableText'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (type === 'code' || type === 'mermaid') { |         if (type === 'code' || type === 'mermaid') { | ||||||
|             type = 'editable-code'; |             type = 'editableCode'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (type === 'launcher') { |         if (type === 'launcher') { | ||||||
| @@ -208,7 +208,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { |         if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { | ||||||
|             type = 'protected-session'; |             type = 'protectedSession'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return type; |         return type; | ||||||
|   | |||||||
| @@ -7,18 +7,18 @@ const NOTE_TYPES = [ | |||||||
|     { type: "file", title: "File", selectable: false }, |     { type: "file", title: "File", selectable: false }, | ||||||
|     { type: "image", title: "Image", selectable: false }, |     { type: "image", title: "Image", selectable: false }, | ||||||
|     { type: "search", title: "Saved Search", selectable: false }, |     { type: "search", title: "Saved Search", selectable: false }, | ||||||
|     { type: "note-map", mime: '', title: "Note Map", selectable: false }, |     { type: "noteMap", mime: '', title: "Note Map", selectable: false }, | ||||||
|     { type: "launcher", mime: '', title: "Launcher", selectable: false }, |     { type: "launcher", mime: '', title: "Launcher", selectable: false }, | ||||||
|     { type: "doc", mime: '', title: "Doc", selectable: false }, |     { type: "doc", mime: '', title: "Doc", selectable: false }, | ||||||
|     { type: "content-widget", mime: '', title: "Widget", selectable: false }, |     { type: "contentWidget", mime: '', title: "Widget", selectable: false }, | ||||||
|  |  | ||||||
|     { type: "text", mime: "text/html", title: "Text", selectable: true }, |     { type: "text", mime: "text/html", title: "Text", selectable: true }, | ||||||
|     { type: "relation-map", mime: "application/json", title: "Relation Map", selectable: true }, |     { type: "relationMap", mime: "application/json", title: "Relation Map", selectable: true }, | ||||||
|     { type: "render", mime: '', title: "Render Note", selectable: true }, |     { type: "render", mime: '', title: "Render Note", selectable: true }, | ||||||
|     { type: "canvas", mime: 'application/json', title: "Canvas", selectable: true }, |     { type: "canvas", mime: 'application/json', title: "Canvas", selectable: true }, | ||||||
|     { type: "mermaid", mime: 'text/mermaid', title: "Mermaid Diagram", selectable: true }, |     { type: "mermaid", mime: 'text/mermaid', title: "Mermaid Diagram", selectable: true }, | ||||||
|     { type: "book", mime: '', title: "Book", selectable: true }, |     { type: "book", mime: '', title: "Book", selectable: true }, | ||||||
|     { type: "web-view", mime: '', title: "Web View", selectable: true }, |     { type: "webView", mime: '', title: "Web View", selectable: true }, | ||||||
|     { type: "code", mime: 'text/plain', title: "Code", selectable: true } |     { type: "code", mime: 'text/plain', title: "Code", selectable: true } | ||||||
| ]; | ]; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ export default class NoteWrapperWidget extends FlexContainer { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         this.$widget.toggleClass("full-content-width", |         this.$widget.toggleClass("full-content-width", | ||||||
|             ['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note.type) |             ['image', 'mermaid', 'book', 'render', 'canvas', 'webView'].includes(note.type) | ||||||
|             || !!note?.hasLabel('fullContentWidth') |             || !!note?.hasLabel('fullContentWidth') | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ const CONTENT_WIDGETS = { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| export default class ContentWidgetTypeWidget extends TypeWidget { | export default class ContentWidgetTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "content-widget"; } |     static getType() { return "contentWidget"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ const TPL = ` | |||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
| export default class EditableCodeTypeWidget extends TypeWidget { | export default class EditableCodeTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "editable-code"; } |     static getType() { return "editableCode"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -83,7 +83,7 @@ const TPL = ` | |||||||
| `; | `; | ||||||
|  |  | ||||||
| export default class EditableTextTypeWidget extends AbstractTextTypeWidget { | export default class EditableTextTypeWidget extends AbstractTextTypeWidget { | ||||||
|     static getType() { return "editable-text"; } |     static getType() { return "editableText"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import NoteMapWidget from "../note_map.js"; | |||||||
| const TPL = `<div class="note-detail-note-map note-detail-printable"></div>`; | const TPL = `<div class="note-detail-note-map note-detail-printable"></div>`; | ||||||
|  |  | ||||||
| export default class NoteMapTypeWidget extends TypeWidget { | export default class NoteMapTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "note-map"; } |     static getType() { return "noteMap"; } | ||||||
|  |  | ||||||
|     constructor() { |     constructor() { | ||||||
|         super(); |         super(); | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ const TPL = ` | |||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
| export default class ProtectedSessionTypeWidget extends TypeWidget { | export default class ProtectedSessionTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "protected-session"; } |     static getType() { return "protectedSession"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ const TPL = ` | |||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
| export default class ReadOnlyCodeTypeWidget extends TypeWidget { | export default class ReadOnlyCodeTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "read-only-code"; } |     static getType() { return "readOnlyCode"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ const TPL = ` | |||||||
| `; | `; | ||||||
|  |  | ||||||
| export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget { | export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget { | ||||||
|     static getType() { return "read-only-text"; } |     static getType() { return "readOnlyText"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -74,7 +74,7 @@ const TPL = ` | |||||||
| let containerCounter = 1; | let containerCounter = 1; | ||||||
|  |  | ||||||
| export default class RelationMapTypeWidget extends TypeWidget { | export default class RelationMapTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "relation-map"; } |     static getType() { return "relationMap"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ const TPL = ` | |||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
| export default class WebViewTypeWidget extends TypeWidget { | export default class WebViewTypeWidget extends TypeWidget { | ||||||
|     static getType() { return "web-view"; } |     static getType() { return "webView"; } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| .type-relation-map .note-detail { | .type-relationMap .note-detail { | ||||||
|     height: 100%; |     height: 100%; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ function execute(req) { | |||||||
|  |  | ||||||
|     const affectedNoteIds = getAffectedNoteIds(noteIds, includeDescendants); |     const affectedNoteIds = getAffectedNoteIds(noteIds, includeDescendants); | ||||||
|  |  | ||||||
|     const bulkActionNote = becca.getNote('bulkaction'); |     const bulkActionNote = becca.getNote('bulkAction'); | ||||||
|  |  | ||||||
|     bulkActionService.executeActions(bulkActionNote, affectedNoteIds); |     bulkActionService.executeActions(bulkActionNote, affectedNoteIds); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ const build = require('./build'); | |||||||
| const packageJson = require('../../package'); | const packageJson = require('../../package'); | ||||||
| const {TRILIUM_DATA_DIR} = require('./data_dir'); | const {TRILIUM_DATA_DIR} = require('./data_dir'); | ||||||
|  |  | ||||||
| const APP_DB_VERSION = 204; | const APP_DB_VERSION = 206; | ||||||
| const SYNC_VERSION = 27; | const SYNC_VERSION = 28; | ||||||
| const CLIPPER_PROTOCOL_VERSION = "1.0"; | const CLIPPER_PROTOCOL_VERSION = "1.0"; | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|   | |||||||
| @@ -212,7 +212,7 @@ function BackendScriptApi(currentNote, apiParams) { | |||||||
|      * @property {string} parentNoteId - MANDATORY |      * @property {string} parentNoteId - MANDATORY | ||||||
|      * @property {string} title - MANDATORY |      * @property {string} title - MANDATORY | ||||||
|      * @property {string|buffer} content - MANDATORY |      * @property {string|buffer} content - MANDATORY | ||||||
|      * @property {string} type - text, code, file, image, search, book, relation-map, canvas - MANDATORY |      * @property {string} type - text, code, file, image, search, book, relationMap, canvas - MANDATORY | ||||||
|      * @property {string} mime - value is derived from default mimes for type |      * @property {string} mime - value is derived from default mimes for type | ||||||
|      * @property {boolean} isProtected - default is false |      * @property {boolean} isProtected - default is false | ||||||
|      * @property {boolean} isExpanded - default is false |      * @property {boolean} isExpanded - default is false | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ function exportSingleNote(taskContext, branch, format, res) { | |||||||
|         extension = mimeTypes.extension(note.mime) || 'code'; |         extension = mimeTypes.extension(note.mime) || 'code'; | ||||||
|         mime = note.mime; |         mime = note.mime; | ||||||
|     } |     } | ||||||
|     else if (note.type === 'relation-map' || note.type === 'canvas' || note.type === 'search') { |     else if (note.type === 'relationMap' || note.type === 'canvas' || note.type === 'search') { | ||||||
|         payload = content; |         payload = content; | ||||||
|         extension = 'json'; |         extension = 'json'; | ||||||
|         mime = 'application/json'; |         mime = 'application/json'; | ||||||
|   | |||||||
| @@ -344,7 +344,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (type === 'relation-map' && noteMeta) { |         if (type === 'relationMap' && noteMeta) { | ||||||
|             const relationMapLinks = (noteMeta.attributes || []) |             const relationMapLinks = (noteMeta.attributes || []) | ||||||
|                 .filter(attr => attr.type === 'relation' && attr.name === 'relationMapLink'); |                 .filter(attr => attr.type === 'relation' && attr.name === 'relationMapLink'); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,13 +5,13 @@ module.exports = [ | |||||||
|     'file', |     'file', | ||||||
|     'image', |     'image', | ||||||
|     'search', |     'search', | ||||||
|     'relation-map', |     'relationMap', | ||||||
|     'book', |     'book', | ||||||
|     'note-map', |     'noteMap', | ||||||
|     'mermaid', |     'mermaid', | ||||||
|     'canvas', |     'canvas', | ||||||
|     'web-view', |     'webView', | ||||||
|     'launcher', |     'launcher', | ||||||
|     'doc', |     'doc', | ||||||
|     'content-widget' |     'contentWidget' | ||||||
| ]; | ]; | ||||||
|   | |||||||
| @@ -50,9 +50,9 @@ function deriveMime(type, mime) { | |||||||
|         mime = 'text/html'; |         mime = 'text/html'; | ||||||
|     } else if (type === 'code' || type === 'mermaid') { |     } else if (type === 'code' || type === 'mermaid') { | ||||||
|         mime = 'text/plain'; |         mime = 'text/plain'; | ||||||
|     } else if (['relation-map', 'search', 'canvas'].includes(type)) { |     } else if (['relationMap', 'search', 'canvas'].includes(type)) { | ||||||
|         mime = 'application/json'; |         mime = 'application/json'; | ||||||
|     } else if (['render', 'book', 'web-view'].includes(type)) { |     } else if (['render', 'book', 'webView'].includes(type)) { | ||||||
|         mime = ''; |         mime = ''; | ||||||
|     } else { |     } else { | ||||||
|         mime = 'application/octet-stream'; |         mime = 'application/octet-stream'; | ||||||
| @@ -130,7 +130,7 @@ function getAndValidateParent(params) { | |||||||
|  * - {string} parentNoteId |  * - {string} parentNoteId | ||||||
|  * - {string} title |  * - {string} title | ||||||
|  * - {*} content |  * - {*} content | ||||||
|  * - {string} type - text, code, file, image, search, book, relation-map, canvas, render |  * - {string} type - text, code, file, image, search, book, relationMap, canvas, render | ||||||
|  * |  * | ||||||
|  * Following are optional (have defaults) |  * Following are optional (have defaults) | ||||||
|  * - {string} mime - value is derived from default mimes for type |  * - {string} mime - value is derived from default mimes for type | ||||||
| @@ -495,7 +495,7 @@ function downloadImages(noteId, content) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function saveLinks(note, content) { | function saveLinks(note, content) { | ||||||
|     if (note.type !== 'text' && note.type !== 'relation-map') { |     if (note.type !== 'text' && note.type !== 'relationMap') { | ||||||
|         return content; |         return content; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -512,7 +512,7 @@ function saveLinks(note, content) { | |||||||
|         content = findInternalLinks(content, foundLinks); |         content = findInternalLinks(content, foundLinks); | ||||||
|         content = findIncludeNoteLinks(content, foundLinks); |         content = findIncludeNoteLinks(content, foundLinks); | ||||||
|     } |     } | ||||||
|     else if (note.type === 'relation-map') { |     else if (note.type === 'relationMap') { | ||||||
|         findRelationMapLinks(content, foundLinks); |         findRelationMapLinks(content, foundLinks); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -683,7 +683,7 @@ function getUndeletedParentBranchIds(noteId, deleteId) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function scanForLinks(note) { | function scanForLinks(note) { | ||||||
|     if (!note || !['text', 'relation-map'].includes(note.type)) { |     if (!note || !['text', 'relationMap'].includes(note.type)) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -873,7 +873,7 @@ function duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapp | |||||||
|  |  | ||||||
|         let content = origNote.getContent(); |         let content = origNote.getContent(); | ||||||
|  |  | ||||||
|         if (['text', 'relation-map', 'search'].includes(origNote.type)) { |         if (['text', 'relationMap', 'search'].includes(origNote.type)) { | ||||||
|             // fix links in the content |             // fix links in the content | ||||||
|             content = replaceByMap(content, noteIdMapping); |             content = replaceByMap(content, noteIdMapping); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -89,14 +89,14 @@ function getSearchRoot() { | |||||||
| } | } | ||||||
|  |  | ||||||
| function getGlobalNoteMap() { | function getGlobalNoteMap() { | ||||||
|     let globalNoteMap = becca.getNote('globalnotemap'); |     let globalNoteMap = becca.getNote('globalNoteMap'); | ||||||
|  |  | ||||||
|     if (!globalNoteMap) { |     if (!globalNoteMap) { | ||||||
|         globalNoteMap = noteService.createNewNote({ |         globalNoteMap = noteService.createNewNote({ | ||||||
|             branchId: 'globalnotemap', |             branchId: 'globalNoteMap', | ||||||
|             noteId: 'globalnotemap', |             noteId: 'globalNoteMap', | ||||||
|             title: 'Global Note Map', |             title: 'Global Note Map', | ||||||
|             type: 'note-map', |             type: 'noteMap', | ||||||
|             content: '', |             content: '', | ||||||
|             parentNoteId: getHiddenRoot().noteId |             parentNoteId: getHiddenRoot().noteId | ||||||
|         }).note; |         }).note; | ||||||
| @@ -108,12 +108,12 @@ function getGlobalNoteMap() { | |||||||
| } | } | ||||||
|  |  | ||||||
| function getSqlConsoleRoot() { | function getSqlConsoleRoot() { | ||||||
|     let sqlConsoleRoot = becca.getNote('sqlconsole'); |     let sqlConsoleRoot = becca.getNote('sqlConsole'); | ||||||
|  |  | ||||||
|     if (!sqlConsoleRoot) { |     if (!sqlConsoleRoot) { | ||||||
|         sqlConsoleRoot = noteService.createNewNote({ |         sqlConsoleRoot = noteService.createNewNote({ | ||||||
|             branchId: 'sqlconsole', |             branchId: 'sqlConsole', | ||||||
|             noteId: 'sqlconsole', |             noteId: 'sqlConsole', | ||||||
|             title: 'SQL Console', |             title: 'SQL Console', | ||||||
|             type: 'doc', |             type: 'doc', | ||||||
|             content: '', |             content: '', | ||||||
| @@ -236,12 +236,12 @@ function getShareRoot() { | |||||||
| } | } | ||||||
|  |  | ||||||
| function getBulkActionNote() { | function getBulkActionNote() { | ||||||
|     let bulkActionNote = becca.getNote('bulkaction'); |     let bulkActionNote = becca.getNote('bulkAction'); | ||||||
|  |  | ||||||
|     if (!bulkActionNote) { |     if (!bulkActionNote) { | ||||||
|         bulkActionNote = noteService.createNewNote({ |         bulkActionNote = noteService.createNewNote({ | ||||||
|             branchId: 'bulkaction', |             branchId: 'bulkAction', | ||||||
|             noteId: 'bulkaction', |             noteId: 'bulkAction', | ||||||
|             title: 'Bulk action', |             title: 'Bulk action', | ||||||
|             type: 'text', |             type: 'text', | ||||||
|             content: '', |             content: '', | ||||||
| @@ -331,7 +331,7 @@ const launchers = [ | |||||||
|     { id: 'lb_newnote', command: 'createNoteIntoInbox', title: 'New note', icon: 'bx bx-file-blank', isVisible: true }, |     { id: 'lb_newnote', command: 'createNoteIntoInbox', title: 'New note', icon: 'bx bx-file-blank', isVisible: true }, | ||||||
|     { id: 'lb_search', command: 'searchNotes', title: 'Search notes', icon: 'bx bx-search', isVisible: true }, |     { id: 'lb_search', command: 'searchNotes', title: 'Search notes', icon: 'bx bx-search', isVisible: true }, | ||||||
|     { id: 'lb_jumpto', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send', isVisible: true }, |     { id: 'lb_jumpto', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send', isVisible: true }, | ||||||
|     { id: 'lb_notemap', targetNoteId: 'globalnotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true }, |     { id: 'lb_notemap', targetNoteId: 'globalNotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true }, | ||||||
|     { id: 'lb_calendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true }, |     { id: 'lb_calendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true }, | ||||||
|     { id: 'lb_spacer1', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "50", growthFactor: "0" }, |     { id: 'lb_spacer1', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "50", growthFactor: "0" }, | ||||||
|     { id: 'lb_bookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, |     { id: 'lb_bookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, | ||||||
| @@ -604,7 +604,7 @@ function createOptionNotes() { | |||||||
|             branchId: OPTIONS_APPEARANCE, |             branchId: OPTIONS_APPEARANCE, | ||||||
|             noteId: OPTIONS_APPEARANCE, |             noteId: OPTIONS_APPEARANCE, | ||||||
|             title: 'Appearance', |             title: 'Appearance', | ||||||
|             type: 'content-widget', |             type: 'contentWidget', | ||||||
|             content: '', |             content: '', | ||||||
|             parentNoteId: OPTIONS_ROOT |             parentNoteId: OPTIONS_ROOT | ||||||
|         }).note; |         }).note; | ||||||
|   | |||||||
| @@ -168,7 +168,7 @@ const STRING_MIME_TYPES = [ | |||||||
|  |  | ||||||
| function isStringNote(type, mime) { | function isStringNote(type, mime) { | ||||||
|     // render and book are string note in the sense that they are expected to contain empty string |     // render and book are string note in the sense that they are expected to contain empty string | ||||||
|     return ["text", "code", "relation-map", "search", "render", "book", "mermaid", "canvas"].includes(type) |     return ["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas"].includes(type) | ||||||
|         || mime.startsWith('text/') |         || mime.startsWith('text/') | ||||||
|         || STRING_MIME_TYPES.includes(mime); |         || STRING_MIME_TYPES.includes(mime); | ||||||
| } | } | ||||||
| @@ -192,7 +192,7 @@ function formatDownloadTitle(filename, type, mime) { | |||||||
|  |  | ||||||
|     if (type === 'text') { |     if (type === 'text') { | ||||||
|         return filename + '.html'; |         return filename + '.html'; | ||||||
|     } else if (['relation-map', 'canvas', 'search'].includes(type)) { |     } else if (['relationMap', 'canvas', 'search'].includes(type)) { | ||||||
|         return filename + '.json'; |         return filename + '.json'; | ||||||
|     } else { |     } else { | ||||||
|         if (!mime) { |         if (!mime) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user