mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 11:50:15 +01:00
This commit is contained in:
parent
6341073ebe
commit
e58287c450
1 changed files with 9 additions and 3 deletions
|
|
@ -236,6 +236,7 @@ export class Toolbar {
|
||||||
if (!nodeElement) {
|
if (!nodeElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const rangeTypes = this.getCurrentType();
|
||||||
let previousElement: Element
|
let previousElement: Element
|
||||||
let nextElement: Element
|
let nextElement: Element
|
||||||
let previousIndex: number
|
let previousIndex: number
|
||||||
|
|
@ -286,8 +287,11 @@ export class Toolbar {
|
||||||
}
|
}
|
||||||
const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined;
|
const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined;
|
||||||
const newNodes: Node[] = [];
|
const newNodes: Node[] = [];
|
||||||
if (action === "remove" || actionBtn?.classList.contains("protyle-toolbar__item--current")) {
|
if (action === "remove" || actionBtn?.classList.contains("protyle-toolbar__item--current") ||
|
||||||
actionBtn.classList.remove("protyle-toolbar__item--current");
|
(action === "range" && rangeTypes.length > 0 && rangeTypes.includes(type))) {
|
||||||
|
if (actionBtn) {
|
||||||
|
actionBtn.classList.remove("protyle-toolbar__item--current");
|
||||||
|
}
|
||||||
let removeIndex = 0
|
let removeIndex = 0
|
||||||
contents.childNodes.forEach((item: HTMLElement, index) => {
|
contents.childNodes.forEach((item: HTMLElement, index) => {
|
||||||
if (item.tagName === "WBR") {
|
if (item.tagName === "WBR") {
|
||||||
|
|
@ -322,7 +326,9 @@ export class Toolbar {
|
||||||
removeIndex++
|
removeIndex++
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.element.querySelector(`[data-type="${type}"]`).classList.add("protyle-toolbar__item--current");
|
if (!this.element.classList.contains("fn__none")) {
|
||||||
|
this.element.querySelector(`[data-type="${type}"]`).classList.add("protyle-toolbar__item--current");
|
||||||
|
}
|
||||||
let addIndex = 0
|
let addIndex = 0
|
||||||
contents.childNodes.forEach((item: HTMLElement, index) => {
|
contents.childNodes.forEach((item: HTMLElement, index) => {
|
||||||
if (item.nodeType === 3) {
|
if (item.nodeType === 3) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue