diff --git a/src/public/app/menus/shortcut_context_menu.js b/src/public/app/menus/shortcut_context_menu.js index 8fc2f72dc..0caae478f 100644 --- a/src/public/app/menus/shortcut_context_menu.js +++ b/src/public/app/menus/shortcut_context_menu.js @@ -33,15 +33,15 @@ export default class ShortcutContextMenu { const isItem = isVisibleItem || isAvailableItem; return [ - (isVisibleRoot || isAvailableRoot) ? { title: 'Add note shortcut', command: 'addNoteShortcut' } : null, - (isVisibleRoot || isAvailableRoot) ? { title: 'Add widget shortcut', command: 'addWidgetShortcut' } : null, - (isVisibleRoot || isAvailableRoot) ? { title: 'Add spacer', command: 'addSpacerShortcut' } : null, - { title: "----" }, + (isVisibleRoot || isAvailableRoot) ? { title: 'Add note shortcut', command: 'addNoteShortcut', uiIcon: "bx bx-plus" } : null, + (isVisibleRoot || isAvailableRoot) ? { title: 'Add widget shortcut', command: 'addWidgetShortcut', uiIcon: "bx bx-plus" } : null, + (isVisibleRoot || isAvailableRoot) ? { title: 'Add spacer', command: 'addSpacerShortcut', uiIcon: "bx bx-plus" } : null, + (isVisibleRoot || isAvailableRoot) ? { title: "----" } : null, { title: 'Delete ', command: "deleteNotes", uiIcon: "bx bx-trash", enabled: isItem }, { title: "----" }, - isAvailableItem ? { title: 'Move to visible shortcuts', command: "moveNotesTo", uiIcon: "bx bx-empty", enabled: true } : null, - isVisibleItem ? { title: 'Move to available shortcuts', command: "moveNotesTo", uiIcon: "bx bx-empty", enabled: true } : null, + isAvailableItem ? { title: 'Move to visible shortcuts', command: "moveShortcutToVisible", uiIcon: "bx bx-show", enabled: true } : null, + isVisibleItem ? { title: 'Move to available shortcuts', command: "moveShortcutToAvailable", uiIcon: "bx bx-hide", enabled: true } : null, { title: `Duplicate shortcut `, command: "duplicateSubtree", uiIcon: "bx bx-empty", enabled: isItem } ].filter(row => row !== null); diff --git a/src/public/app/widgets/containers/shortcut_container.js b/src/public/app/widgets/containers/shortcut_container.js index 080c8a762..65e5b555c 100644 --- a/src/public/app/widgets/containers/shortcut_container.js +++ b/src/public/app/widgets/containers/shortcut_container.js @@ -42,7 +42,11 @@ export default class ShortcutContainer extends FlexContainer { if (builtinWidget === 'calendar') { this.child(new CalendarWidget(shortcut.title, shortcut.getIcon())); } else if (builtinWidget === 'spacer') { - this.child(new SpacerWidget(40, 10)); + // || has to be inside since 0 is a valid value + const baseSize = parseInt(shortcut.getLabelValue("baseSize") || "40"); + const growthFactor = parseInt(shortcut.getLabelValue("growthFactor") || "100"); + + this.child(new SpacerWidget(baseSize, growthFactor)); } else if (builtinWidget === 'pluginButtons') { this.child(new FlexContainer("column") .id("plugin-buttons") diff --git a/src/public/app/widgets/ribbon_widgets/owned_attribute_list.js b/src/public/app/widgets/ribbon_widgets/owned_attribute_list.js index 836d39a98..db989e0ba 100644 --- a/src/public/app/widgets/ribbon_widgets/owned_attribute_list.js +++ b/src/public/app/widgets/ribbon_widgets/owned_attribute_list.js @@ -47,7 +47,7 @@ export default class OwnedAttributeListWidget extends NoteContextAwareWidget { getTitle() { return { - show: !this.note.isLaunchBarConfig(), + show: true,//!this.note.isLaunchBarConfig(), title: "Owned attributes", icon: "bx bx-list-check" }; diff --git a/src/public/app/widgets/spacer.js b/src/public/app/widgets/spacer.js index 3e1468d09..9281853bb 100644 --- a/src/public/app/widgets/spacer.js +++ b/src/public/app/widgets/spacer.js @@ -3,18 +3,17 @@ import BasicWidget from "./basic_widget.js"; const TPL = `
`; export default class SpacerWidget extends BasicWidget { - constructor(baseSize = 0, growIndex = 1000, shrinkIndex = 1000) { + constructor(baseSize = 0, growthFactor = 1000) { super(); this.baseSize = baseSize; - this.growIndex = growIndex; - this.shrinkIndex = shrinkIndex; + this.growthFactor = growthFactor; } doRender() { this.$widget = $(TPL); this.$widget.css("flex-basis", this.baseSize); - this.$widget.css("flex-grow", this.growIndex); - this.$widget.css("flex-shrink", this.shrinkIndex); + this.$widget.css("flex-grow", this.growthFactor); + this.$widget.css("flex-shrink", 1000); } } diff --git a/src/services/special_notes.js b/src/services/special_notes.js index 8b7adabe0..f7887a00a 100644 --- a/src/services/special_notes.js +++ b/src/services/special_notes.js @@ -312,10 +312,16 @@ const shortcuts = [ { id: 'lb_notemap', targetNoteId: 'globalnotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true }, { id: 'lb_recentchanges', command: 'showRecentChanges', title: 'Recent changes', icon: 'bx bx-history', isVisible: false }, { id: 'lb_calendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true }, - { id: 'lb_spacer1', builtinWidget: 'spacer', title: 'Spacer', icon: 'bx bx-move-vertical', isVisible: true }, - { id: 'lb_pluginbuttons', builtinWidget: 'pluginButtons', title: 'Plugin buttons', icon: 'bx bx-move-vertical', isVisible: true }, + { id: 'lb_spacer1', builtinWidget: 'spacer', title: 'Spacer', icon: 'bx bx-move-vertical', isVisible: true, labels: [ + { type: "number", name: "baseSize", value: "40" }, + { type: "number", name: "growthFactor", value: "100" }, + ] }, + { id: 'lb_pluginbuttons', builtinWidget: 'pluginButtons', title: 'Plugin buttons', icon: 'bx bx-extension', isVisible: true }, { id: 'lb_bookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, - { id: 'lb_spacer2', builtinWidget: 'spacer', title: 'Spacer', icon: 'bx bx-move-vertical', isVisible: true }, + { id: 'lb_spacer2', builtinWidget: 'spacer', title: 'Spacer', icon: 'bx bx-move-vertical', isVisible: true, labels: [ + { type: "number", name: "baseSize", value: "40" }, + { type: "number", name: "growthFactor", value: "100" }, + ] }, { id: 'lb_protectedsession', builtinWidget: 'protectedSession', title: 'Protected session', icon: 'bx bx bx-shield-quarter', isVisible: true }, { id: 'lb_syncstatus', builtinWidget: 'syncStatus', title: 'Sync status', icon: 'bx bx-wifi', isVisible: true }, ]; @@ -331,30 +337,37 @@ function createMissingSpecialNotes() { for (const shortcut of shortcuts) { let note = becca.getNote(shortcut.id); + + if (note) { + continue; + } + const parentNoteId = shortcut.isVisible ? getLaunchBarVisibleShortcutsRoot().noteId : getLaunchBarAvailableShortcutsRoot().noteId; + note = noteService.createNewNote({ + branchId: shortcut.id, + noteId: shortcut.id, + title: shortcut.title, + type: 'text', + content: '', + parentNoteId: parentNoteId + }).note; - if (!note) { - note = noteService.createNewNote({ - branchId: shortcut.id, - noteId: shortcut.id, - title: shortcut.title, - type: 'text', - content: '', - parentNoteId: parentNoteId - }).note; + note.addLabel('builtinShortcut'); + note.addLabel('iconClass', shortcut.icon); - note.addLabel('builtinShortcut'); - note.addLabel('iconClass', shortcut.icon); + if (shortcut.command) { + note.addLabel('command', shortcut.command); + } else if (shortcut.builtinWidget) { + note.addLabel('builtinWidget', shortcut.builtinWidget); + } else if (shortcut.targetNoteId) { + note.addRelation('targetNote', shortcut.targetNoteId); + } else { + throw new Error(`No action defined for shortcut ${JSON.stringify(shortcut)}`); + } - if (shortcut.command) { - note.addLabel('command', shortcut.command); - } else if (shortcut.builtinWidget) { - note.addLabel('builtinWidget', shortcut.builtinWidget); - } else if (shortcut.targetNoteId) { - note.addRelation('targetNote', shortcut.targetNoteId); - } else { - throw new Error(`No action defined for shortcut ${JSON.stringify(shortcut)}`); - } + for (const label of shortcut.labels || []) { + note.addLabel('label:' + label.name, "promoted," + label.type); + note.addLabel(label.name, label.value); } }