support majority of commands

This commit is contained in:
fuwaa 2022-08-24 16:08:38 +08:00
parent 877c28112a
commit 98de90c90e
No known key found for this signature in database
GPG key ID: 7CE0BF0D3175E2DC
17 changed files with 873 additions and 713 deletions

View file

@ -23,7 +23,7 @@ export default [
name: ">Open preferences", name: ">Open preferences",
category: "Application", category: "Application",
command: "application:open-preferences", command: "application:open-preferences",
shortcut: [""], shortcut: ["ctrl", ","],
}, },
{ {
name: ">Open website", name: ">Open website",

View file

@ -2,138 +2,136 @@
export default [ export default [
{ {
name: "!Copy", name: ">Copy",
category: "Core", category: "Core",
command: "core:copy", command: "core:copy",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "c"],
}, },
{ {
name: "!Copy Image", name: ">Copy Image",
category: "Core", category: "Core",
command: "core:copy-image", command: "core:copy-image",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Copy Note Link", name: ">Copy Note Link",
category: "Core", category: "Core",
command: "core:copy-note-link", command: "core:copy-note-link",
selector: "body", selector: ".note-list-bar",
state: "inprogress", shortcut: ["ctrl", "c"],
shortcut: [""],
}, },
{ {
name: "!Cut", name: ">Cut",
category: "Core", category: "Core",
command: "core:cut", command: "core:cut",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "x"],
}, },
{ {
name: "!Delete Note", name: ">Delete Note",
category: "Core", category: "Core",
command: "core:delete-note", command: "core:delete-note",
selector: "body", selector: ".note-list-bar",
shortcut: [""], shortcut: ["ctrl", "bkspc"],
}, },
{ {
name: "!Delete Notebook", name: ">Delete Notebook",
category: "Core", category: "Core",
command: "core:delete-notebook", command: "core:delete-notebook",
state: "disabled", state: "disabled",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Delete Tag", name: ">Delete Tag",
category: "Core", category: "Core",
command: "core:delete-tag", command: "core:delete-tag",
state: "disabled", state: "disabled",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Duplicate Note", name: ">Duplicate Note",
category: "Core", category: "Core",
command: "core:duplicate-note", command: "core:duplicate-note",
selector: "body", selector: ".note-list-bar",
shortcut: [""], shortcut: ["ctrl", "d"],
}, },
{ {
name: "!Empty Trash", name: ">Empty Trash",
category: "Core", category: "Core",
command: "core:empty-trash", command: "core:empty-trash",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Filter notes", name: ">Filter notes",
category: "Core", category: "Core",
command: "core:filter-notes", command: "core:filter-notes",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Filter by tag", name: ">Filter by tag",
category: "Core", category: "Core",
command: "core:filter-by-tag", command: "core:filter-by-tag",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Find", name: ">Find",
category: "Core", category: "Core",
command: "core:find", command: "core:find",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "shft", "f"],
}, },
{ {
name: "!Clear search bar", name: ">Clear search bar",
category: "Core", category: "Core",
command: "core:find-clear", command: "core:find-clear",
selector: "body", selector: ".note-list-search-bar input",
state: "error", shortcut: ["esc"],
shortcut: [""],
}, },
{ {
name: "!Find (Global)", name: ">Find (Global)",
category: "Core", category: "Core",
command: "core:find-global", command: "core:find-global",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "alt", "shft", "f"],
}, },
{ {
name: "!Focus next", name: ">Focus next",
category: "Core", category: "Core",
command: "core:focus-next", command: "core:focus-next",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["tab"],
}, },
{ {
name: "!Focus note list bar", name: ">Focus note list bar",
category: "Core", category: "Core",
command: "core:focus-note-list-bar", command: "core:focus-note-list-bar",
selector: "body", selector: ".note-list-search-bar input",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "alt", "l"],
}, },
{ {
name: "!Focus previous", name: ">Focus previous",
category: "Core", category: "Core",
command: "core:focus-previous", command: "core:focus-previous",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Move notebook", name: ">Move notebook",
category: "Core", category: "Core",
command: "core:move-notebook", command: "core:move-notebook",
state: "disabled", state: "disabled",
@ -141,146 +139,146 @@ export default [
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Move to notebook", name: ">Move to notebook",
category: "Core", category: "Core",
command: "core:move-to-notebook", command: "core:move-to-notebook",
selector: "body", selector: ".note-list-bar",
shortcut: [""], shortcut: ["ctrl", "alt", "m"],
}, },
{ {
name: "!Navigate back", name: ">Navigate back",
category: "Core", category: "Core",
command: "core:navigate-back", command: "core:navigate-back",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["alt", "left"],
}, },
{ {
name: "!Navigate forward", name: ">Navigate forward",
category: "Core", category: "Core",
command: "core:navigate-forward", command: "core:navigate-forward",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["alt", "right"],
}, },
{ {
name: "!New Note", name: ">New Note",
category: "Core", category: "Core",
command: "core:new-note", command: "core:new-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["ctrl", "n"],
}, },
{ {
name: "!New Notebook", name: ">New Notebook",
category: "Core", category: "Core",
command: "core:new-notebook", command: "core:new-notebook",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show all notes", name: ">Show all notes",
category: "Core", category: "Core",
command: "core:note-list-show-all-notes", command: "core:note-list-show-all-notes",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show all notes in specified notebook", name: ">Show all notes in specified notebook",
category: "Core", category: "Core",
command: "core:note-list-show-notes-in-book", command: "core:note-list-show-notes-in-book",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show all notes by tag", name: ">Show all notes by tag",
category: "Core", category: "Core",
command: "core:notes-list-show-notes-with-tag", command: "core:notes-list-show-notes-with-tag",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show all notes with status", name: ">Show all notes with status",
category: "Core", category: "Core",
command: "core:note-list-show-notes-with-status", command: "core:note-list-show-notes-with-status",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show notes in book of editing note", name: ">Show notes in book of editing note",
category: "Core", category: "Core",
command: "core:note-list-show-notes-in-book-of-editing-note", command: "core:note-list-show-notes-in-book-of-editing-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Open first note", name: ">Open first note",
category: "Core", category: "Core",
command: "core:open-first-note", command: "core:open-first-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Open next note", name: ">Open next note",
category: "Core", category: "Core",
command: "core:open-next-note", command: "core:open-next-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["ctrl", "tab"],
}, },
{ {
name: "!Close note", name: ">Close note",
category: "Core", category: "Core",
command: "core:close-note", command: "core:close-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Open note", name: ">Open note",
category: "Core", category: "Core",
command: "core:open-note", command: "core:open-note",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Open note in separate window", name: ">Open note in separate window",
category: "Core", category: "Core",
command: "core:open-note-in-separate-window", command: "core:open-note-in-separate-window",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["shft", "return"],
}, },
{ {
name: "!Open previous note", name: ">Open previous note",
category: "Core", category: "Core",
command: "core:open-prev-note", command: "core:open-prev-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["ctrl", "shift", "tab"],
}, },
{ {
name: "!Open tag settings", name: ">Open tag settings",
category: "Core", category: "Core",
command: "core:open-tag-settings", command: "core:open-tag-settings",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Paste", name: ">Paste",
category: "Core", category: "Core",
command: "core:paste", command: "core:paste",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "v"],
}, },
{ {
name: "!Redo", name: ">Redo",
category: "Core", category: "Core",
command: "core:redo", command: "core:redo",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "y"],
}, },
{ {
name: "!Rename Notebook", name: ">Rename Notebook",
category: "Core", category: "Core",
command: "core:rename-notebook", command: "core:rename-notebook",
selector: "body", selector: "body",
@ -288,95 +286,115 @@ export default [
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Save Image", name: ">Save Image",
category: "Core", category: "Core",
command: "core:save-image", command: "core:save-image",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Save Note", name: ">Save Note",
category: "Core", category: "Core",
command: "core:save-note", command: "core:save-note",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["ctrl", "s"],
}, },
{ {
name: "!Select all", name: ">Select all",
category: "Core", category: "Core",
command: "core:select-all", command: "core:select-all",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "a"],
}, },
{ {
name: "!Search notes", name: ">Search notes",
category: "Core", category: "Core",
command: "core:search-notes", command: "core:search-notes",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Share note", name: ">Share note",
category: "Core", category: "Core",
command: "core:share-note", command: "core:share-note",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Show note revisions", name: ">Show note revisions",
category: "Core", category: "Core",
command: "core:show-note-revisions", command: "core:show-note-revisions",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Focus sidebar", name: ">Focus sidebar",
category: "Core", category: "Core",
command: "core:sidebar-focus", command: "core:sidebar-focus",
selector: "body", selector: "body",
state: "error", state: "notworking",
shortcut: [""], shortcut: ["shft", "tab"],
}, },
{ {
name: "!Select next item on sidebar", name: ">Select next item on sidebar",
category: "Core", category: "Core",
command: "core:sidebar-select-next-item", command: "core:sidebar-select-next-item",
selector: "body", selector: "body",
shortcut: [""], shortcut: ["up"],
}, },
{ {
name: "!Select previous item on sidebar", name: ">Select previous item on sidebar",
category: "Core", category: "Core",
command: "core:sidebar-select-prev-item", command: "core:sidebar-select-prev-item",
selector: "body", 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", category: "Core",
command: "core:undo", command: "core:undo",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "z"],
}, },
{ {
name: ">Toggle editor drawer", name: ">Toggle editor drawer",
category: "Core", category: "Core",
command: "core:toggle-editor-drawer", command: "core:toggle-editor-drawer",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: ["ctrl", "j"],
}, },
{ {
name: ">Show editor drawer", name: ">Show editor drawer",
category: "Core", category: "Core",
command: "core:show-editor-drawer", command: "core:show-editor-drawer",
selector: "body", selector: "body",
state: "inprogress",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -384,7 +402,109 @@ export default [
category: "Core", category: "Core",
command: "core:close-editor-drawer", command: "core:close-editor-drawer",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["esc"],
shortcut: [""], },
{
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"],
}, },
]; ];

