diff --git a/static/css/notes2.css b/static/css/notes2.css index 04c9f68..017124a 100644 --- a/static/css/notes2.css +++ b/static/css/notes2.css @@ -9,7 +9,7 @@ --line-color: #ccc; --tree-expander: 0px; - --functions-width: 180px; + --functions-width: 150px; } html { diff --git a/static/images/icon_new_document.svg b/static/images/icon_new_document.svg deleted file mode 100644 index a105e05..0000000 --- a/static/images/icon_new_document.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - file-document-plus-outline - - - diff --git a/static/js/app.mjs b/static/js/app.mjs index 876d11d..a54be2e 100644 --- a/static/js/app.mjs +++ b/static/js/app.mjs @@ -82,18 +82,19 @@ export class App { keyHandler(event) {//{{{ let handled = true - // Most keybindings is Alt+Shift, since the popular browsers at the time (2023) allows to override thees. + if (event.key == 'F2') { + this.nodeUI.renameNode() + return + } + + // All keybindings is Alt+Shift, since the popular browsers at the time (2023) allows to override thees. // Ctrl+S is the exception to using Alt+Shift, since it is overridable and in such widespread use for saving. // Thus, the exception is acceptable to consequent use of alt+shift. - const SHIFT_ALT = event.shiftKey && !event.ctrlKey && event.altKey - const SHIFT_CTRL_ALT = event.shiftKey && event.ctrlKey && event.altKey + if (!(event.shiftKey && event.altKey) && !(event.key.toUpperCase() === 'S' && event.ctrlKey)) + return switch (event.key.toUpperCase()) { - case 'F2': - this.nodeUI.renameNode() - break case 'T': - if (!SHIFT_ALT) break if (document.activeElement.id === 'tree-nodes') this.nodeUI.takeFocus() else @@ -101,25 +102,18 @@ export class App { break case 'F': - if (!SHIFT_ALT) break _mbus.dispatch('op-search') break case 'M': - if (!SHIFT_ALT) break globalThis._mbus.dispatch('MARKDOWN_TOGGLE') break case 'N': - if (SHIFT_ALT) - this.createNode() - else if (SHIFT_CTRL_ALT) { - this.createNode(this.currentNode?.ParentUUID) - } + this.createNode() break case 'S': - if (!SHIFT_ALT) break this.nodeUI.saveNode() break @@ -148,22 +142,18 @@ export class App { async saveNode() {//{{{ }//}}} - async createNode(createUnderUUID) {//{{{ - const parentUUID = createUnderUUID ? createUnderUUID : this.currentNode.UUID - const p = createUnderUUID ? 'Name for sibling document' : 'Name for sub-document' - - let name = prompt(p) + async createNode() {//{{{ + let name = prompt("Name") if (!name) return - const nn = Node.create(name, parentUUID) + const nn = Node.create(name, this.currentNode.UUID) await nn.save() // Treenode is forcefully rerendered and children refetched to both show the new node // and to get it resorted. - const parentTreenode = this.sidebar.getTreeNode(parentUUID) - await parentTreenode.render(true, true) - _mbus.dispatch('GO_TO_NODE', { nodeUUID: nn.UUID }) + const treenode = this.sidebar.getTreeNode(this.currentNode.UUID) + treenode.render(true, true) }//}}} async goToNode(nodeUUID, dontPush, dontExpand) {//{{{ if (nodeUUID === null || nodeUUID === undefined) diff --git a/static/js/page_node.mjs b/static/js/page_node.mjs index b86b172..28388f8 100644 --- a/static/js/page_node.mjs +++ b/static/js/page_node.mjs @@ -9,11 +9,10 @@ export class N2PageNodeUI extends CustomHTMLElement {