This commit is contained in:
Vanessa 2024-02-02 11:52:53 +08:00
parent 0dd00d2138
commit ad6fe1cd6e
8 changed files with 136 additions and 21 deletions

View file

@ -314,6 +314,13 @@ export const disabledProtyle = (protyle: IProtyle) => {
if (protyle.breadcrumb) {
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconLock");
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]').setAttribute("aria-label", window.siyuan.config.editor.readOnly ? window.siyuan.languages.tempUnlock : window.siyuan.languages.unlockEdit);
const undoElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="undo"]')
if (undoElement && !undoElement.classList.contains("fn__none")) {
undoElement.classList.add("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="redo"]').classList.add("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="indent"]').classList.add("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="outdent"]').classList.add("fn__none")
}
}
hideTooltip();
};
@ -357,6 +364,13 @@ export const enableProtyle = (protyle: IProtyle) => {
if (protyle.breadcrumb) {
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconUnlock");
protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"]').setAttribute("aria-label", window.siyuan.config.editor.readOnly ? window.siyuan.languages.cancelTempUnlock : window.siyuan.languages.lockEdit);
const undoElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="undo"]')
if (undoElement && undoElement.classList.contains("fn__none")) {
undoElement.classList.remove("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="redo"]').classList.remove("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="indent"]').classList.remove("fn__none")
protyle.breadcrumb.element.parentElement.querySelector('[data-type="outdent"]').classList.remove("fn__none")
}
}
hideTooltip();
};