View file

@ -1,499 +1,484 @@
"use babel"; "use babel";
export default [ export default [
{ {
name: ".Clear find", name: ".Clear find",
category: "Editor", category: "Editor",
command: "editor:clear-find", command: "editor:clear-find",
selector: "body", selector: "body",
state: "inprogress", shortcut: [""],
shortcut: [""], },
}, {
{ name: ".Change note status to none",
name: ".Change note status none", category: "Editor",
category: "Editor", command: "editor:change-note-status-none",
command: "editor:change-note-status-none", selector: "body",
selector: "body", shortcut: ["alt", "shft", "1"],
state: "inprogress", },
shortcut: [""], {
}, name: ".Change note status to active",
{ category: "Editor",
name: ".Change note status active", command: "editor:change-note-status-active",
category: "Editor", selector: "body",
command: "editor:change-note-status-active", shortcut: ["alt", "shft", "2"],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Change note status to onhold",
}, category: "Editor",
{ command: "editor:change-note-status-onhold",
name: ".Change note status onhold", selector: "body",
category: "Editor", shortcut: ["alt", "shft", "3"],
command: "editor:change-note-status-onhold", },
selector: "body", {
state: "inprogress", name: ".Change note status to completed",
shortcut: [""], category: "Editor",
}, command: "editor:change-note-status-completed",
{ selector: "body",
name: ".Change note status completed", shortcut: ["alt", "shft", "4"],
category: "Editor", },
command: "editor:change-note-status-completed", {
selector: "body", name: ".Change note status to dropped",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:change-note-status-dropped",
}, selector: "body",
{ shortcut: ["alt", "shft", "5"],
name: ".Change note status dropped", },
category: "Editor", {
command: "editor:change-note-status-dropped", name: ".Delete char after",
selector: "body", category: "Editor",
state: "inprogress", command: "editor:delete-char-after",
shortcut: [""], selector: ".mde-cm-wrapper",
}, shortcut: ["delete"],
{ },
name: ".Delete char after", {
category: "Editor", name: ".Delete char before",
command: "editor:delete-char-after", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:delete-char-before",
state: "inprogress", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["bkspc"],
}, },
{ {
name: ".Delete char before", name: ".Delete group after",
category: "Editor", category: "Editor",
command: "editor:delete-char-before", command: "editor:delete-group-after",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
state: "inprogress", shortcut: ["ctrl", "delete"],
shortcut: [""], },
}, {
{ name: ".Delete group before",
name: ".Delete group after", category: "Editor",
category: "Editor", command: "editor:delete-group-before",
command: "editor:delete-group-after", selector: ".mde-cm-wrapper",
selector: ".mde-cm-wrapper", shortcut: ["ctrl", "bkspc"],
state: "inprogress", },
shortcut: [""], {
}, name: ".Delete line",
{ category: "Editor",
name: ".Delete group before", command: "editor:delete-line",
category: "Editor", selector: ".mde-cm-wrapper",
command: "editor:delete-group-before", shortcut: ["ctrl", "d"],
selector: ".mde-cm-wrapper", },
state: "inprogress", {
shortcut: [""], name: ".Delete word after",
}, category: "Editor",
{ command: "editor:delete-word-after",
name: ".Delete line", selector: ".mde-cm-wrapper",
category: "Editor", shortcut: [""],
command: "editor:delete-line", },
selector: ".mde-cm-wrapper", {
state: "inprogress", name: ".Delete word before",
shortcut: [""], category: "Editor",
}, command: "editor:delete-word-before",
{ selector: ".mde-cm-wrapper",
name: ".Delete word after", shortcut: [""],
category: "Editor", },
command: "editor:delete-word-after", {
selector: ".mde-cm-wrapper", name: ".Delete wrapped line left",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:delete-wrapped-line-left",
}, selector: ".mde-cm-wrapper",
{ shortcut: [""],
name: ".Delete word before", },
category: "Editor", {
command: "editor:delete-word-before", name: ".Delete wrapped line right",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:delete-wrapped-line-right",
shortcut: [""], selector: ".mde-cm-wrapper",
}, shortcut: [""],
{ },
name: ".Delete wrapped line left", {
category: "Editor", name: ".Find",
command: "editor:delete-wrapped-line-left", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:find",
state: "inprogress", selector: "body",
shortcut: [""], shortcut: ["ctrl", "f"],
}, },
{ {
name: ".Delete wrapped line right", name: ".Find next",
category: "Editor", category: "Editor",
command: "editor:delete-wrapped-line-right", command: "editor:find-next",
selector: ".mde-cm-wrapper", selector: "body",
state: "inprogress", shortcut: ["ctrl", "g"],
shortcut: [""], },
}, {
{ name: ".Find prev",
name: ".Find", category: "Editor",
category: "Editor", command: "editor:find-prev",
command: "editor:find", selector: "body",
selector: "body", shortcut: ["ctrl", "shft", "g"],
state: "inprogress", },
shortcut: [""], {
}, name: ".Find text",
{ category: "Editor",
name: ".Find next", command: "editor:find-text",
category: "Editor", selector: "body",
command: "editor:find-next", shortcut: [""],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Focus",
}, category: "Editor",
{ command: "editor:focus",
name: ".Find prev", selector: "body",
category: "Editor", state: "notworking",
command: "editor:find-prev", shortcut: ["ctrl", "return"],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Focus Markdown Editor",
}, category: "Editor",
{ command: "editor:focus-mde",
name: ".Find text", selector: "body",
category: "Editor", state: "notworking",
command: "editor:find-text", shortcut: [""],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Focus preview",
}, category: "Editor",
{ command: "editor:focus-preview",
name: ".Focus", selector: "body",
category: "Editor", state: "notworking",
command: "editor:focus", shortcut: [""],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Go to left of character",
}, category: "Editor",
{ command: "editor:go-char-left",
name: ".Focus mde", selector: ".mde-cm-wrapper",
category: "Editor", state: "notworking",
command: "editor:focus-mde", shortcut: ["left"],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Go to right of character",
}, category: "Editor",
{ command: "editor:go-char-right",
name: ".Focus preview", selector: ".mde-cm-wrapper",
category: "Editor", state: "notworking",
command: "editor:focus-preview", shortcut: ["right"],
selector: "body", },
state: "inprogress", {
shortcut: [""], name: ".Go to document end",
}, category: "Editor",
{ command: "editor:go-doc-end",
name: ".Go char left", selector: ".mde-cm-wrapper",
category: "Editor", shortcut: ["ctrl", "end"],
command: "editor:go-char-left", },
selector: ".mde-cm-wrapper", {
state: "inprogress", name: ".Go to document start",
shortcut: [""], category: "Editor",
}, command: "editor:go-doc-start",
{ selector: ".mde-cm-wrapper",
name: ".Go char right", shortcut: ["ctrl", "home"],
category: "Editor", },
command: "editor:go-char-right", {
selector: ".mde-cm-wrapper", name: ".Go group left",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:go-group-left",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Go doc end", shortcut: ["ctrl", "left"],
category: "Editor", },
command: "editor:go-doc-end", {
selector: ".mde-cm-wrapper", name: ".Go group right",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:go-group-right",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Go doc start", shortcut: ["ctrl", "right"],
category: "Editor", },
command: "editor:go-doc-start", {
selector: ".mde-cm-wrapper", name: ".Go line down",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:go-line-down",
}, selector: ".mde-cm-wrapper",
{ shortcut: ["down"],
name: ".Go group left", },
category: "Editor", {
command: "editor:go-group-left", name: ".Go line end",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:go-line-end",
shortcut: [""], selector: ".mde-cm-wrapper",
}, state: "notworking",
{ shortcut: ["end"],
name: ".Go group right", },
category: "Editor", {
command: "editor:go-group-right", name: ".Go line left",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:go-line-left",
shortcut: [""], selector: ".mde-cm-wrapper",
}, state: "notworking",
{ shortcut: [""],
name: ".Go line down", },
category: "Editor", {
command: "editor:go-line-down", name: ".Go line right",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:go-line-right",
shortcut: [""], selector: ".mde-cm-wrapper",
}, state: "notworking",
{ shortcut: [""],
name: ".Go line end", },
category: "Editor", {
command: "editor:go-line-end", name: ".Go line start",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:go-line-start",
shortcut: [""], selector: ".mde-cm-wrapper",
}, state: "notworking",
{ shortcut: ["home"],
name: ".Go line left", },
category: "Editor", {
command: "editor:go-line-left", name: ".Go line up",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:go-line-up",
shortcut: [""], selector: ".mde-cm-wrapper",
}, shortcut: ["up"],
{ },
name: ".Go line right", {
category: "Editor", name: ".Go page down",
command: "editor:go-line-right", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:go-page-down",
state: "inprogress", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["page down"],
}, },
{ {
name: ".Go line start", name: ".Go page up",
category: "Editor", category: "Editor",
command: "editor:go-line-start", command: "editor:go-page-up",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
state: "inprogress", shortcut: ["page up"],
shortcut: [""], },
}, {
{ name: ".Go word left",
name: ".Go line up", category: "Editor",
category: "Editor", command: "editor:go-word-left",
command: "editor:go-line-up", selector: ".mde-cm-wrapper",
selector: ".mde-cm-wrapper", state: "notworking",
state: "inprogress", shortcut: [""],
shortcut: [""], },
}, {
{ name: ".Go word right",
name: ".Go page down", category: "Editor",
category: "Editor", command: "editor:go-word-right",
command: "editor:go-page-down", selector: ".mde-cm-wrapper",
selector: ".mde-cm-wrapper", state: "notworking",
state: "inprogress", shortcut: [""],
shortcut: [""], },
}, {
{ name: ".Indent",
name: ".Go page up", category: "Editor",
category: "Editor", command: "editor:indent",
command: "editor:go-page-up", selector: ".mde-cm-wrapper",
selector: ".mde-cm-wrapper", shortcut: ["tab"],
state: "inprogress", },
shortcut: [""], {
}, name: ".Indent less",
{ category: "Editor",
name: ".Go word left", command: "editor:indent-less",
category: "Editor", selector: ".mde-cm-wrapper",
command: "editor:go-word-left", shortcut: ["ctrl", "["],
selector: ".mde-cm-wrapper", },
state: "inprogress", {
shortcut: [""], name: ".Indent more",
}, category: "Editor",
{ command: "editor:indent-more",
name: ".Go word right", selector: ".mde-cm-wrapper",
category: "Editor", shortcut: ["ctrl", "]"],
command: "editor:go-word-right", },
selector: ".mde-cm-wrapper", {
state: "inprogress", name: ".Insert images",
shortcut: [""], category: "Editor",
}, command: "editor:insert-images",
{ selector: ".mde-cm-wrapper",
name: ".Indent", state: "notworking",
category: "Editor", shortcut: [""],
command: "editor:indent", },
selector: ".mde-cm-wrapper", {
state: "inprogress", name: ".Jump to line",
shortcut: [""], category: "Editor",
}, command: "editor:jump-to-line",
{ selector: ".mde-cm-wrapper",
name: ".Indent less", state: "notworking",
category: "Editor", shortcut: ["ctrl", "g"],
command: "editor:indent-less", },
selector: ".mde-cm-wrapper", {
state: "inprogress", name: ".Delete line",
shortcut: [""], category: "Editor",
}, command: "editor:kill-line",
{ selector: ".mde-cm-wrapper",
name: ".Indent more", shortcut: [""],
category: "Editor", },
command: "editor:indent-more", {
selector: ".mde-cm-wrapper", name: ".New line",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:new-line",
}, selector: ".mde-cm-wrapper",
{ shortcut: ["return"],
name: ".Insert images", },
category: "Editor", {
command: "editor:insert-images", name: ".Open line",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:open-line",
shortcut: [""], selector: ".mde-cm-wrapper",
}, shortcut: [""],
{ },
name: ".Jump to line", {
category: "Editor", name: ".Open link",
command: "editor:jump-to-line", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:open-link",
state: "inprogress", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "alt", "o"],
}, },
{ {
name: ".Kill line", name: ".Redo selection",
category: "Editor", category: "Editor",
command: "editor:kill-line", command: "editor:redo-selection",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
state: "inprogress", shortcut: ["ctrl", "shft", "u"],
shortcut: [""], },
}, {
{ name: ".Replace",
name: ".New line", category: "Editor",
category: "Editor", command: "editor:replace",
command: "editor:new-line", selector: "body",
selector: ".mde-cm-wrapper", shortcut: ["ctrl", "alt", "f"],
state: "inprogress", },
shortcut: [""], {
}, name: ".Replace selection",
{ category: "Editor",
name: ".Open line", command: "editor:replace-selection",
category: "Editor", selector: ".mde-cm-wrapper",
command: "editor:open-line", state: "notworking",
selector: ".mde-cm-wrapper", shortcut: [""],
state: "inprogress", },
shortcut: [""], {
}, name: ".Save editor scroll",
{ category: "Editor",
name: ".Redo selection", command: "editor:save-editor-scroll",
category: "Editor", selector: "core:unknown",
command: "editor:redo-selection", state: "disabled",
selector: ".mde-cm-wrapper", shortcut: [""],
state: "inprogress", },
shortcut: [""], {
}, name: ".Save preview scroll",
{ category: "Editor",
name: ".Replace", command: "editor:save-preview-scroll",
category: "Editor", selector: "core:unknown",
command: "editor:replace", state: "disabled",
selector: "body", shortcut: [""],
state: "inprogress", },
shortcut: [""], {
}, name: ".Scroll editor to line",
{ category: "Editor",
name: ".Replace selection", command: "editor:scroll-editor-to-line",
category: "Editor", selector: "body",
command: "editor:replace-selection", state: "notworking",
selector: ".mde-cm-wrapper", shortcut: [""],
state: "inprogress", },
shortcut: [""], {
}, name: ".Scroll preview to line",
{ category: "Editor",
name: ".Save editor scroll", command: "editor:scroll-preview-to-line",
category: "Editor", selector: "body",
command: "editor:save-editor-scroll", state: "notworking",
selector: "It's a private command", shortcut: [""],
state: "inprogress", },
shortcut: [""], {
}, name: ".Select all",
{ category: "Editor",
name: ".Save preview scroll", command: "editor:select-all",
category: "Editor", selector: ".mde-cm-wrapper",
command: "editor:save-preview-scroll", shortcut: ["ctrl", "a"],
selector: "It's a private command", },
state: "inprogress", {
shortcut: [""], name: ".Select lines downward",
}, category: "Editor",
{ command: "editor:select-lines-downward",
name: ".Scroll editor to line", selector: ".mde-cm-wrapper",
category: "Editor", shortcut: ["ctrl", "shift", "down"],
command: "editor:scroll-editor-to-line", },
selector: "body", {
state: "inprogress", name: ".Select lines upward",
shortcut: [""], category: "Editor",
}, command: "editor:select-lines-upward",
{ selector: ".mde-cm-wrapper",
name: ".Scroll preview to line", shortcut: ["ctrl", "shift", "up"],
category: "Editor", },
command: "editor:scroll-preview-to-line", {
selector: "body", name: ".Single selection",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:single-selection",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Select all", shortcut: ["esc"],
category: "Editor", },
command: "editor:select-all", {
selector: ".mde-cm-wrapper", name: ".Toggle overwrite",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:toggle-overwrite",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Select lines downward", shortcut: ["insert"],
category: "Editor", },
command: "editor:select-lines-downward", {
selector: ".mde-cm-wrapper", name: ".Toggle task list",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:toggle-task-list",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Select lines upward", shortcut: [""],
category: "Editor", },
command: "editor:select-lines-upward", {
selector: ".mde-cm-wrapper", name: ".Transpose chars",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:transpose-chars",
}, selector: ".mde-cm-wrapper",
{ state: "notworking",
name: ".Single selection", shortcut: [""],
category: "Editor", },
command: "editor:single-selection", {
selector: ".mde-cm-wrapper", name: ".Undo selection",
state: "inprogress", category: "Editor",
shortcut: [""], command: "editor:undo-selection",
}, selector: ".mde-cm-wrapper",
{ shortcut: ["ctrl", "alt", "u"],
name: ".Toggle overwrite", },
category: "Editor", {
command: "editor:toggle-overwrite", name: ".Unindent",
selector: ".mde-cm-wrapper", category: "Editor",
state: "inprogress", command: "editor:unindent",
shortcut: [""], selector: ".mde-cm-wrapper",
}, shortcut: ["shft", "tab"],
{ },
name: ".Toggle task list", {
category: "Editor", name: ".Move focus to next",
command: "editor:toggle-task-list", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:move-focus-to-next",
state: "inprogress", selector: ".editor-header-title-input input",
shortcut: [""], state: "buggy",
}, shortcut: ["return"],
{ },
name: ".Transpose chars", {
category: "Editor", name: ".Focus title",
command: "editor:transpose-chars", category: "Editor",
selector: ".mde-cm-wrapper", command: "editor:title:focus",
state: "inprogress", selector: ".note-list-bar",
shortcut: [""], state: "notworking",
}, shortcut: ["return"],
{ },
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: [""],
},
]; ];

