From 98de90c90e0791b32f797481aef73d5eb8d40995 Mon Sep 17 00:00:00 2001 From: fuwaa Date: Wed, 24 Aug 2022 16:08:38 +0800 Subject: [PATCH] support majority of commands --- .../{wordcount.json => commandpalette.json} | 0 lib/commands/application.js | 2 +- lib/commands/core.js | 336 ++++-- lib/commands/editor.js | 979 +++++++++--------- lib/commands/exportimport.js | 10 +- lib/commands/formatting.js | 30 +- lib/commands/notetagsbar.js | 26 +- lib/commands/plugins.js | 23 + lib/commands/view.js | 22 +- lib/commands/window.js | 25 +- lib/components/command.js | 92 +- lib/components/palette.js | 26 +- lib/navigation/handleEvents.js | 1 - menus/commandpalette.json | 2 +- package.json | 4 +- styles/palettemodal.less | 6 +- tools/main.py | 2 +- 17 files changed, 873 insertions(+), 713 deletions(-) rename keymaps/{wordcount.json => commandpalette.json} (100%) create mode 100644 lib/commands/plugins.js diff --git a/keymaps/wordcount.json b/keymaps/commandpalette.json similarity index 100% rename from keymaps/wordcount.json rename to keymaps/commandpalette.json diff --git a/lib/commands/application.js b/lib/commands/application.js index 890d10d..c761172 100644 --- a/lib/commands/application.js +++ b/lib/commands/application.js @@ -23,7 +23,7 @@ export default [ name: ">Open preferences", category: "Application", command: "application:open-preferences", - shortcut: [""], + shortcut: ["ctrl", ","], }, { name: ">Open website", diff --git a/lib/commands/core.js b/lib/commands/core.js index acd0045..d5858a4 100644 --- a/lib/commands/core.js +++ b/lib/commands/core.js @@ -2,138 +2,136 @@ export default [ { - name: "!Copy", + name: ">Copy", category: "Core", command: "core:copy", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "c"], }, { - name: "!Copy Image", + name: ">Copy Image", category: "Core", command: "core:copy-image", selector: "body", - state: "error", + state: "notworking", shortcut: [""], }, { - name: "!Copy Note Link", + name: ">Copy Note Link", category: "Core", command: "core:copy-note-link", - selector: "body", - state: "inprogress", - shortcut: [""], + selector: ".note-list-bar", + shortcut: ["ctrl", "c"], }, { - name: "!Cut", + name: ">Cut", category: "Core", command: "core:cut", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "x"], }, { - name: "!Delete Note", + name: ">Delete Note", category: "Core", command: "core:delete-note", - selector: "body", - shortcut: [""], + selector: ".note-list-bar", + shortcut: ["ctrl", "bkspc"], }, { - name: "!Delete Notebook", + name: ">Delete Notebook", category: "Core", command: "core:delete-notebook", state: "disabled", shortcut: [""], }, { - name: "!Delete Tag", + name: ">Delete Tag", category: "Core", command: "core:delete-tag", state: "disabled", shortcut: [""], }, { - name: "!Duplicate Note", + name: ">Duplicate Note", category: "Core", command: "core:duplicate-note", - selector: "body", - shortcut: [""], + selector: ".note-list-bar", + shortcut: ["ctrl", "d"], }, { - name: "!Empty Trash", + name: ">Empty Trash", category: "Core", command: "core:empty-trash", selector: "body", shortcut: [""], }, { - name: "!Filter notes", + name: ">Filter notes", category: "Core", command: "core:filter-notes", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Filter by tag", + name: ">Filter by tag", category: "Core", command: "core:filter-by-tag", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Find", + name: ">Find", category: "Core", command: "core:find", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "shft", "f"], }, { - name: "!Clear search bar", + name: ">Clear search bar", category: "Core", command: "core:find-clear", - selector: "body", - state: "error", - shortcut: [""], + selector: ".note-list-search-bar input", + shortcut: ["esc"], }, { - name: "!Find (Global)", + name: ">Find (Global)", category: "Core", command: "core:find-global", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "alt", "shft", "f"], }, { - name: "!Focus next", + name: ">Focus next", category: "Core", command: "core:focus-next", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["tab"], }, { - name: "!Focus note list bar", + name: ">Focus note list bar", category: "Core", command: "core:focus-note-list-bar", - selector: "body", - state: "error", - shortcut: [""], + selector: ".note-list-search-bar input", + state: "notworking", + shortcut: ["ctrl", "alt", "l"], }, { - name: "!Focus previous", + name: ">Focus previous", category: "Core", command: "core:focus-previous", selector: "body", - state: "error", + state: "notworking", shortcut: [""], }, { - name: "!Move notebook", + name: ">Move notebook", category: "Core", command: "core:move-notebook", state: "disabled", @@ -141,146 +139,146 @@ export default [ shortcut: [""], }, { - name: "!Move to notebook", + name: ">Move to notebook", category: "Core", command: "core:move-to-notebook", - selector: "body", - shortcut: [""], + selector: ".note-list-bar", + shortcut: ["ctrl", "alt", "m"], }, { - name: "!Navigate back", + name: ">Navigate back", category: "Core", command: "core:navigate-back", selector: "body", - shortcut: [""], + shortcut: ["alt", "left"], }, { - name: "!Navigate forward", + name: ">Navigate forward", category: "Core", command: "core:navigate-forward", selector: "body", - shortcut: [""], + shortcut: ["alt", "right"], }, { - name: "!New Note", + name: ">New Note", category: "Core", command: "core:new-note", selector: "body", - shortcut: [""], + shortcut: ["ctrl", "n"], }, { - name: "!New Notebook", + name: ">New Notebook", category: "Core", command: "core:new-notebook", selector: "body", shortcut: [""], }, { - name: "!Show all notes", + name: ">Show all notes", category: "Core", command: "core:note-list-show-all-notes", selector: "body", shortcut: [""], }, { - name: "!Show all notes in specified notebook", + name: ">Show all notes in specified notebook", category: "Core", command: "core:note-list-show-notes-in-book", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Show all notes by tag", + name: ">Show all notes by tag", category: "Core", command: "core:notes-list-show-notes-with-tag", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Show all notes with status", + name: ">Show all notes with status", category: "Core", command: "core:note-list-show-notes-with-status", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Show notes in book of editing note", + name: ">Show notes in book of editing note", category: "Core", command: "core:note-list-show-notes-in-book-of-editing-note", selector: "body", shortcut: [""], }, { - name: "!Open first note", + name: ">Open first note", category: "Core", command: "core:open-first-note", selector: "body", shortcut: [""], }, { - name: "!Open next note", + name: ">Open next note", category: "Core", command: "core:open-next-note", selector: "body", - shortcut: [""], + shortcut: ["ctrl", "tab"], }, { - name: "!Close note", + name: ">Close note", category: "Core", command: "core:close-note", selector: "body", shortcut: [""], }, { - name: "!Open note", + name: ">Open note", category: "Core", command: "core:open-note", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Open note in separate window", + name: ">Open note in separate window", category: "Core", command: "core:open-note-in-separate-window", selector: "body", - shortcut: [""], + shortcut: ["shft", "return"], }, { - name: "!Open previous note", + name: ">Open previous note", category: "Core", command: "core:open-prev-note", selector: "body", - shortcut: [""], + shortcut: ["ctrl", "shift", "tab"], }, { - name: "!Open tag settings", + name: ">Open tag settings", category: "Core", command: "core:open-tag-settings", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Paste", + name: ">Paste", category: "Core", command: "core:paste", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "v"], }, { - name: "!Redo", + name: ">Redo", category: "Core", command: "core:redo", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "y"], }, { - name: "!Rename Notebook", + name: ">Rename Notebook", category: "Core", command: "core:rename-notebook", selector: "body", @@ -288,95 +286,115 @@ export default [ shortcut: [""], }, { - name: "!Save Image", + name: ">Save Image", category: "Core", command: "core:save-image", selector: "body", - state: "error", + state: "notworking", shortcut: [""], }, { - name: "!Save Note", + name: ">Save Note", category: "Core", command: "core:save-note", selector: "body", - shortcut: [""], + shortcut: ["ctrl", "s"], }, { - name: "!Select all", + name: ">Select all", category: "Core", command: "core:select-all", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "a"], }, { - name: "!Search notes", + name: ">Search notes", category: "Core", command: "core:search-notes", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Share note", + name: ">Share note", category: "Core", command: "core:share-note", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Show note revisions", + name: ">Show note revisions", category: "Core", command: "core:show-note-revisions", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Focus sidebar", + name: ">Focus sidebar", category: "Core", command: "core:sidebar-focus", selector: "body", - state: "error", - shortcut: [""], + state: "notworking", + shortcut: ["shft", "tab"], }, { - name: "!Select next item on sidebar", + name: ">Select next item on sidebar", category: "Core", command: "core:sidebar-select-next-item", selector: "body", - shortcut: [""], + shortcut: ["up"], }, { - name: "!Select previous item on sidebar", + name: ">Select previous item on sidebar", category: "Core", command: "core:sidebar-select-prev-item", selector: "body", - shortcut: [""], + shortcut: ["down"], }, { - name: "!Undo", + name: ">Disclose item on sidebar", + category: "Core", + command: "core:sidebar-disclose-item", + selector: "body", + shortcut: ["enter"], + }, + { + name: ">Expand item on sidebar", + category: "Core", + command: "core:sidebar-expand-item", + selector: "body", + shortcut: ["right"], + }, + { + name: ">Collapse item on sidebar", + category: "Core", + command: "core:sidebar-collapse-item", + selector: "body", + shortcut: ["left"], + }, + { + name: ">Undo", category: "Core", command: "core:undo", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "z"], }, { name: ">Toggle editor drawer", category: "Core", command: "core:toggle-editor-drawer", selector: "body", - state: "inprogress", - shortcut: [""], + state: "notworking", + shortcut: ["ctrl", "j"], }, { name: ">Show editor drawer", category: "Core", command: "core:show-editor-drawer", selector: "body", - state: "inprogress", shortcut: [""], }, { @@ -384,7 +402,109 @@ export default [ category: "Core", command: "core:close-editor-drawer", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["esc"], + }, + { + name: ">Do nothing", + category: "Core", + command: "core:do-nothing", + selector: ".editor-header-title-input input", + state: "notworking", + shortcut: ["ctrl", "w"], + }, + { + name: ">Copy preview selection", + category: "Core", + command: "core:do-nothing", + selector: ".mde-preview", + state: "notworking", + shortcut: ["ctrl", "c"], + }, + { + name: ">Hide workspace menu on sidebar", + category: "Core", + command: "core:sidebar-hide-workspace-menu", + selector: ".sidebar-workspace-menu", + state: "notworking", + shortcut: ["bkspc"], + }, + { + name: ">Unpin/Pin note to top", + category: "Core", + command: "core:pin-note-to-top", + selector: ".note-list-bar", + shortcut: ["p"], + }, + { + name: ">Submit", + category: "Core", + command: "core:submit", + selector: ".input-datetime", + state: "notworking", + shortcut: ["return"], + }, + { + name: ">Cancel", + category: "Core", + command: "core:cancel", + selector: ".input-datetime", + state: "notworking", + shortcut: ["esc"], + }, + { + name: ">Move up on list bar", + category: "Core", + command: "core:list-bar-move-up", + selector: ".list-bar", + state: "notworking", + shortcut: ["up"], + }, + { + name: ">Move down on list bar", + category: "Core", + command: "core:list-bar-move-down", + selector: ".list-bar", + state: "notworking", + shortcut: ["down"], + }, + { + name: ">Invoke submit on list bar", + category: "Core", + command: "core:list-bar-submit", + selector: ".list-bar", + state: "notworking", + shortcut: ["return"], + }, + { + name: ">Cancel list bar action", + category: "Core", + command: "core:list-bar-cancel", + selector: ".list-bar", + state: "notworking", + shortcut: ["esc"], + }, + { + name: ">Move up on notebook list", + category: "Core", + command: "core:notebook-list-bar-input-move-up", + selector: ".notebook-list-bar input", + state: "notworking", + shortcut: ["up"], + }, + { + name: ">Move down on notebook list", + category: "Core", + command: "core:notebook-list-bar-input-move-down", + selector: ".notebook-list-bar input", + state: "notworking", + shortcut: ["down"], + }, + { + name: ">Invoke submit on notebook list", + category: "Core", + command: "core:notebook-list-bar-input-move-submit", + selector: ".notebook-list-bar input", + state: "notworking", + shortcut: ["return"], }, ]; diff --git a/lib/commands/editor.js b/lib/commands/editor.js index 9cb6780..a8d7c9f 100644 --- a/lib/commands/editor.js +++ b/lib/commands/editor.js @@ -1,499 +1,484 @@ "use babel"; export default [ -{ -name: ".Clear find", -category: "Editor", -command: "editor:clear-find", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Change note status none", -category: "Editor", -command: "editor:change-note-status-none", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Change note status active", -category: "Editor", -command: "editor:change-note-status-active", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Change note status onhold", -category: "Editor", -command: "editor:change-note-status-onhold", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Change note status completed", -category: "Editor", -command: "editor:change-note-status-completed", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Change note status dropped", -category: "Editor", -command: "editor:change-note-status-dropped", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete char after", -category: "Editor", -command: "editor:delete-char-after", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete char before", -category: "Editor", -command: "editor:delete-char-before", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete group after", -category: "Editor", -command: "editor:delete-group-after", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete group before", -category: "Editor", -command: "editor:delete-group-before", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete line", -category: "Editor", -command: "editor:delete-line", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete word after", -category: "Editor", -command: "editor:delete-word-after", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete word before", -category: "Editor", -command: "editor:delete-word-before", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete wrapped line left", -category: "Editor", -command: "editor:delete-wrapped-line-left", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Delete wrapped line right", -category: "Editor", -command: "editor:delete-wrapped-line-right", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Find", -category: "Editor", -command: "editor:find", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Find next", -category: "Editor", -command: "editor:find-next", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Find prev", -category: "Editor", -command: "editor:find-prev", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Find text", -category: "Editor", -command: "editor:find-text", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Focus", -category: "Editor", -command: "editor:focus", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Focus mde", -category: "Editor", -command: "editor:focus-mde", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Focus preview", -category: "Editor", -command: "editor:focus-preview", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go char left", -category: "Editor", -command: "editor:go-char-left", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go char right", -category: "Editor", -command: "editor:go-char-right", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go doc end", -category: "Editor", -command: "editor:go-doc-end", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go doc start", -category: "Editor", -command: "editor:go-doc-start", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go group left", -category: "Editor", -command: "editor:go-group-left", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go group right", -category: "Editor", -command: "editor:go-group-right", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line down", -category: "Editor", -command: "editor:go-line-down", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line end", -category: "Editor", -command: "editor:go-line-end", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line left", -category: "Editor", -command: "editor:go-line-left", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line right", -category: "Editor", -command: "editor:go-line-right", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line start", -category: "Editor", -command: "editor:go-line-start", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go line up", -category: "Editor", -command: "editor:go-line-up", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go page down", -category: "Editor", -command: "editor:go-page-down", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go page up", -category: "Editor", -command: "editor:go-page-up", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go word left", -category: "Editor", -command: "editor:go-word-left", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Go word right", -category: "Editor", -command: "editor:go-word-right", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Indent", -category: "Editor", -command: "editor:indent", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Indent less", -category: "Editor", -command: "editor:indent-less", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Indent more", -category: "Editor", -command: "editor:indent-more", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Insert images", -category: "Editor", -command: "editor:insert-images", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Jump to line", -category: "Editor", -command: "editor:jump-to-line", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Kill line", -category: "Editor", -command: "editor:kill-line", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".New line", -category: "Editor", -command: "editor:new-line", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Open line", -category: "Editor", -command: "editor:open-line", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Redo selection", -category: "Editor", -command: "editor:redo-selection", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Replace", -category: "Editor", -command: "editor:replace", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Replace selection", -category: "Editor", -command: "editor:replace-selection", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Save editor scroll", -category: "Editor", -command: "editor:save-editor-scroll", -selector: "It's a private command", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Save preview scroll", -category: "Editor", -command: "editor:save-preview-scroll", -selector: "It's a private command", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Scroll editor to line", -category: "Editor", -command: "editor:scroll-editor-to-line", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Scroll preview to line", -category: "Editor", -command: "editor:scroll-preview-to-line", -selector: "body", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Select all", -category: "Editor", -command: "editor:select-all", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Select lines downward", -category: "Editor", -command: "editor:select-lines-downward", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Select lines upward", -category: "Editor", -command: "editor:select-lines-upward", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Single selection", -category: "Editor", -command: "editor:single-selection", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Toggle overwrite", -category: "Editor", -command: "editor:toggle-overwrite", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Toggle task list", -category: "Editor", -command: "editor:toggle-task-list", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Transpose chars", -category: "Editor", -command: "editor:transpose-chars", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Undo selection", -category: "Editor", -command: "editor:undo-selection", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -{ -name: ".Unindent", -category: "Editor", -command: "editor:unindent", -selector: ".mde-cm-wrapper", -state: "inprogress", -shortcut: [""], -}, -]; \ No newline at end of file + { + name: ".Clear find", + category: "Editor", + command: "editor:clear-find", + selector: "body", + shortcut: [""], + }, + { + name: ".Change note status to none", + category: "Editor", + command: "editor:change-note-status-none", + selector: "body", + shortcut: ["alt", "shft", "1"], + }, + { + name: ".Change note status to active", + category: "Editor", + command: "editor:change-note-status-active", + selector: "body", + shortcut: ["alt", "shft", "2"], + }, + { + name: ".Change note status to onhold", + category: "Editor", + command: "editor:change-note-status-onhold", + selector: "body", + shortcut: ["alt", "shft", "3"], + }, + { + name: ".Change note status to completed", + category: "Editor", + command: "editor:change-note-status-completed", + selector: "body", + shortcut: ["alt", "shft", "4"], + }, + { + name: ".Change note status to dropped", + category: "Editor", + command: "editor:change-note-status-dropped", + selector: "body", + shortcut: ["alt", "shft", "5"], + }, + { + name: ".Delete char after", + category: "Editor", + command: "editor:delete-char-after", + selector: ".mde-cm-wrapper", + shortcut: ["delete"], + }, + { + name: ".Delete char before", + category: "Editor", + command: "editor:delete-char-before", + selector: ".mde-cm-wrapper", + shortcut: ["bkspc"], + }, + { + name: ".Delete group after", + category: "Editor", + command: "editor:delete-group-after", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "delete"], + }, + { + name: ".Delete group before", + category: "Editor", + command: "editor:delete-group-before", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "bkspc"], + }, + { + name: ".Delete line", + category: "Editor", + command: "editor:delete-line", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "d"], + }, + { + name: ".Delete word after", + category: "Editor", + command: "editor:delete-word-after", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".Delete word before", + category: "Editor", + command: "editor:delete-word-before", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".Delete wrapped line left", + category: "Editor", + command: "editor:delete-wrapped-line-left", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".Delete wrapped line right", + category: "Editor", + command: "editor:delete-wrapped-line-right", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".Find", + category: "Editor", + command: "editor:find", + selector: "body", + shortcut: ["ctrl", "f"], + }, + { + name: ".Find next", + category: "Editor", + command: "editor:find-next", + selector: "body", + shortcut: ["ctrl", "g"], + }, + { + name: ".Find prev", + category: "Editor", + command: "editor:find-prev", + selector: "body", + shortcut: ["ctrl", "shft", "g"], + }, + { + name: ".Find text", + category: "Editor", + command: "editor:find-text", + selector: "body", + shortcut: [""], + }, + { + name: ".Focus", + category: "Editor", + command: "editor:focus", + selector: "body", + state: "notworking", + shortcut: ["ctrl", "return"], + }, + { + name: ".Focus Markdown Editor", + category: "Editor", + command: "editor:focus-mde", + selector: "body", + state: "notworking", + shortcut: [""], + }, + { + name: ".Focus preview", + category: "Editor", + command: "editor:focus-preview", + selector: "body", + state: "notworking", + shortcut: [""], + }, + { + name: ".Go to left of character", + category: "Editor", + command: "editor:go-char-left", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["left"], + }, + { + name: ".Go to right of character", + category: "Editor", + command: "editor:go-char-right", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["right"], + }, + { + name: ".Go to document end", + category: "Editor", + command: "editor:go-doc-end", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "end"], + }, + { + name: ".Go to document start", + category: "Editor", + command: "editor:go-doc-start", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "home"], + }, + { + name: ".Go group left", + category: "Editor", + command: "editor:go-group-left", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["ctrl", "left"], + }, + { + name: ".Go group right", + category: "Editor", + command: "editor:go-group-right", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["ctrl", "right"], + }, + { + name: ".Go line down", + category: "Editor", + command: "editor:go-line-down", + selector: ".mde-cm-wrapper", + shortcut: ["down"], + }, + { + name: ".Go line end", + category: "Editor", + command: "editor:go-line-end", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["end"], + }, + { + name: ".Go line left", + category: "Editor", + command: "editor:go-line-left", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Go line right", + category: "Editor", + command: "editor:go-line-right", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Go line start", + category: "Editor", + command: "editor:go-line-start", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["home"], + }, + { + name: ".Go line up", + category: "Editor", + command: "editor:go-line-up", + selector: ".mde-cm-wrapper", + shortcut: ["up"], + }, + { + name: ".Go page down", + category: "Editor", + command: "editor:go-page-down", + selector: ".mde-cm-wrapper", + shortcut: ["page down"], + }, + { + name: ".Go page up", + category: "Editor", + command: "editor:go-page-up", + selector: ".mde-cm-wrapper", + shortcut: ["page up"], + }, + { + name: ".Go word left", + category: "Editor", + command: "editor:go-word-left", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Go word right", + category: "Editor", + command: "editor:go-word-right", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Indent", + category: "Editor", + command: "editor:indent", + selector: ".mde-cm-wrapper", + shortcut: ["tab"], + }, + { + name: ".Indent less", + category: "Editor", + command: "editor:indent-less", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "["], + }, + { + name: ".Indent more", + category: "Editor", + command: "editor:indent-more", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "]"], + }, + { + name: ".Insert images", + category: "Editor", + command: "editor:insert-images", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Jump to line", + category: "Editor", + command: "editor:jump-to-line", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["ctrl", "g"], + }, + { + name: ".Delete line", + category: "Editor", + command: "editor:kill-line", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".New line", + category: "Editor", + command: "editor:new-line", + selector: ".mde-cm-wrapper", + shortcut: ["return"], + }, + { + name: ".Open line", + category: "Editor", + command: "editor:open-line", + selector: ".mde-cm-wrapper", + shortcut: [""], + }, + { + name: ".Open link", + category: "Editor", + command: "editor:open-link", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "alt", "o"], + }, + { + name: ".Redo selection", + category: "Editor", + command: "editor:redo-selection", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "shft", "u"], + }, + { + name: ".Replace", + category: "Editor", + command: "editor:replace", + selector: "body", + shortcut: ["ctrl", "alt", "f"], + }, + { + name: ".Replace selection", + category: "Editor", + command: "editor:replace-selection", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Save editor scroll", + category: "Editor", + command: "editor:save-editor-scroll", + selector: "core:unknown", + state: "disabled", + shortcut: [""], + }, + { + name: ".Save preview scroll", + category: "Editor", + command: "editor:save-preview-scroll", + selector: "core:unknown", + state: "disabled", + shortcut: [""], + }, + { + name: ".Scroll editor to line", + category: "Editor", + command: "editor:scroll-editor-to-line", + selector: "body", + state: "notworking", + shortcut: [""], + }, + { + name: ".Scroll preview to line", + category: "Editor", + command: "editor:scroll-preview-to-line", + selector: "body", + state: "notworking", + shortcut: [""], + }, + { + name: ".Select all", + category: "Editor", + command: "editor:select-all", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "a"], + }, + { + name: ".Select lines downward", + category: "Editor", + command: "editor:select-lines-downward", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "shift", "down"], + }, + { + name: ".Select lines upward", + category: "Editor", + command: "editor:select-lines-upward", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "shift", "up"], + }, + { + name: ".Single selection", + category: "Editor", + command: "editor:single-selection", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["esc"], + }, + { + name: ".Toggle overwrite", + category: "Editor", + command: "editor:toggle-overwrite", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: ["insert"], + }, + { + name: ".Toggle task list", + category: "Editor", + command: "editor:toggle-task-list", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Transpose chars", + category: "Editor", + command: "editor:transpose-chars", + selector: ".mde-cm-wrapper", + state: "notworking", + shortcut: [""], + }, + { + name: ".Undo selection", + category: "Editor", + command: "editor:undo-selection", + selector: ".mde-cm-wrapper", + shortcut: ["ctrl", "alt", "u"], + }, + { + name: ".Unindent", + category: "Editor", + command: "editor:unindent", + selector: ".mde-cm-wrapper", + shortcut: ["shft", "tab"], + }, + { + name: ".Move focus to next", + category: "Editor", + command: "editor:move-focus-to-next", + selector: ".editor-header-title-input input", + state: "buggy", + shortcut: ["return"], + }, + { + name: ".Focus title", + category: "Editor", + command: "editor:title:focus", + selector: ".note-list-bar", + state: "notworking", + shortcut: ["return"], + }, +]; diff --git a/lib/commands/exportimport.js b/lib/commands/exportimport.js index adebd81..6bd101e 100644 --- a/lib/commands/exportimport.js +++ b/lib/commands/exportimport.js @@ -5,7 +5,7 @@ export default [ category: "Export", command: "export-as-html:export", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -13,7 +13,6 @@ export default [ category: "Export", command: "export-as-markdown:all", selector: "body", - state: "inprogress", shortcut: [""], }, { @@ -21,7 +20,7 @@ export default [ category: "Export", command: "export-as-markdown:single", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -29,7 +28,6 @@ export default [ category: "Export", command: "export-print:export-as-pdf", selector: "body", - state: "inprogress", shortcut: [""], }, { @@ -37,15 +35,13 @@ export default [ category: "Export", command: "export-print:print", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "shft", "p"], }, { name: ">Import from file", category: "Import", command: "import-html:import-from-file", selector: "body", - state: "inprogress", shortcut: [""], }, ]; diff --git a/lib/commands/formatting.js b/lib/commands/formatting.js index 0f74987..228dc58 100644 --- a/lib/commands/formatting.js +++ b/lib/commands/formatting.js @@ -6,7 +6,7 @@ export default [ category: "Format", command: "core:emphasize", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "i"], }, { name: ".Indent", @@ -20,21 +20,21 @@ export default [ category: "Format", command: "core:insert-code-block", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "shft", "c"], }, { name: ".Insert horizontal rule", category: "Format", command: "core:insert-horizontal-rule", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "shft", "h"], }, { name: ".Insert link", category: "Format", command: "core:insert-link", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "k"], }, { name: ".Indent", @@ -55,56 +55,56 @@ export default [ category: "Format", command: "core:strikethrough", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "u"], }, { name: ".Embolden", category: "Format", command: "core:strong", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "b"], }, { name: ".Toggle blockquote", category: "Format", command: "core:toggle-blockquote", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "'"], }, { name: ".Toggle bulleted list", category: "Format", command: "core:toggle-bulleted-list", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "shft", "l"], }, { name: ".Toggle heading 1", category: "Format", command: "core:toggle-heading-1", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "1"], }, { name: ".Toggle heading 2", category: "Format", command: "core:toggle-heading-2", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "2"], }, { name: ".Toggle heading 3", category: "Format", command: "core:toggle-heading-3", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "3"], }, { - name: ".Toggle-heading-4", + name: ".Toggle heading 4", category: "Format", command: "core:toggle-heading-4", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "4"], }, { name: ".Make header bigger", @@ -125,14 +125,14 @@ export default [ category: "Format", command: "core:toggle-numbered-list", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "shft", "o"], }, { name: ".Toggle task list", category: "Format", command: "core:toggle-task-list", selector: ".mde-cm-wrapper", - shortcut: [""], + shortcut: ["ctrl", "shft", "t"], }, { name: ".Unindent", diff --git a/lib/commands/notetagsbar.js b/lib/commands/notetagsbar.js index 78a5dc2..c2561ec 100644 --- a/lib/commands/notetagsbar.js +++ b/lib/commands/notetagsbar.js @@ -2,43 +2,43 @@ export default [ { - name: "!Unselect items", + name: ">Unselect items", category: "Tags Bar", command: "core:note-tags-bar-item-list-unselect", selector: ".note-tags-bar-item-list", - state: "inprogress", + state: "notworking", shortcut: [""], }, { - name: "!Select previous item", + name: ">Select previous item", category: "Tags Bar", command: "core:note-tags-bar-item-list-select-prev", selector: ".note-tags-bar-item-list", - state: "inprogress", - shortcut: [""], + state: "notworking", + shortcut: ["left"], }, { - name: "!Select next item", + name: ">Select next item", category: "Tags Bar", command: "core:note-tags-bar-item-list-select-next", selector: ".note-tags-bar-item-list", - state: "inprogress", - shortcut: [""], + state: "notworking", + shortcut: ["right"], }, { - name: "!Remove selected item and select previous item", + name: ">Remove selected item and select previous item", category: "Tags Bar", command: "core:note-tags-bar-item-list-select-remove-item-before", selector: ".note-tags-bar-item-list", - state: "inprogress", - shortcut: [""], + state: "notworking", + shortcut: ["bkspc"], }, { - name: "!Remove selected item", + name: ">Remove selected item", category: "Tags Bar", command: "core:note-tags-bar-item-list-select-remove-item", selector: ".note-tags-bar-item-list", - state: "inprogress", + state: "notworking", shortcut: [""], }, ]; diff --git a/lib/commands/plugins.js b/lib/commands/plugins.js new file mode 100644 index 0000000..71ad546 --- /dev/null +++ b/lib/commands/plugins.js @@ -0,0 +1,23 @@ +"use babel"; +export default [ + /* + { + name: ".example" (prefix (optional))name + category: "example category, category + command: "example:command", action registered on inkdrop + selector: "body", selector on where it should be invoked + shortcut: ["ctrl", "k"], (optional but must be listed as empty e.g. [""]) shortcuts separated by keys + status: (optional) "untested", status of the command, can be untested (needs testing), notworking (buggy) or null (working) + args: [], (optional) arguments of command" * NOT YET IMPLEMENTED + }, + */ + + { + name: ">Toggle", + category: "Command Palette", + command: "commandpalette:toggle", // invoking commandpalette:toggle here would just open the command palette again + selector: "body", + state: "plugin", + shortcut: ["ctrl", "k"], + }, +]; diff --git a/lib/commands/view.js b/lib/commands/view.js index 59a6c65..8407a82 100644 --- a/lib/commands/view.js +++ b/lib/commands/view.js @@ -5,7 +5,7 @@ export default [ category: "View", command: "view:sort-by-date-created", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -13,7 +13,7 @@ export default [ category: "View", command: "view:sort-by-date-updated", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -21,7 +21,7 @@ export default [ category: "View", command: "view:sort-by-title", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -29,7 +29,7 @@ export default [ category: "View", command: "view:sort-in-ascending", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -37,7 +37,7 @@ export default [ category: "View", command: "view:sort-in-descending", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -45,31 +45,27 @@ export default [ category: "View", command: "view:toggle-distraction-free", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "shft", "d"], }, { name: ">Toggle preview", category: "View", command: "view:toggle-preview", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "e"], }, { name: ">Toggle side by side", category: "View", command: "view:toggle-side-by-side", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "p"], }, { name: ">Toggle sidebar", category: "View", command: "view:toggle-sidebar", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "/"], }, ]; diff --git a/lib/commands/window.js b/lib/commands/window.js index 3b7bfbe..f29a21e 100644 --- a/lib/commands/window.js +++ b/lib/commands/window.js @@ -5,31 +5,28 @@ export default [ category: "Window", command: "window:close", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "w"], }, { name: ">Decrease font size", category: "Window", command: "window:decrease-font-size", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "-"], }, { name: ">Increase font size", category: "Window", command: "window:increase-font-size", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "+"], }, { - name: ">Install shell commands", + name: ">Install shell commands (seriously, don't try running this)", category: "Window", command: "window:install-shell-commands", selector: "body", - state: "inprogress", + state: "notworking", shortcut: [""], }, { @@ -37,31 +34,27 @@ export default [ category: "Window", command: "window:new-inkdrop-window", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "alt", "n"], }, { name: ">Reload", category: "Window", command: "window:reload", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "alt", "r"], }, { name: ">Toggle dev tools", category: "Window", command: "window:toggle-dev-tools", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["ctrl", "alt", "i"], }, { name: ">Toggle full screen", category: "Window", command: "window:toggle-full-screen", selector: "body", - state: "inprogress", - shortcut: [""], + shortcut: ["F11"], }, ]; diff --git a/lib/components/command.js b/lib/components/command.js index ac07a10..367eda7 100644 --- a/lib/components/command.js +++ b/lib/components/command.js @@ -10,6 +10,8 @@ export default Option = (props) => { function execute() { modal.close(); setTimeout(() => { + if (state === "disabled" || state === "notworking") return; + if (category === "Application") { ipcRenderer.send("command", command, {}); } @@ -25,43 +27,84 @@ export default Option = (props) => { const status = { color: - state === "error" - ? "#b86a85" - : state === "inprogress" - ? "#b7b86a" + state === "notworking" + ? "var(--light-red)" + : state === "untested" + ? "var(light-yellow)" + : state === "buggy" + ? "var(light-red)" : state === "disabled" ? "var(--disabled-text-color)" + : state === "plugin" + ? "var(--light-grey)" : null, }; return ( -

- {category} - {category != "" ? ": " : ""} - {name.replace(/!/g, "").replace(/>/g, "").replace(/\./g, "")} -

+ +

+ {category} + {category != "" ? ": " : ""} + {name.replace(/!/g, "").replace(/>/g, "").replace(/\./g, "")} +

+

+ {state === undefined ? ( + + Invoke {command}. + + ) : null}{" "} + {state === "notworking" ? ( + + command palette can't invoke this command properly. + + ) : null}{" "} + {state === "buggy" ? ( + + buggy - {command} + {""} + + ) : null}{" "} + {state === "untested" ? ( + + untested - {command} + + ) : null}{" "} + {state === "disabled" ? ( + + + command palette can't invoke this command because it's private + or disabled. + + + ) : null}{" "} + {state === "plugin" ? ( + + + Requires {command.split(":")[0]}: {command}. + + + ) : null}{" "} +

+

{idx === 0 ? ( top result ) : null}{" "} - {state === "error" ? ( - - not working / buggy - - ) : null}{" "} - {state === "inprogress" ? ( - - untested / unimplemented - - ) : null}{" "} - {state === "disabled" ? ( - - private command - - ) : null}{" "} {shortcut.map((key, index) => { if (key == "") return null; else @@ -69,7 +112,6 @@ export default Option = (props) => { {key} {index !== shortcut.length - 1 ? " + " : ""} - {console.log(key)} ); })} diff --git a/lib/components/palette.js b/lib/components/palette.js index 68bec88..9539712 100644 --- a/lib/components/palette.js +++ b/lib/components/palette.js @@ -2,7 +2,7 @@ import React, { useEffect, useCallback, useRef, useLayoutEffect } from "react"; import Option from "./command.js"; -import { logger, useModal } from "inkdrop"; +import { useModal } from "inkdrop"; import useArrowKeyNavigation from "../navigation/hook.js"; // commands list @@ -14,6 +14,7 @@ import Editor from "../commands/editor.js"; import ExportImport from "../commands/exportimport.js"; import View from "../commands/view.js"; import Window from "../commands/window.js"; +import Plugins from "../commands/plugins.js"; const CommandPalette = (props) => { const Commands = [ @@ -21,10 +22,11 @@ const CommandPalette = (props) => { ...Editor, ...Application, ...Core, - ...NoteTags, + ...Plugins, ...ExportImport, ...View, ...Window, + ...NoteTags, ]; const modal = useModal(); @@ -41,7 +43,6 @@ const CommandPalette = (props) => { const sub = inkdrop.commands.add(document.body, { "commandpalette:toggle": toggle, }); - console.log("useeffect triggered"); return () => sub.dispose(); }, [toggle]); @@ -51,17 +52,18 @@ const CommandPalette = (props) => { const textbox = document.getElementById("cpInput"); textbox.focus(); }, 50); - console.log("use layout effect triggered"); }); const filter = (commands, query) => { if (!query) return commands; return commands.filter((command) => { - const commandText = command.name.toLowerCase(); + const normalText = command.name.toLowerCase(); const commandCat = command.category.toLowerCase(); - let textFilter = commandText.includes(query.toLowerCase()); + const commandAction = command.command.toLowerCase(); + let textFilter = normalText.includes(query.toLowerCase()); let categoryFilter = commandCat.includes(query.toLowerCase()); - return textFilter || categoryFilter; + let actionFilter = commandAction.includes(query.toLowerCase()); + return textFilter || categoryFilter || actionFilter; }); }; @@ -90,7 +92,7 @@ const CommandPalette = (props) => {

{
-

inkdrop command palette

+

+ {" "} + have bugs? suggestions? concerns? or just wanna support + the plugin? +

{ target="_blank" style={{ margin: "0px 5px" }} > - star on github + star me on github