From b9632a7814be473d17ba92cc5c44de83b37d430a Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 6 Dec 2022 23:01:42 +0100 Subject: [PATCH] rename note types to camelCase --- db/migrations/0205__rename_note_types.sql | 3 ++ db/migrations/0206__rename_noteIds.sql | 15 ++++++++++ src/etapi/etapi.openapi.yaml | 4 +-- src/public/app/entities/note_short.js | 8 +++--- .../app/services/note_content_renderer.js | 4 +-- src/public/app/services/note_list_renderer.js | 2 +- src/public/app/services/note_types.js | 6 ++-- .../app/widgets/buttons/note_actions.js | 2 +- .../app/widgets/dialogs/bulk_actions.js | 6 ++-- .../floating_buttons/relation_map_buttons.js | 2 +- src/public/app/widgets/note_detail.js | 28 +++++++++---------- src/public/app/widgets/note_type.js | 8 +++--- src/public/app/widgets/note_wrapper.js | 2 +- .../widgets/type_widgets/content_widget.js | 2 +- .../app/widgets/type_widgets/editable_code.js | 2 +- .../app/widgets/type_widgets/editable_text.js | 2 +- .../app/widgets/type_widgets/note_map.js | 2 +- .../widgets/type_widgets/protected_session.js | 2 +- .../widgets/type_widgets/read_only_code.js | 2 +- .../widgets/type_widgets/read_only_text.js | 2 +- .../app/widgets/type_widgets/relation_map.js | 2 +- .../app/widgets/type_widgets/web_view.js | 2 +- src/public/stylesheets/relation_map.css | 2 +- src/routes/api/bulk_action.js | 2 +- src/services/app_info.js | 4 +-- src/services/backend_script_api.js | 2 +- src/services/export/single.js | 2 +- src/services/import/zip.js | 2 +- src/services/note_types.js | 8 +++--- src/services/notes.js | 14 +++++----- src/services/special_notes.js | 24 ++++++++-------- src/services/utils.js | 4 +-- 32 files changed, 95 insertions(+), 77 deletions(-) create mode 100644 db/migrations/0205__rename_note_types.sql create mode 100644 db/migrations/0206__rename_noteIds.sql diff --git a/db/migrations/0205__rename_note_types.sql b/db/migrations/0205__rename_note_types.sql new file mode 100644 index 000000000..3a056bceb --- /dev/null +++ b/db/migrations/0205__rename_note_types.sql @@ -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'; diff --git a/db/migrations/0206__rename_noteIds.sql b/db/migrations/0206__rename_noteIds.sql new file mode 100644 index 000000000..1fb34dc02 --- /dev/null +++ b/db/migrations/0206__rename_noteIds.sql @@ -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'; diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yaml index c7718e394..2928ffcb1 100644 --- a/src/etapi/etapi.openapi.yaml +++ b/src/etapi/etapi.openapi.yaml @@ -709,7 +709,7 @@ components: - image - search - book - - relation-map + - relationMap - render mime: type: string @@ -747,7 +747,7 @@ components: type: string type: 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: type: string isProtected: diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js index 46307bbf0..656e2b8b6 100644 --- a/src/public/app/entities/note_short.js +++ b/src/public/app/entities/note_short.js @@ -15,15 +15,15 @@ const NOTE_TYPE_ICONS = { "code": "bx bx-code", "render": "bx bx-extension", "search": "bx bx-file-find", - "relation-map": "bx bx-map-alt", + "relationMap": "bx bx-map-alt", "book": "bx bx-book", - "note-map": "bx bx-map-alt", + "noteMap": "bx bx-map-alt", "mermaid": "bx bx-selection", "canvas": "bx bx-pen", - "web-view": "bx bx-globe-alt", + "webView": "bx bx-globe-alt", "launcher": "bx bx-link", "doc": "bx bxs-file-doc", - "content-widget": "bx bxs-widget" + "contentWidget": "bx bxs-widget" }; /** diff --git a/src/public/app/services/note_content_renderer.js b/src/public/app/services/note_content_renderer.js index b315e88bf..f1dfd1f42 100644 --- a/src/public/app/services/note_content_renderer.js +++ b/src/public/app/services/note_content_renderer.js @@ -148,7 +148,7 @@ async function getRenderedContent(note, options = {}) { else if (type === 'book') { // nothing, book doesn't have its own content } - else if (!options.tooltip && type === 'protected-session') { + else if (!options.tooltip && type === 'protectedSession') { const $button = $(``) .on('click', protectedSessionService.enterProtectedSession); @@ -219,7 +219,7 @@ function getRenderingType(note) { protectedSessionHolder.touchProtectedSession(); } else { - type = 'protected-session'; + type = 'protectedSession'; } } diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.js index 2ed5b5ea3..1180fa2ec 100644 --- a/src/public/app/services/note_list_renderer.js +++ b/src/public/app/services/note_list_renderer.js @@ -92,7 +92,7 @@ const TPL = ` 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; align-items: center; justify-content: center; diff --git a/src/public/app/services/note_types.js b/src/public/app/services/note_types.js index 4f89616fc..40bc4a88b 100644 --- a/src/public/app/services/note_types.js +++ b/src/public/app/services/note_types.js @@ -6,13 +6,13 @@ async function getNoteTypeItems(command) { { title: "Text", command: command, type: "text", uiIcon: "bx bx-note" }, { title: "Code", command: command, type: "code", uiIcon: "bx bx-code" }, { 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: "Note Map", command: command, type: "note-map", uiIcon: "bx bx-map-alt" }, + { title: "Relation Map", command: command, type: "relationMap", 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: "Book", command: command, type: "book", uiIcon: "bx bx-book" }, { title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" }, { 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"); diff --git a/src/public/app/widgets/buttons/note_actions.js b/src/public/app/widgets/buttons/note_actions.js index 8b682013e..c5f783597 100644 --- a/src/public/app/widgets/buttons/note_actions.js +++ b/src/public/app/widgets/buttons/note_actions.js @@ -81,7 +81,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { refreshWithNote(note) { 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)); diff --git a/src/public/app/widgets/dialogs/bulk_actions.js b/src/public/app/widgets/dialogs/bulk_actions.js index 36ea93bf1..29f648443 100644 --- a/src/public/app/widgets/dialogs/bulk_actions.js +++ b/src/public/app/widgets/dialogs/bulk_actions.js @@ -83,7 +83,7 @@ export default class BulkActionsDialog extends BasicWidget { this.$widget.on('click', '[data-action-add]', async event => { const actionName = $(event.target).attr('data-action-add'); - await bulkActionService.addAction('bulkaction', actionName); + await bulkActionService.addAction('bulkAction', actionName); await this.refresh(); }); @@ -111,7 +111,7 @@ export default class BulkActionsDialog extends BasicWidget { this.$affectedNoteCount.text(affectedNoteCount); - const bulkActionNote = await froca.getNote('bulkaction'); + const bulkActionNote = await froca.getNote('bulkAction'); const actions = bulkActionService.parseActions(bulkActionNote); @@ -150,7 +150,7 @@ export default class BulkActionsDialog extends BasicWidget { if (loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'action' - && attr.noteId === 'bulkaction' + && attr.noteId === 'bulkAction' && attr.isDeleted)) { // this may be triggered from e.g. sync without open widget, then no need to refresh the widget diff --git a/src/public/app/widgets/floating_buttons/relation_map_buttons.js b/src/public/app/widgets/floating_buttons/relation_map_buttons.js index 5940b67b2..355a79bb1 100644 --- a/src/public/app/widgets/floating_buttons/relation_map_buttons.js +++ b/src/public/app/widgets/floating_buttons/relation_map_buttons.js @@ -23,7 +23,7 @@ const TPL = ` export default class RelationMapButtons extends NoteContextAwareWidget { isEnabled() { - return super.isEnabled() && this.note?.type === 'relation-map'; + return super.isEnabled() && this.note?.type === 'relationMap'; } doRender() { diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 65c232fb2..1a802ff87 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -46,22 +46,22 @@ const TPL = ` const typeWidgetClasses = { 'empty': EmptyTypeWidget, 'deleted': DeletedTypeWidget, - 'editable-text': EditableTextTypeWidget, - 'read-only-text': ReadOnlyTextTypeWidget, - 'editable-code': EditableCodeTypeWidget, - 'read-only-code': ReadOnlyCodeTypeWidget, + 'editableText': EditableTextTypeWidget, + 'readOnlyText': ReadOnlyTextTypeWidget, + 'editableCode': EditableCodeTypeWidget, + 'readOnlyCode': ReadOnlyCodeTypeWidget, 'file': FileTypeWidget, 'image': ImageTypeWidget, 'search': NoneTypeWidget, 'render': RenderTypeWidget, - 'relation-map': RelationMapTypeWidget, + 'relationMap': RelationMapTypeWidget, 'canvas': CanvasTypeWidget, - 'protected-session': ProtectedSessionTypeWidget, + 'protectedSession': ProtectedSessionTypeWidget, 'book': BookTypeWidget, 'note-map': NoteMapTypeWidget, - 'web-view': WebViewTypeWidget, + 'webView': WebViewTypeWidget, 'doc': DocTypeWidget, - 'content-widget': ContentWidgetTypeWidget + 'contentWidget': ContentWidgetTypeWidget }; export default class NoteDetailWidget extends NoteContextAwareWidget { @@ -164,7 +164,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { // https://github.com/zadam/trilium/issues/2522 this.$widget.toggleClass("full-height", !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'); } @@ -188,19 +188,19 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { let type = note.type; if (type === 'text' && await this.noteContext.isReadOnly()) { - type = 'read-only-text'; + type = 'readOnlyText'; } if ((type === 'code' || type === 'mermaid') && await this.noteContext.isReadOnly()) { - type = 'read-only-code'; + type = 'readOnlyCode'; } if (type === 'text') { - type = 'editable-text'; + type = 'editableText'; } if (type === 'code' || type === 'mermaid') { - type = 'editable-code'; + type = 'editableCode'; } if (type === 'launcher') { @@ -208,7 +208,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { } if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { - type = 'protected-session'; + type = 'protectedSession'; } return type; diff --git a/src/public/app/widgets/note_type.js b/src/public/app/widgets/note_type.js index f40a19310..779ada63b 100644 --- a/src/public/app/widgets/note_type.js +++ b/src/public/app/widgets/note_type.js @@ -7,18 +7,18 @@ const NOTE_TYPES = [ { type: "file", title: "File", selectable: false }, { type: "image", title: "Image", 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: "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: "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: "canvas", mime: 'application/json', title: "Canvas", selectable: true }, { type: "mermaid", mime: 'text/mermaid', title: "Mermaid Diagram", 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 } ]; diff --git a/src/public/app/widgets/note_wrapper.js b/src/public/app/widgets/note_wrapper.js index 43979ada4..c91e42e80 100644 --- a/src/public/app/widgets/note_wrapper.js +++ b/src/public/app/widgets/note_wrapper.js @@ -43,7 +43,7 @@ export default class NoteWrapperWidget extends FlexContainer { } 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') ); diff --git a/src/public/app/widgets/type_widgets/content_widget.js b/src/public/app/widgets/type_widgets/content_widget.js index 52af7af0b..363050337 100644 --- a/src/public/app/widgets/type_widgets/content_widget.js +++ b/src/public/app/widgets/type_widgets/content_widget.js @@ -26,7 +26,7 @@ const CONTENT_WIDGETS = { }; export default class ContentWidgetTypeWidget extends TypeWidget { - static getType() { return "content-widget"; } + static getType() { return "contentWidget"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/editable_code.js b/src/public/app/widgets/type_widgets/editable_code.js index 143c65458..6abca184e 100644 --- a/src/public/app/widgets/type_widgets/editable_code.js +++ b/src/public/app/widgets/type_widgets/editable_code.js @@ -21,7 +21,7 @@ const TPL = ` `; export default class EditableCodeTypeWidget extends TypeWidget { - static getType() { return "editable-code"; } + static getType() { return "editableCode"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.js index 856273e3c..c41d020aa 100644 --- a/src/public/app/widgets/type_widgets/editable_text.js +++ b/src/public/app/widgets/type_widgets/editable_text.js @@ -83,7 +83,7 @@ const TPL = ` `; export default class EditableTextTypeWidget extends AbstractTextTypeWidget { - static getType() { return "editable-text"; } + static getType() { return "editableText"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/note_map.js b/src/public/app/widgets/type_widgets/note_map.js index 5e0680b9c..895d2ea7b 100644 --- a/src/public/app/widgets/type_widgets/note_map.js +++ b/src/public/app/widgets/type_widgets/note_map.js @@ -4,7 +4,7 @@ import NoteMapWidget from "../note_map.js"; const TPL = `
`; export default class NoteMapTypeWidget extends TypeWidget { - static getType() { return "note-map"; } + static getType() { return "noteMap"; } constructor() { super(); diff --git a/src/public/app/widgets/type_widgets/protected_session.js b/src/public/app/widgets/type_widgets/protected_session.js index 8a7508894..994313fc2 100644 --- a/src/public/app/widgets/type_widgets/protected_session.js +++ b/src/public/app/widgets/type_widgets/protected_session.js @@ -21,7 +21,7 @@ const TPL = ` `; export default class ProtectedSessionTypeWidget extends TypeWidget { - static getType() { return "protected-session"; } + static getType() { return "protectedSession"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/read_only_code.js b/src/public/app/widgets/type_widgets/read_only_code.js index 8a54d4bc0..bd817fa65 100644 --- a/src/public/app/widgets/type_widgets/read_only_code.js +++ b/src/public/app/widgets/type_widgets/read_only_code.js @@ -17,7 +17,7 @@ const TPL = ` `; export default class ReadOnlyCodeTypeWidget extends TypeWidget { - static getType() { return "read-only-code"; } + static getType() { return "readOnlyCode"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/read_only_text.js b/src/public/app/widgets/type_widgets/read_only_text.js index eabc32cfc..f8f13debd 100644 --- a/src/public/app/widgets/type_widgets/read_only_text.js +++ b/src/public/app/widgets/type_widgets/read_only_text.js @@ -67,7 +67,7 @@ const TPL = ` `; export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget { - static getType() { return "read-only-text"; } + static getType() { return "readOnlyText"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/relation_map.js b/src/public/app/widgets/type_widgets/relation_map.js index acc687c37..c3e1a1402 100644 --- a/src/public/app/widgets/type_widgets/relation_map.js +++ b/src/public/app/widgets/type_widgets/relation_map.js @@ -74,7 +74,7 @@ const TPL = ` let containerCounter = 1; export default class RelationMapTypeWidget extends TypeWidget { - static getType() { return "relation-map"; } + static getType() { return "relationMap"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/app/widgets/type_widgets/web_view.js b/src/public/app/widgets/type_widgets/web_view.js index e35bd79b3..766bb608b 100644 --- a/src/public/app/widgets/type_widgets/web_view.js +++ b/src/public/app/widgets/type_widgets/web_view.js @@ -19,7 +19,7 @@ const TPL = ` `; export default class WebViewTypeWidget extends TypeWidget { - static getType() { return "web-view"; } + static getType() { return "webView"; } doRender() { this.$widget = $(TPL); diff --git a/src/public/stylesheets/relation_map.css b/src/public/stylesheets/relation_map.css index 1882a6d48..c78767de4 100644 --- a/src/public/stylesheets/relation_map.css +++ b/src/public/stylesheets/relation_map.css @@ -1,4 +1,4 @@ -.type-relation-map .note-detail { +.type-relationMap .note-detail { height: 100%; } diff --git a/src/routes/api/bulk_action.js b/src/routes/api/bulk_action.js index 902e9a675..ebf431040 100644 --- a/src/routes/api/bulk_action.js +++ b/src/routes/api/bulk_action.js @@ -6,7 +6,7 @@ function execute(req) { const affectedNoteIds = getAffectedNoteIds(noteIds, includeDescendants); - const bulkActionNote = becca.getNote('bulkaction'); + const bulkActionNote = becca.getNote('bulkAction'); bulkActionService.executeActions(bulkActionNote, affectedNoteIds); } diff --git a/src/services/app_info.js b/src/services/app_info.js index 8906fe526..23de6de7b 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -4,8 +4,8 @@ const build = require('./build'); const packageJson = require('../../package'); const {TRILIUM_DATA_DIR} = require('./data_dir'); -const APP_DB_VERSION = 204; -const SYNC_VERSION = 27; +const APP_DB_VERSION = 206; +const SYNC_VERSION = 28; const CLIPPER_PROTOCOL_VERSION = "1.0"; module.exports = { diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js index ec3705e0f..238e604a8 100644 --- a/src/services/backend_script_api.js +++ b/src/services/backend_script_api.js @@ -212,7 +212,7 @@ function BackendScriptApi(currentNote, apiParams) { * @property {string} parentNoteId - MANDATORY * @property {string} title - 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 {boolean} isProtected - default is false * @property {boolean} isExpanded - default is false diff --git a/src/services/export/single.js b/src/services/export/single.js index 881bb394b..838631444 100644 --- a/src/services/export/single.js +++ b/src/services/export/single.js @@ -41,7 +41,7 @@ function exportSingleNote(taskContext, branch, format, res) { extension = mimeTypes.extension(note.mime) || 'code'; 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; extension = 'json'; mime = 'application/json'; diff --git a/src/services/import/zip.js b/src/services/import/zip.js index e182126c1..2e2c1c7ed 100644 --- a/src/services/import/zip.js +++ b/src/services/import/zip.js @@ -344,7 +344,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) { } } - if (type === 'relation-map' && noteMeta) { + if (type === 'relationMap' && noteMeta) { const relationMapLinks = (noteMeta.attributes || []) .filter(attr => attr.type === 'relation' && attr.name === 'relationMapLink'); diff --git a/src/services/note_types.js b/src/services/note_types.js index ef20b95d5..6e970f2d3 100644 --- a/src/services/note_types.js +++ b/src/services/note_types.js @@ -5,13 +5,13 @@ module.exports = [ 'file', 'image', 'search', - 'relation-map', + 'relationMap', 'book', - 'note-map', + 'noteMap', 'mermaid', 'canvas', - 'web-view', + 'webView', 'launcher', 'doc', - 'content-widget' + 'contentWidget' ]; diff --git a/src/services/notes.js b/src/services/notes.js index e9c22ddd3..176556d33 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -50,9 +50,9 @@ function deriveMime(type, mime) { mime = 'text/html'; } else if (type === 'code' || type === 'mermaid') { mime = 'text/plain'; - } else if (['relation-map', 'search', 'canvas'].includes(type)) { + } else if (['relationMap', 'search', 'canvas'].includes(type)) { mime = 'application/json'; - } else if (['render', 'book', 'web-view'].includes(type)) { + } else if (['render', 'book', 'webView'].includes(type)) { mime = ''; } else { mime = 'application/octet-stream'; @@ -130,7 +130,7 @@ function getAndValidateParent(params) { * - {string} parentNoteId * - {string} title * - {*} 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) * - {string} mime - value is derived from default mimes for type @@ -495,7 +495,7 @@ function downloadImages(noteId, content) { } function saveLinks(note, content) { - if (note.type !== 'text' && note.type !== 'relation-map') { + if (note.type !== 'text' && note.type !== 'relationMap') { return content; } @@ -512,7 +512,7 @@ function saveLinks(note, content) { content = findInternalLinks(content, foundLinks); content = findIncludeNoteLinks(content, foundLinks); } - else if (note.type === 'relation-map') { + else if (note.type === 'relationMap') { findRelationMapLinks(content, foundLinks); } else { @@ -683,7 +683,7 @@ function getUndeletedParentBranchIds(noteId, deleteId) { } function scanForLinks(note) { - if (!note || !['text', 'relation-map'].includes(note.type)) { + if (!note || !['text', 'relationMap'].includes(note.type)) { return; } @@ -873,7 +873,7 @@ function duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapp let content = origNote.getContent(); - if (['text', 'relation-map', 'search'].includes(origNote.type)) { + if (['text', 'relationMap', 'search'].includes(origNote.type)) { // fix links in the content content = replaceByMap(content, noteIdMapping); } diff --git a/src/services/special_notes.js b/src/services/special_notes.js index e7cad07a3..5b5efc559 100644 --- a/src/services/special_notes.js +++ b/src/services/special_notes.js @@ -89,14 +89,14 @@ function getSearchRoot() { } function getGlobalNoteMap() { - let globalNoteMap = becca.getNote('globalnotemap'); + let globalNoteMap = becca.getNote('globalNoteMap'); if (!globalNoteMap) { globalNoteMap = noteService.createNewNote({ - branchId: 'globalnotemap', - noteId: 'globalnotemap', + branchId: 'globalNoteMap', + noteId: 'globalNoteMap', title: 'Global Note Map', - type: 'note-map', + type: 'noteMap', content: '', parentNoteId: getHiddenRoot().noteId }).note; @@ -108,12 +108,12 @@ function getGlobalNoteMap() { } function getSqlConsoleRoot() { - let sqlConsoleRoot = becca.getNote('sqlconsole'); + let sqlConsoleRoot = becca.getNote('sqlConsole'); if (!sqlConsoleRoot) { sqlConsoleRoot = noteService.createNewNote({ - branchId: 'sqlconsole', - noteId: 'sqlconsole', + branchId: 'sqlConsole', + noteId: 'sqlConsole', title: 'SQL Console', type: 'doc', content: '', @@ -236,12 +236,12 @@ function getShareRoot() { } function getBulkActionNote() { - let bulkActionNote = becca.getNote('bulkaction'); + let bulkActionNote = becca.getNote('bulkAction'); if (!bulkActionNote) { bulkActionNote = noteService.createNewNote({ - branchId: 'bulkaction', - noteId: 'bulkaction', + branchId: 'bulkAction', + noteId: 'bulkAction', title: 'Bulk action', type: 'text', content: '', @@ -331,7 +331,7 @@ const launchers = [ { 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_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_spacer1', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "50", growthFactor: "0" }, { id: 'lb_bookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, @@ -604,7 +604,7 @@ function createOptionNotes() { branchId: OPTIONS_APPEARANCE, noteId: OPTIONS_APPEARANCE, title: 'Appearance', - type: 'content-widget', + type: 'contentWidget', content: '', parentNoteId: OPTIONS_ROOT }).note; diff --git a/src/services/utils.js b/src/services/utils.js index 0a3cffa86..af0e66f8e 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -168,7 +168,7 @@ const STRING_MIME_TYPES = [ function isStringNote(type, mime) { // 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/') || STRING_MIME_TYPES.includes(mime); } @@ -192,7 +192,7 @@ function formatDownloadTitle(filename, type, mime) { if (type === 'text') { return filename + '.html'; - } else if (['relation-map', 'canvas', 'search'].includes(type)) { + } else if (['relationMap', 'canvas', 'search'].includes(type)) { return filename + '.json'; } else { if (!mime) {