View file

@ -5,7 +5,7 @@ export default [
category: "Export", category: "Export",
command: "export-as-html:export", command: "export-as-html:export",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -13,7 +13,6 @@ export default [
category: "Export", category: "Export",
command: "export-as-markdown:all", command: "export-as-markdown:all",
selector: "body", selector: "body",
state: "inprogress",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -21,7 +20,7 @@ export default [
category: "Export", category: "Export",
command: "export-as-markdown:single", command: "export-as-markdown:single",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -29,7 +28,6 @@ export default [
category: "Export", category: "Export",
command: "export-print:export-as-pdf", command: "export-print:export-as-pdf",
selector: "body", selector: "body",
state: "inprogress",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -37,15 +35,13 @@ export default [
category: "Export", category: "Export",
command: "export-print:print", command: "export-print:print",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "shft", "p"],
shortcut: [""],
}, },
{ {
name: ">Import from file", name: ">Import from file",
category: "Import", category: "Import",
command: "import-html:import-from-file", command: "import-html:import-from-file",
selector: "body", selector: "body",
state: "inprogress",
shortcut: [""], shortcut: [""],
}, },
]; ];

View file

@ -6,7 +6,7 @@ export default [
category: "Format", category: "Format",
command: "core:emphasize", command: "core:emphasize",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "i"],
}, },
{ {
name: ".Indent", name: ".Indent",
@ -20,21 +20,21 @@ export default [
category: "Format", category: "Format",
command: "core:insert-code-block", command: "core:insert-code-block",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "shft", "c"],
}, },
{ {
name: ".Insert horizontal rule", name: ".Insert horizontal rule",
category: "Format", category: "Format",
command: "core:insert-horizontal-rule", command: "core:insert-horizontal-rule",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "shft", "h"],
}, },
{ {
name: ".Insert link", name: ".Insert link",
category: "Format", category: "Format",
command: "core:insert-link", command: "core:insert-link",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "k"],
}, },
{ {
name: ".Indent", name: ".Indent",
@ -55,56 +55,56 @@ export default [
category: "Format", category: "Format",
command: "core:strikethrough", command: "core:strikethrough",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "u"],
}, },
{ {
name: ".Embolden", name: ".Embolden",
category: "Format", category: "Format",
command: "core:strong", command: "core:strong",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "b"],
}, },
{ {
name: ".Toggle blockquote", name: ".Toggle blockquote",
category: "Format", category: "Format",
command: "core:toggle-blockquote", command: "core:toggle-blockquote",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "'"],
}, },
{ {
name: ".Toggle bulleted list", name: ".Toggle bulleted list",
category: "Format", category: "Format",
command: "core:toggle-bulleted-list", command: "core:toggle-bulleted-list",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "shft", "l"],
}, },
{ {
name: ".Toggle heading 1", name: ".Toggle heading 1",
category: "Format", category: "Format",
command: "core:toggle-heading-1", command: "core:toggle-heading-1",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "1"],
}, },
{ {
name: ".Toggle heading 2", name: ".Toggle heading 2",
category: "Format", category: "Format",
command: "core:toggle-heading-2", command: "core:toggle-heading-2",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "2"],
}, },
{ {
name: ".Toggle heading 3", name: ".Toggle heading 3",
category: "Format", category: "Format",
command: "core:toggle-heading-3", command: "core:toggle-heading-3",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "3"],
}, },
{ {
name: ".Toggle-heading-4", name: ".Toggle heading 4",
category: "Format", category: "Format",
command: "core:toggle-heading-4", command: "core:toggle-heading-4",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "4"],
}, },
{ {
name: ".Make header bigger", name: ".Make header bigger",
@ -125,14 +125,14 @@ export default [
category: "Format", category: "Format",
command: "core:toggle-numbered-list", command: "core:toggle-numbered-list",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "shft", "o"],
}, },
{ {
name: ".Toggle task list", name: ".Toggle task list",
category: "Format", category: "Format",
command: "core:toggle-task-list", command: "core:toggle-task-list",
selector: ".mde-cm-wrapper", selector: ".mde-cm-wrapper",
shortcut: [""], shortcut: ["ctrl", "shft", "t"],
}, },
{ {
name: ".Unindent", name: ".Unindent",

View file

@ -2,43 +2,43 @@
export default [ export default [
{ {
name: "!Unselect items", name: ">Unselect items",
category: "Tags Bar", category: "Tags Bar",
command: "core:note-tags-bar-item-list-unselect", command: "core:note-tags-bar-item-list-unselect",
selector: ".note-tags-bar-item-list", selector: ".note-tags-bar-item-list",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
name: "!Select previous item", name: ">Select previous item",
category: "Tags Bar", category: "Tags Bar",
command: "core:note-tags-bar-item-list-select-prev", command: "core:note-tags-bar-item-list-select-prev",
selector: ".note-tags-bar-item-list", selector: ".note-tags-bar-item-list",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: ["left"],
}, },
{ {
name: "!Select next item", name: ">Select next item",
category: "Tags Bar", category: "Tags Bar",
command: "core:note-tags-bar-item-list-select-next", command: "core:note-tags-bar-item-list-select-next",
selector: ".note-tags-bar-item-list", selector: ".note-tags-bar-item-list",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: ["right"],
}, },
{ {
name: "!Remove selected item and select previous item", name: ">Remove selected item and select previous item",
category: "Tags Bar", category: "Tags Bar",
command: "core:note-tags-bar-item-list-select-remove-item-before", command: "core:note-tags-bar-item-list-select-remove-item-before",
selector: ".note-tags-bar-item-list", selector: ".note-tags-bar-item-list",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: ["bkspc"],
}, },
{ {
name: "!Remove selected item", name: ">Remove selected item",
category: "Tags Bar", category: "Tags Bar",
command: "core:note-tags-bar-item-list-select-remove-item", command: "core:note-tags-bar-item-list-select-remove-item",
selector: ".note-tags-bar-item-list", selector: ".note-tags-bar-item-list",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
]; ];

23
lib/commands/plugins.js Normal file
View file

@ -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"],
},
];

View file

@ -5,7 +5,7 @@ export default [
category: "View", category: "View",
command: "view:sort-by-date-created", command: "view:sort-by-date-created",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -13,7 +13,7 @@ export default [
category: "View", category: "View",
command: "view:sort-by-date-updated", command: "view:sort-by-date-updated",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -21,7 +21,7 @@ export default [
category: "View", category: "View",
command: "view:sort-by-title", command: "view:sort-by-title",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -29,7 +29,7 @@ export default [
category: "View", category: "View",
command: "view:sort-in-ascending", command: "view:sort-in-ascending",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -37,7 +37,7 @@ export default [
category: "View", category: "View",
command: "view:sort-in-descending", command: "view:sort-in-descending",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -45,31 +45,27 @@ export default [
category: "View", category: "View",
command: "view:toggle-distraction-free", command: "view:toggle-distraction-free",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "shft", "d"],
shortcut: [""],
}, },
{ {
name: ">Toggle preview", name: ">Toggle preview",
category: "View", category: "View",
command: "view:toggle-preview", command: "view:toggle-preview",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "e"],
shortcut: [""],
}, },
{ {
name: ">Toggle side by side", name: ">Toggle side by side",
category: "View", category: "View",
command: "view:toggle-side-by-side", command: "view:toggle-side-by-side",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "p"],
shortcut: [""],
}, },
{ {
name: ">Toggle sidebar", name: ">Toggle sidebar",
category: "View", category: "View",
command: "view:toggle-sidebar", command: "view:toggle-sidebar",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "/"],
shortcut: [""],
}, },
]; ];

View file

@ -5,31 +5,28 @@ export default [
category: "Window", category: "Window",
command: "window:close", command: "window:close",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "w"],
shortcut: [""],
}, },
{ {
name: ">Decrease font size", name: ">Decrease font size",
category: "Window", category: "Window",
command: "window:decrease-font-size", command: "window:decrease-font-size",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "-"],
shortcut: [""],
}, },
{ {
name: ">Increase font size", name: ">Increase font size",
category: "Window", category: "Window",
command: "window:increase-font-size", command: "window:increase-font-size",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "+"],
shortcut: [""],
}, },
{ {
name: ">Install shell commands", name: ">Install shell commands (seriously, don't try running this)",
category: "Window", category: "Window",
command: "window:install-shell-commands", command: "window:install-shell-commands",
selector: "body", selector: "body",
state: "inprogress", state: "notworking",
shortcut: [""], shortcut: [""],
}, },
{ {
@ -37,31 +34,27 @@ export default [
category: "Window", category: "Window",
command: "window:new-inkdrop-window", command: "window:new-inkdrop-window",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "alt", "n"],
shortcut: [""],
}, },
{ {
name: ">Reload", name: ">Reload",
category: "Window", category: "Window",
command: "window:reload", command: "window:reload",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "alt", "r"],
shortcut: [""],
}, },
{ {
name: ">Toggle dev tools", name: ">Toggle dev tools",
category: "Window", category: "Window",
command: "window:toggle-dev-tools", command: "window:toggle-dev-tools",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["ctrl", "alt", "i"],
shortcut: [""],
}, },
{ {
name: ">Toggle full screen", name: ">Toggle full screen",
category: "Window", category: "Window",
command: "window:toggle-full-screen", command: "window:toggle-full-screen",
selector: "body", selector: "body",
state: "inprogress", shortcut: ["F11"],
shortcut: [""],
}, },
]; ];

View file

@ -10,6 +10,8 @@ export default Option = (props) => {
function execute() { function execute() {
modal.close(); modal.close();
setTimeout(() => { setTimeout(() => {
if (state === "disabled" || state === "notworking") return;
if (category === "Application") { if (category === "Application") {
ipcRenderer.send("command", command, {}); ipcRenderer.send("command", command, {});
} }
@ -25,43 +27,84 @@ export default Option = (props) => {
const status = { const status = {
color: color:
state === "error" state === "notworking"
? "#b86a85" ? "var(--light-red)"
: state === "inprogress" : state === "untested"
? "#b7b86a" ? "var(light-yellow)"
: state === "buggy"
? "var(light-red)"
: state === "disabled" : state === "disabled"
? "var(--disabled-text-color)" ? "var(--disabled-text-color)"
: state === "plugin"
? "var(--light-grey)"
: null, : null,
}; };
return ( return (
<a className="option flex-row" onClick={execute} href="#"> <a className="option flex-row" onClick={execute} href="#">
<p className="nomargin" style={status}> <span>
{category} <p className="nomargin" style={status}>
{category != "" ? ": " : ""} {category}
{name.replace(/!/g, "").replace(/>/g, "").replace(/\./g, "")} {category != "" ? ": " : ""}
</p> {name.replace(/!/g, "").replace(/>/g, "").replace(/\./g, "")}
</p>
<p className="nomargin topresult">
{state === undefined ? (
<span className="nomargin topresult" style={status}>
<em>Invoke {command}.</em>
</span>
) : null}{" "}
{state === "notworking" ? (
<span
className="nomargin topresult"
style={{ color: "var(--disabled-text-color)" }}
>
<em>command palette can't invoke this command properly.</em>
</span>
) : null}{" "}
{state === "buggy" ? (
<span className="nomargin topresult" style={status}>
<em>buggy - {command}</em>
{""}
</span>
) : null}{" "}
{state === "untested" ? (
<span
className="nomargin topresult"
style={{ color: "var(--disabled-text-color)" }}
>
<em>untested - {command}</em>
</span>
) : null}{" "}
{state === "disabled" ? (
<span
className="nomargin topresult"
style={{ color: "var(--disabled-text-color)" }}
>
<em>
command palette can't invoke this command because it's private
or disabled.
</em>
</span>
) : null}{" "}
{state === "plugin" ? (
<span
className="nomargin topresult"
style={{ color: "var(--disabled-text-color)" }}
>
<em>
Requires {command.split(":")[0]}: {command}.
</em>
</span>
) : null}{" "}
</p>
</span>
<p className="nomargin"> <p className="nomargin">
{idx === 0 ? ( {idx === 0 ? (
<span className="nomargin topresult"> <span className="nomargin topresult">
<em>top result</em> <em>top result</em>
</span> </span>
) : null}{" "} ) : null}{" "}
{state === "error" ? (
<span className="nomargin topresult">
<em>not working / buggy</em>
</span>
) : null}{" "}
{state === "inprogress" ? (
<span className="nomargin topresult">
<em>untested / unimplemented</em>
</span>
) : null}{" "}
{state === "disabled" ? (
<span className="nomargin topresult">
<em>private command </em>
</span>
) : null}{" "}
{shortcut.map((key, index) => { {shortcut.map((key, index) => {
if (key == "") return null; if (key == "") return null;
else else
@ -69,7 +112,6 @@ export default Option = (props) => {
<span className="shortcut"> <span className="shortcut">
<kbd key={index}>{key}</kbd> <kbd key={index}>{key}</kbd>
{index !== shortcut.length - 1 ? " + " : ""} {index !== shortcut.length - 1 ? " + " : ""}
{console.log(key)}
</span> </span>
); );
})} })}

View file

@ -2,7 +2,7 @@
import React, { useEffect, useCallback, useRef, useLayoutEffect } from "react"; import React, { useEffect, useCallback, useRef, useLayoutEffect } from "react";
import Option from "./command.js"; import Option from "./command.js";
import { logger, useModal } from "inkdrop"; import { useModal } from "inkdrop";
import useArrowKeyNavigation from "../navigation/hook.js"; import useArrowKeyNavigation from "../navigation/hook.js";
// commands list // commands list
@ -14,6 +14,7 @@ import Editor from "../commands/editor.js";
import ExportImport from "../commands/exportimport.js"; import ExportImport from "../commands/exportimport.js";
import View from "../commands/view.js"; import View from "../commands/view.js";
import Window from "../commands/window.js"; import Window from "../commands/window.js";
import Plugins from "../commands/plugins.js";
const CommandPalette = (props) => { const CommandPalette = (props) => {
const Commands = [ const Commands = [
@ -21,10 +22,11 @@ const CommandPalette = (props) => {
...Editor, ...Editor,
...Application, ...Application,
...Core, ...Core,
...NoteTags, ...Plugins,
...ExportImport, ...ExportImport,
...View, ...View,
...Window, ...Window,
...NoteTags,
]; ];
const modal = useModal(); const modal = useModal();
@ -41,7 +43,6 @@ const CommandPalette = (props) => {
const sub = inkdrop.commands.add(document.body, { const sub = inkdrop.commands.add(document.body, {
"commandpalette:toggle": toggle, "commandpalette:toggle": toggle,
}); });
console.log("useeffect triggered");
return () => sub.dispose(); return () => sub.dispose();
}, [toggle]); }, [toggle]);
@ -51,17 +52,18 @@ const CommandPalette = (props) => {
const textbox = document.getElementById("cpInput"); const textbox = document.getElementById("cpInput");
textbox.focus(); textbox.focus();
}, 50); }, 50);
console.log("use layout effect triggered");
}); });
const filter = (commands, query) => { const filter = (commands, query) => {
if (!query) return commands; if (!query) return commands;
return commands.filter((command) => { return commands.filter((command) => {
const commandText = command.name.toLowerCase(); const normalText = command.name.toLowerCase();
const commandCat = command.category.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()); 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) => {
<div className="ui small input"> <div className="ui small input">
<input <input
type="text" type="text"
placeholder="Search files by name (append > for actions or ! for formatting)" placeholder="What do you want to do? Tip: . for formatting and > for commands"
spellCheck="false" spellCheck="false"
className="cpInput" className="cpInput"
id="cpInput" id="cpInput"
@ -110,7 +112,11 @@ const CommandPalette = (props) => {
</div> </div>
<div className="nomatchfooter"> <div className="nomatchfooter">
<p className="nomatchtext"> inkdrop command palette</p> <p className="nomatchtext">
{" "}
have bugs? suggestions? concerns? or just wanna support
the plugin?
</p>
<div <div
style={{ style={{
display: "flex", display: "flex",
@ -126,7 +132,7 @@ const CommandPalette = (props) => {
target="_blank" target="_blank"
style={{ margin: "0px 5px" }} style={{ margin: "0px 5px" }}
> >
star on github star me on github
</a> </a>
<a <a
rel="noreferrer noopener" rel="noreferrer noopener"

View file

@ -26,7 +26,6 @@ function handleArrowKey({ event, currentIndex, availableElements }) {
nextElement = availableElements[currentIndex - 1]; nextElement = availableElements[currentIndex - 1];
} }
console.log(nextElement);
nextElement && nextElement.focus(); nextElement && nextElement.focus();
event.preventDefault(); event.preventDefault();
} }

View file

@ -7,7 +7,7 @@
"label": "Command Palette", "label": "Command Palette",
"submenu": [ "submenu": [
{ {
"label": "Show/Hide Command Palette", "label": "Show Command Palette",
"command": "commandpalette:toggle" "command": "commandpalette:toggle"
} }
] ]

View file

@ -1,8 +1,8 @@
{ {
"name": "command-palette", "name": "command-palette",
"main": "./lib/commandpalette", "main": "./lib/commandpalette",
"version": "0.0.1", "version": "1.0.0",
"description": "A command palette for inkdrop", "description": "A VSCode-like command palette for inkdrop",
"keywords": [], "keywords": [],
"repository": "https://github.com/fuwaa/inkdrop-command-palette", "repository": "https://github.com/fuwaa/inkdrop-command-palette",
"license": "MIT", "license": "MIT",

View file

@ -3,7 +3,7 @@
} }
.commandpalettewrapper { .commandpalettewrapper {
height: 255px; height: 265px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
@ -30,7 +30,7 @@
.option { .option {
padding: 4px 13px; padding: 4px 13px;
width: 600px; width: 600px;
height: 25px; height: 50px;
color: var(--text-color); color: var(--text-color);
margin-top: 5px; margin-top: 5px;
cursor: pointer; cursor: pointer;
@ -41,7 +41,7 @@
.option:focus { .option:focus {
padding: 4px 13px; padding: 4px 13px;
width: 600px; width: 600px;
height: 25px; height: 50px;
background-color: var(--highlight-background); background-color: var(--highlight-background);
color: var(--selected-text-color); color: var(--selected-text-color);
margin-top: 5px; margin-top: 5px;

View file

@ -26,7 +26,7 @@ with open("window.js", "a") as f:
f.write("category: \"Window\",\n") f.write("category: \"Window\",\n")
f.write("command: \"window:%s\",\n" % (currenteditor.strip())) f.write("command: \"window:%s\",\n" % (currenteditor.strip()))
f.write("selector: \"%s\",\n" % (currentselector.strip())) f.write("selector: \"%s\",\n" % (currentselector.strip()))
f.write("state: \"inprogress\",\n") f.write("state: \"untested\",\n")
f.write("shortcut: [\"\"],\n") f.write("shortcut: [\"\"],\n")
f.write("},\n") f.write("},\n")
# insert values into the string # insert values into the string