mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🚨
This commit is contained in:
parent
ddeeba87e7
commit
17f6ab335b
4 changed files with 8 additions and 8 deletions
|
|
@ -116,7 +116,7 @@ export class Menu {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof index === "number") {
|
if (typeof index === "number") {
|
||||||
const insertElement = this.element.querySelectorAll(".b3-menu__items > .b3-menu__separator")[index]
|
const insertElement = this.element.querySelectorAll(".b3-menu__items > .b3-menu__separator")[index];
|
||||||
if (insertElement) {
|
if (insertElement) {
|
||||||
insertElement.before(element);
|
insertElement.before(element);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -217,5 +217,5 @@ export class Plugin {
|
||||||
nodeIds: options.ids,
|
nodeIds: options.ids,
|
||||||
defIds: options.defIds,
|
defIds: options.defIds,
|
||||||
}));
|
}));
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ export class Font extends ToolbarItem {
|
||||||
this.element.addEventListener("click", () => {
|
this.element.addEventListener("click", () => {
|
||||||
let nodeElements: Element[];
|
let nodeElements: Element[];
|
||||||
if (protyle.toolbar.range.toString() === "") {
|
if (protyle.toolbar.range.toString() === "") {
|
||||||
nodeElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
|
nodeElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
if (nodeElements.length === 0) {
|
if (nodeElements.length === 0) {
|
||||||
const nodeElement = hasClosestBlock(protyle.toolbar.range.startContainer);
|
const nodeElement = hasClosestBlock(protyle.toolbar.range.startContainer);
|
||||||
if (nodeElement) {
|
if (nodeElement) {
|
||||||
nodeElements = [nodeElement]
|
nodeElements = [nodeElement];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ export const appearanceMenu = (protyle: IProtyle, nodeElements?: Element[]) => {
|
||||||
});
|
});
|
||||||
lastColorHTML += "</div>";
|
lastColorHTML += "</div>";
|
||||||
}
|
}
|
||||||
let textElement: HTMLElement
|
let textElement: HTMLElement;
|
||||||
let fontSize = "16px";
|
let fontSize = "16px";
|
||||||
if (nodeElements && nodeElements.length > 0) {
|
if (nodeElements && nodeElements.length > 0) {
|
||||||
textElement = nodeElements[0] as HTMLElement;
|
textElement = nodeElements[0] as HTMLElement;
|
||||||
|
|
@ -216,7 +216,7 @@ export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: str
|
||||||
e.style.backgroundColor = "";
|
e.style.backgroundColor = "";
|
||||||
e.style.fontSize = "";
|
e.style.fontSize = "";
|
||||||
} else if (type === "style1") {
|
} else if (type === "style1") {
|
||||||
const colorList = color.split(Constants.ZWSP)
|
const colorList = color.split(Constants.ZWSP);
|
||||||
e.style.backgroundColor = colorList[0];
|
e.style.backgroundColor = colorList[0];
|
||||||
e.style.color = colorList[1];
|
e.style.color = colorList[1];
|
||||||
} else if (type === "style2") {
|
} else if (type === "style2") {
|
||||||
|
|
|
||||||
|
|
@ -1290,11 +1290,11 @@ export const keydown = (app: App, protyle: IProtyle, editorElement: HTMLElement)
|
||||||
// toolbar action
|
// toolbar action
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.insert.lastUsed.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.insert.lastUsed.custom, event)) {
|
||||||
protyle.toolbar.range = range;
|
protyle.toolbar.range = range;
|
||||||
let selectElements: Element[] = []
|
let selectElements: Element[] = [];
|
||||||
if (selectText === "") {
|
if (selectText === "") {
|
||||||
selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
if (selectElements.length === 0) {
|
if (selectElements.length === 0) {
|
||||||
selectElements = [nodeElement]
|
selectElements = [nodeElement];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fontEvent(protyle, selectElements);
|
fontEvent(protyle, selectElements);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue