Vanessa 2022-09-13 10:19:13 +08:00
parent 73e0a968e2
commit 4fdcb11309
9 changed files with 126 additions and 96 deletions

View file

@ -52,7 +52,8 @@
color: var(--b3-protyle-inline-s-color); color: var(--b3-protyle-inline-s-color);
} }
strong { strong,
span[data-type~="strong"] {
color: var(--b3-protyle-inline-strong-color); color: var(--b3-protyle-inline-strong-color);
} }

View file

@ -169,6 +169,10 @@
} }
} }
span[data-type~="strong"] {
font-weight: bold;
}
span[data-type="tag"] { span[data-type="tag"] {
border-bottom: 1px solid var(--b3-protyle-inline-tag-color); border-bottom: 1px solid var(--b3-protyle-inline-tag-color);
color: var(--b3-protyle-inline-tag-color); color: var(--b3-protyle-inline-tag-color);

View file

@ -397,7 +397,7 @@ export abstract class Constants {
"lightfair", "magula", "mono-blue", "nnfx-light", "paraiso-light", "purebasic", "qtcreator-light", "routeros", "school-book", "lightfair", "magula", "mono-blue", "nnfx-light", "paraiso-light", "purebasic", "qtcreator-light", "routeros", "school-book",
"stackoverflow-light", "tokyo-night-light", "vs", "xcode", "default"]; "stackoverflow-light", "tokyo-night-light", "vs", "xcode", "default"];
public static readonly ZWSP: string = "\u200b"; public static readonly ZWSP: string = "\u200b";
public static readonly INLINE_TYPE: string[] = ["link", "bold", "italic", "underline", "strike", "mark", "sup", "sub", "tag", "inline-code", "inline-math"]; public static readonly INLINE_TYPE: string[] = ["block-ref", "kbd", "text", "file-annotation-ref", "a", "strong", "em", "u", "s", "mark", "sup", "sub", "tag", "code", "inline-math"];
public static readonly BLOCK_HINT_KEYS: string[] = ["((", "[[", "", "【【"]; public static readonly BLOCK_HINT_KEYS: string[] = ["((", "[[", "", "【【"];
public static readonly BLOCK_HINT_CLOSE_KEYS: IObject = {"((": "))", "[[": "]]", "": "", "【【": "】】"}; public static readonly BLOCK_HINT_CLOSE_KEYS: IObject = {"((": "))", "[[": "]]", "": "", "【【": "】】"};
public static readonly CODE_LANGUAGES: string[] = [ public static readonly CODE_LANGUAGES: string[] = [

View file

@ -110,23 +110,23 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconEmoji"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.emoji}</span><span class="b3-menu__accelerator">:</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconEmoji"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.emoji}</span><span class="b3-menu__accelerator">:</span></div>`,
}, { }, {
filter: ["链接", "lianjie", "lj", "link"], filter: ["链接", "lianjie", "lj", "link"],
value: "link", value: "a",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconLink"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.link}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.link.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconLink"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.link}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.link.custom))}</span></div>`,
}, { }, {
filter: ["粗体", "cuti", "ct", "bold"], filter: ["粗体", "cuti", "ct", "bold", "strong"],
value: "bold", value: "strong",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconBold"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.bold}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.bold.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconBold"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.bold}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.bold.custom))}</span></div>`,
}, { }, {
filter: ["斜体", "xieti", "xt", "italic"], filter: ["斜体", "xieti", "xt", "italic", "em"],
value: "italic", value: "em",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconItalic"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.italic}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.italic.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconItalic"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.italic}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.italic.custom))}</span></div>`,
}, { }, {
filter: ["下划线", "xiahuaxian", "xhx", "underline"], filter: ["下划线", "xiahuaxian", "xhx", "underline"],
value: "underline", value: "u",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconUnderline"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.underline}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.underline.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconUnderline"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.underline}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.underline.custom))}</span></div>`,
}, { }, {
filter: ["删除线", "shanchuxian", "scx", "strike"], filter: ["删除线", "shanchuxian", "scx", "strike"],
value: "strike", value: "s",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconStrike"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.strike}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.strike.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconStrike"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.strike}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.strike.custom))}</span></div>`,
}, { }, {
filter: ["标记", "biaoji", "bj", "mark"], filter: ["标记", "biaoji", "bj", "mark"],
@ -146,7 +146,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconTags"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.tag}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconTags"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.tag}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}</span></div>`,
}, { }, {
filter: ["行内代码", "hangneidaima", "hndm", "inline code"], filter: ["行内代码", "hangneidaima", "hndm", "inline code"],
value: "inline-code", value: "code",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconInlineCode"></use></svg><span class="b3-list-item__text">${window.siyuan.languages["inline-code"]}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-code"].custom))}</span></div>`, html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconInlineCode"></use></svg><span class="b3-list-item__text">${window.siyuan.languages["inline-code"]}</span><span class="b3-menu__accelerator">${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-code"].custom))}</span></div>`,
}, { }, {
filter: ["行内数学公式", "hangneishuxuegongshi", "hnsxgs", "inline math"], filter: ["行内数学公式", "hangneishuxuegongshi", "hnsxgs", "inline math"],

View file

@ -120,7 +120,7 @@ export const fontEvent = (protyle: IProtyle, type?: string, color?: string) => {
color = fontStyles[1]; color = fontStyles[1];
} }
} }
protyle.toolbar.setInlineMark(protyle, "bold", "add", true); protyle.toolbar.setInlineMark(protyle, "text", "add", true);
const range = protyle.toolbar.range; const range = protyle.toolbar.range;
const fontElement = hasClosestByMatchTag(range.startContainer, "STRONG"); const fontElement = hasClosestByMatchTag(range.startContainer, "STRONG");
if (!fontElement) { if (!fontElement) {

View file

@ -7,7 +7,7 @@ export class ToolbarItem {
constructor(protyle: IProtyle, menuItem: IMenuItem) { constructor(protyle: IProtyle, menuItem: IMenuItem) {
this.element = document.createElement("button"); this.element = document.createElement("button");
const hotkey = menuItem.hotkey ? ` ${updateHotkeyTip(menuItem.hotkey)}` : ""; const hotkey = menuItem.hotkey ? ` ${updateHotkeyTip(menuItem.hotkey)}` : "";
const tip = menuItem.tip || window.siyuan.languages[menuItem.name]; const tip = menuItem.tip || window.siyuan.languages[menuItem.lang];
this.element.classList.add("protyle-toolbar__item", "b3-tooltips", `b3-tooltips__${menuItem.tipPosition}`); this.element.classList.add("protyle-toolbar__item", "b3-tooltips", `b3-tooltips__${menuItem.tipPosition}`);
this.element.setAttribute("data-type", menuItem.name); this.element.setAttribute("data-type", menuItem.name);
this.element.setAttribute("aria-label", tip + hotkey); this.element.setAttribute("aria-label", tip + hotkey);

View file

@ -134,31 +134,31 @@ export class Toolbar {
} }
public getCurrentType(range = this.range) { public getCurrentType(range = this.range) {
const types: string[] = []; let types: string[] = [];
let startElement = range.startContainer as HTMLElement; let startElement = range.startContainer as HTMLElement;
if (startElement.nodeType === 3) { if (startElement.nodeType === 3) {
startElement = startElement.parentElement; startElement = startElement.parentElement;
if (startElement.getAttribute("data-type") === "virtual-block-ref" && !["DIV", "TD", "TH"].includes(startElement.parentElement.tagName)) {
startElement = startElement.parentElement;
}
} else if (startElement.childElementCount > 0 && startElement.childNodes[range.startOffset]?.nodeType !== 3) { } else if (startElement.childElementCount > 0 && startElement.childNodes[range.startOffset]?.nodeType !== 3) {
startElement = startElement.childNodes[range.startOffset] as HTMLElement; startElement = startElement.childNodes[range.startOffset] as HTMLElement;
} }
if (!startElement || startElement.nodeType === 3) { if (!startElement || startElement.nodeType === 3) {
return []; return [];
} }
if (!["DIV", "TD", "TH"].includes(startElement.tagName)) {
types = startElement.getAttribute("data-type").split(" ");
}
let endElement = range.endContainer as HTMLElement; let endElement = range.endContainer as HTMLElement;
if (endElement.nodeType === 3) { if (endElement.nodeType === 3) {
endElement = endElement.parentElement; endElement = endElement.parentElement;
if (endElement.getAttribute("data-type") === "virtual-block-ref" && !["DIV", "TD", "TH"].includes(endElement.parentElement.tagName)) {
endElement = endElement.parentElement;
}
} else if (endElement.childElementCount > 0 && endElement.childNodes[range.endOffset]?.nodeType !== 3) { } else if (endElement.childElementCount > 0 && endElement.childNodes[range.endOffset]?.nodeType !== 3) {
endElement = endElement.childNodes[range.endOffset] as HTMLElement; endElement = endElement.childNodes[range.endOffset] as HTMLElement;
} }
if (!endElement || endElement.nodeType === 3) { if (!endElement || endElement.nodeType === 3) {
return []; return [];
} }
if (!["DIV", "TD", "TH"].includes(endElement.tagName)) {
types = types.concat(endElement.getAttribute("data-type").split(" "));
}
if (range.startOffset === range.startContainer.textContent.length) { if (range.startOffset === range.startContainer.textContent.length) {
const nextSibling = hasNextSibling(range.startContainer as Element); const nextSibling = hasNextSibling(range.startContainer as Element);
if (nextSibling && nextSibling.nodeType !== 3 && (nextSibling as Element).getAttribute("data-type") === "inline-math") { if (nextSibling && nextSibling.nodeType !== 3 && (nextSibling as Element).getAttribute("data-type") === "inline-math") {
@ -170,77 +170,41 @@ export class Toolbar {
types.push("inline-math"); types.push("inline-math");
} }
} }
if (startElement.tagName === "STRONG" || endElement.tagName === "STRONG") { range.cloneContents().childNodes.forEach((item:HTMLElement) => {
types.push("bold"); if (item.nodeType !== 3) {
} types = types.concat(item.getAttribute("data--type").split(" "));
if (startElement.tagName === "EM" || endElement.tagName === "EM") {
types.push("italic");
}
if (startElement.tagName === "U" || endElement.tagName === "U") {
types.push("underline");
}
if (startElement.tagName === "S" || endElement.tagName === "S") {
types.push("strike");
}
if (startElement.tagName === "MARK" || endElement.tagName === "MARK") {
types.push("mark");
}
if (startElement.tagName === "SUP" || endElement.tagName === "SUP") {
types.push("sup");
}
if (startElement.tagName === "SUB" || endElement.tagName === "SUB") {
types.push("sub");
}
if (startElement.tagName === "KBD" || endElement.tagName === "KBD") {
types.push("kbd");
}
if (startElement.tagName === "SPAN" || endElement.tagName === "SPAN") {
const startType = startElement.getAttribute("data-type");
const endType = endElement.getAttribute("data-type");
if (startType === "tag" || endType === "tag") {
types.push("tag");
} else if (startType === "a" || endType === "a") {
types.push("link");
} else if (startType === "block-ref" || endType === "block-ref") {
types.push("blockRef");
} else if (startType === "file-annotation-ref" || endType === "file-annotation-ref") {
types.push("fileAnnotationRef");
} else if (startType === "inline-math") {
types.push("inline-math");
} }
} });
if (startElement.tagName === "CODE" || endElement.tagName === "CODE") { types = [...new Set(types)];
types.push("inline-code");
}
return types; return types;
} }
private genItem(protyle: IProtyle, menuItem: IMenuItem) { private genItem(protyle: IProtyle, menuItem: IMenuItem) {
let menuItemObj; let menuItemObj;
switch (menuItem.name) { switch (menuItem.name) {
case "bold": case "strong":
case "italic": case "em":
case "strike": case "s":
case "inline-code": case "code":
case "mark": case "mark":
case "tag": case "tag":
case "underline": case "u":
case "sup": case "sup":
case "sub": case "sub":
case "kbd": case "kbd":
case "inline-math": case "inline-math":
menuItemObj = new ToolbarItem(protyle, menuItem); menuItemObj = new ToolbarItem(protyle, menuItem);
break; break;
case "blockRef": case "block-ref":
menuItemObj = new BlockRef(protyle, menuItem); menuItemObj = new BlockRef(protyle, menuItem);
break; break;
case "|": case "|":
menuItemObj = new Divider(); menuItemObj = new Divider();
break; break;
case "font": case "text":
menuItemObj = new Font(protyle, menuItem); menuItemObj = new Font(protyle, menuItem);
break; break;
case "link": case "a":
menuItemObj = new Link(protyle, menuItem); menuItemObj = new Link(protyle, menuItem);
break; break;
} }
@ -267,7 +231,54 @@ export class Toolbar {
}); });
} }
public async setInlineMark(protyle: IProtyle, type: string, action: "remove" | "add" | "range" | "toolbar", focusAdd = false) { public setInlineMark(protyle: IProtyle, type: string, action: "remove" | "add" | "range" | "toolbar", focusAdd = false) {
const nodeElement = hasClosestBlock(this.range.startContainer);
if (!nodeElement) {
return;
}
const wbrElement = document.createElement("wbr");
const html = nodeElement.outerHTML;
if (this.range.startOffset === 0 && !hasPreviousSibling(this.range.startContainer)) {
this.range.setStartBefore(this.range.startContainer.parentElement)
}
if (this.range.endOffset === this.range.endContainer.textContent.length && !hasNextSibling(this.range.endContainer)) {
this.range.setEndAfter(this.range.endContainer.parentElement)
}
const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined;
const contents = this.range.extractContents();
this.range.insertNode(wbrElement);
const newNodes: Node[] = [];
contents.childNodes.forEach((item: HTMLElement) => {
if (item.nodeType === 3) {
if (item.textContent !== "") {
const inlineElement = document.createElement("span");
inlineElement.setAttribute("data-type", type);
inlineElement.appendChild(item);
newNodes.push(inlineElement);
}
} else {
const types = (item.getAttribute("data-type") || "").split(" ");
types.push(type);
item.setAttribute("data-type", types.join(" "));
newNodes.push(item);
}
});
newNodes.forEach((item, index) => {
this.range.insertNode(item);
if (index === 0) {
this.range.setStart(item.firstChild, 0);
}
if (index === newNodes.length - 1) {
this.range.setEnd(item.lastChild, item.lastChild.textContent.length);
}
});
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
wbrElement.remove();
}
public async setInlineMark1(protyle: IProtyle, type: string, action: "remove" | "add" | "range" | "toolbar", focusAdd = false) {
const nodeElement = hasClosestBlock(this.range.startContainer); const nodeElement = hasClosestBlock(this.range.startContainer);
if (!nodeElement) { if (!nodeElement) {
return; return;
@ -281,7 +292,7 @@ export class Toolbar {
return; return;
} }
// 对已有字体样式的文字再次添加字体样式 // 对已有字体样式的文字再次添加字体样式
if (focusAdd && action === "add" && types.includes("bold") && this.range.startContainer.nodeType === 3 && if (focusAdd && action === "add" && types.includes("text") && this.range.startContainer.nodeType === 3 &&
this.range.startContainer.parentNode.isSameNode(this.range.endContainer.parentNode)) { this.range.startContainer.parentNode.isSameNode(this.range.endContainer.parentNode)) {
return; return;
} }

View file

@ -78,28 +78,28 @@ export class Options {
mode: "both", mode: "both",
}, },
toolbar: isMobile() ? [ toolbar: isMobile() ? [
"blockRef", "block-ref",
"link", "a",
"|", "|",
"bold", "strong",
"italic", "em",
"underline", "u",
"strike", "s",
"mark", "mark",
"|", "|",
"tag", "tag",
"inline-code", "code",
"inline-math", "inline-math",
"|", "|",
"font", "text",
] : [ ] : [
"blockRef", "block-ref",
"link", "a",
"|", "|",
"bold", "strong",
"italic", "em",
"underline", "u",
"strike", "s",
"mark", "mark",
"|", "|",
"sup", "sup",
@ -107,10 +107,10 @@ export class Options {
"kbd", "kbd",
"|", "|",
"tag", "tag",
"inline-code", "code",
"inline-math", "inline-math",
"|", "|",
"font", "text",
], ],
typewriterMode: false, typewriterMode: false,
upload: { upload: {
@ -145,79 +145,92 @@ export class Options {
private mergeToolbar(toolbar: Array<string | IMenuItem>) { private mergeToolbar(toolbar: Array<string | IMenuItem>) {
const toolbarItem: IMenuItem [] = [{ const toolbarItem: IMenuItem [] = [{
name: "blockRef", name: "block-ref",
hotkey: window.siyuan.config.keymap.editor.insert.blockRef.custom, hotkey: window.siyuan.config.keymap.editor.insert.blockRef.custom,
lang: "blockRef",
icon: "iconGraph", icon: "iconGraph",
tipPosition: "ne", tipPosition: "ne",
}, { }, {
name: "link", name: "a",
hotkey: window.siyuan.config.keymap.editor.insert.link.custom, hotkey: window.siyuan.config.keymap.editor.insert.link.custom,
lang: "link",
icon: "iconLink", icon: "iconLink",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "bold", name: "strong",
lang: "bold",
hotkey: window.siyuan.config.keymap.editor.insert.bold.custom, hotkey: window.siyuan.config.keymap.editor.insert.bold.custom,
icon: "iconBold", icon: "iconBold",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "italic", name: "em",
lang: "italic",
hotkey: window.siyuan.config.keymap.editor.insert.italic.custom, hotkey: window.siyuan.config.keymap.editor.insert.italic.custom,
icon: "iconItalic", icon: "iconItalic",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "underline", name: "u",
lang: "underline",
hotkey: window.siyuan.config.keymap.editor.insert.underline.custom, hotkey: window.siyuan.config.keymap.editor.insert.underline.custom,
icon: "iconUnderline", icon: "iconUnderline",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "strike", name: "s",
lang: "strike",
hotkey: window.siyuan.config.keymap.editor.insert.strike.custom, hotkey: window.siyuan.config.keymap.editor.insert.strike.custom,
icon: "iconStrike", icon: "iconStrike",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "mark", name: "mark",
lang: "mark",
hotkey: window.siyuan.config.keymap.editor.insert.mark.custom, hotkey: window.siyuan.config.keymap.editor.insert.mark.custom,
icon: "iconMark", icon: "iconMark",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "sup", name: "sup",
lang: "sup",
hotkey: window.siyuan.config.keymap.editor.insert.sup.custom, hotkey: window.siyuan.config.keymap.editor.insert.sup.custom,
icon: "iconSup", icon: "iconSup",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "sub", name: "sub",
lang: "sub",
hotkey: window.siyuan.config.keymap.editor.insert.sub.custom, hotkey: window.siyuan.config.keymap.editor.insert.sub.custom,
icon: "iconSub", icon: "iconSub",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "kbd", name: "kbd",
lang: "kbd",
hotkey: window.siyuan.config.keymap.editor.insert.kbd.custom, hotkey: window.siyuan.config.keymap.editor.insert.kbd.custom,
icon: "iconKeymap", icon: "iconKeymap",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "tag", name: "tag",
lang: "tag",
hotkey: window.siyuan.config.keymap.editor.insert.tag.custom, hotkey: window.siyuan.config.keymap.editor.insert.tag.custom,
icon: "iconTags", icon: "iconTags",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "inline-code", name: "code",
lang: "inline-code",
hotkey: window.siyuan.config.keymap.editor.insert["inline-code"].custom, hotkey: window.siyuan.config.keymap.editor.insert["inline-code"].custom,
icon: "iconInlineCode", icon: "iconInlineCode",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "inline-math", name: "inline-math",
lang: "inline-math",
hotkey: window.siyuan.config.keymap.editor.insert["inline-math"].custom, hotkey: window.siyuan.config.keymap.editor.insert["inline-math"].custom,
icon: "iconMath", icon: "iconMath",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "font", name: "text",
lang: "font",
hotkey: window.siyuan.config.keymap.editor.insert.font.custom, hotkey: window.siyuan.config.keymap.editor.insert.font.custom,
icon: "iconFont", icon: "iconFont",
tipPosition: "n", tipPosition: "n",
}, { }, {
name: "|", name: "|",
} }];
];
const toolbarResult: IMenuItem[] = []; const toolbarResult: IMenuItem[] = [];
toolbar.forEach((menuItem: IMenuItem) => { toolbar.forEach((menuItem: IMenuItem) => {
let currentMenuItem = menuItem; let currentMenuItem = menuItem;

View file

@ -268,6 +268,7 @@ interface IUpload {
interface IMenuItem { interface IMenuItem {
/** 唯一标示 */ /** 唯一标示 */
name: string; name: string;
lang?: string;
/** svg 图标 */ /** svg 图标 */
icon?: string; icon?: string;
/** 提示 */ /** 提示 */