This commit is contained in:
parent
2d8152a137
commit
c2dc8fd83c
4 changed files with 14 additions and 6 deletions
|
@ -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: {
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -51,7 +51,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
|
|||
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
|
||||
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.database}</span></div>`,
|
||||
}, {
|
||||
filter: ["新建文档并引用", "xinjianwendangbingyinyong","xjwdbyy", "new doc"],
|
||||
filter: ["新建文档并引用", "xinjianwendangbingyinyong", "xjwdbyy", "new doc"],
|
||||
value: Constants.ZWSP + 4,
|
||||
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.newFileRef}</span></div>`,
|
||||
}, {
|
||||
|
@ -100,7 +100,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
|
|||
}, {
|
||||
filter: ["引述", "yinshu", "ys", "bq", "blockquote"],
|
||||
value: "> " + Lute.Caret,
|
||||
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconQuote"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.quote}</span><span class="b3-list-item__meta">></span></div>`,
|
||||
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconQuote"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.quote}</span>${window.siyuan.config.keymap.editor.insert.quote.custom ? `<span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.quote.custom))}</span>` : '<span class="b3-list-item__meta">></span>'}</div>`,
|
||||
}, {
|
||||
filter: ["代码块", "daimakuai", "dmk", "code block"],
|
||||
value: "```",
|
||||
|
|
|
@ -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"))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue