diff --git a/app/src/constants.ts b/app/src/constants.ts index 4d60547cc..3842033bd 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -432,6 +432,7 @@ export abstract class Constants { list: {default: "", custom: ""}, table: {default: "⌘O", custom: "⌘O"}, code: {default: "⇧⌘K", custom: "⇧⌘K"}, + quote: {default: "", custom: ""}, clearInline: {default: "⌘\\", custom: "⌘\\"}, }, heading: { diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index b84f71bc6..52c83cb9d 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -571,6 +571,7 @@ export class Gutter { turnIntoSubmenu.push(this.turnsIntoOne({ icon: "iconQuote", label: window.siyuan.languages.quote, + accelerator: window.siyuan.config.keymap.editor.insert.quote.custom, protyle, selectsElement, type: "Blocks2Blockquote" @@ -917,6 +918,7 @@ export class Gutter { })); turnIntoSubmenu.push(this.turnsIntoOne({ icon: "iconQuote", + accelerator: window.siyuan.config.keymap.editor.insert.quote.custom, label: window.siyuan.languages.quote, protyle, selectsElement: [nodeElement], diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 073b5e4a6..1a72b176c 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -51,7 +51,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => { value: '
', html: `
${window.siyuan.languages.database}
`, }, { - filter: ["新建文档并引用", "xinjianwendangbingyinyong","xjwdbyy", "new doc"], + filter: ["新建文档并引用", "xinjianwendangbingyinyong", "xjwdbyy", "new doc"], value: Constants.ZWSP + 4, html: `
${window.siyuan.languages.newFileRef}
`, }, { @@ -100,7 +100,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => { }, { filter: ["引述", "yinshu", "ys", "bq", "blockquote"], value: "> " + Lute.Caret, - html: `
${window.siyuan.languages.quote}>
`, + html: `
${window.siyuan.languages.quote}${window.siyuan.config.keymap.editor.insert.quote.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.quote.custom))}` : '>'}
`, }, { filter: ["代码块", "daimakuai", "dmk", "code block"], value: "```", diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 76180f63a..300db6126 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1383,12 +1383,17 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const isMatchList = matchHotKey(window.siyuan.config.keymap.editor.insert.list.custom, event); const isMatchCheck = matchHotKey(window.siyuan.config.keymap.editor.insert.check.custom, event); const isMatchOList = matchHotKey(window.siyuan.config.keymap.editor.insert["ordered-list"].custom, event); - if (isMatchList || isMatchOList || isMatchCheck) { + const isMatchQuote = matchHotKey(window.siyuan.config.keymap.editor.insert.quote.custom, event); + if (isMatchList || isMatchOList || isMatchCheck || isMatchQuote) { const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); if (selectsElement.length === 0) { protyle.hint.splitChar = "/"; protyle.hint.lastIndex = -1; - protyle.hint.fill((isMatchCheck ? "* [ ] " : (isMatchList ? "* " : "1. ")) + Lute.Caret, protyle); + if (isMatchQuote) { + protyle.hint.fill(">" + Lute.Caret, protyle); + } else { + protyle.hint.fill((isMatchCheck ? "* [ ] " : (isMatchList ? "* " : "1. ")) + Lute.Caret, protyle); + } } else if (selectsElement.length === 1) { const subType = selectsElement[0].dataset.subtype; const type = selectsElement[0].dataset.type; @@ -1396,7 +1401,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { turnsIntoOneTransaction({ protyle, selectsElement, - type: isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs") + type: isMatchQuote ? "Blocks2Blockquote" : (isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs")) }); } else if (type === "NodeList") { const id = selectsElement[0].dataset.nodeId; @@ -1443,7 +1448,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { turnsIntoOneTransaction({ protyle, selectsElement, - type: isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs") + type: isMatchQuote ? "Blocks2Blockquote" : (isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs")) }); } }