diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 3091b6ac9..173831ff5 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1,6 +1,5 @@ { "exitFocus": "Exit focus", - "exitReadOnly": "Exit read-only", "pointExchangeSize": "Point Exchange", "panel": "Panel", "copyPath": "Copy Path", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 5903477a6..21d86f88c 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1,6 +1,5 @@ { "exitFocus": "Salir del enfoque", - "exitReadOnly": "Salir de solo lectura", "pointExchangeSize": "Intercambio de puntos", "panel": "Panel", "copyPath": "Copiar ruta", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 8eee2d599..61d1078fb 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1,6 +1,5 @@ { "exitFocus": "Quitter le focus", - "exitReadOnly": "Quitter en lecture seule", "pointExchangeSize": "Échange de points", "panel": "Panneau", "copyPath": "Copier le chemin", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index b9b8ea53c..9fed3464b 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1,6 +1,5 @@ { "exitFocus": "退出聚焦", - "exitReadOnly": "退出只讀", "pointExchangeSize": "積分兌換", "panel": "面板", "copyPath": "複製路徑", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index e1dbecf27..b2fc65f66 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,6 +1,5 @@ { "exitFocus": "退出聚焦", - "exitReadOnly": "退出只读", "pointExchangeSize": "积分兑换", "panel": "面板", "copyPath": "复制路径", diff --git a/app/src/config/editor.ts b/app/src/config/editor.ts index c3ce51a24..bbc702d49 100644 --- a/app/src/config/editor.ts +++ b/app/src/config/editor.ts @@ -6,7 +6,6 @@ import {setPadding} from "../protyle/ui/initUI"; import {reloadProtyle} from "../protyle/util/reload"; import {disabledProtyle, enableProtyle} from "../protyle/util/onGet"; import {updateHotkeyTip} from "../protyle/util/compatibility"; -import {updateTitle} from "../dialog/processSystem"; export const editor = { element: undefined as Element, @@ -17,13 +16,14 @@ export const editor = { } window.siyuan.config.editor.readOnly = readOnly; if (readOnly) { + target.classList.add("toolbar__item--active") target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editMode} ${updateHotkeyTip(window.siyuan.config.keymap.general.editMode.custom)}`); target.querySelector("use").setAttribute("xlink:href", "#iconPreview"); } else { + target.classList.remove("toolbar__item--active") target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editReadonly} ${updateHotkeyTip(window.siyuan.config.keymap.general.editMode.custom)}`); target.querySelector("use").setAttribute("xlink:href", "#iconEdit"); } - updateTitle(readOnly); fetchPost("/api/setting/setEditor", window.siyuan.config.editor, () => { const allModels = getAllModels(); allModels.editor.forEach(editor => { diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index ba9073a2f..a0715fc1d 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -289,36 +289,7 @@ export const setTitle = (title: string, protyle?: IProtyle) => { return; } dragElement.setAttribute("title", title); - title = escapeHtml(title); - if (protyle && protyle.disabled) { - title = `${title}`; - } - if (protyle && protyle.block.showAll) { - title = `${title}`; - } - dragElement.innerHTML = title; - } -}; - -export const updateTitle = (readonly?: boolean, zoomIn?: boolean, zoomInId?: string) => { - const dragElement = document.getElementById("drag"); - if (typeof readonly === "boolean") { - const barExitReadOnlyElement = dragElement.querySelector("#barExitReadOnly") - if (readonly && !barExitReadOnlyElement) { - dragElement.insertAdjacentHTML("beforeend", ``) - } else if (!readonly && barExitReadOnlyElement) { - barExitReadOnlyElement.previousElementSibling.remove(); - barExitReadOnlyElement.remove(); - } - } - if (typeof zoomIn === "boolean") { - const barExitFocusElement = dragElement.querySelector("#barExitFocus") - if (zoomIn && !barExitFocusElement) { - dragElement.insertAdjacentHTML("beforeend", ``) - } else if (!zoomIn && barExitFocusElement) { - barExitFocusElement.previousElementSibling.remove(); - barExitFocusElement.remove(); - } + dragElement.innerHTML = escapeHtml(title); } }; diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 1814d0141..d9ffe5e7c 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -46,7 +46,6 @@ import {exportAsset} from "./util"; import {removeLink} from "../protyle/toolbar/Link"; import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey"; import {getEnableHTML} from "../protyle/wysiwyg/removeEmbed"; -import {updateTitle} from "../dialog/processSystem"; import {renameTag} from "../util/noRelyPCFunction"; export const refMenu = (protyle: IProtyle, element: HTMLElement) => { @@ -466,6 +465,15 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB if (isPushBack) { pushBack(); } + } else { + const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]') + if (id === protyle.block.rootID) { + exitFocusElement.classList.add("fn__none") + exitFocusElement.nextElementSibling.classList.add("fn__none") + } else { + exitFocusElement.classList.remove("fn__none") + exitFocusElement.nextElementSibling.classList.remove("fn__none") + } } fetchPost("/api/filetree/getDoc", { id, @@ -496,7 +504,6 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB /// #if !MOBILE if (protyle.model) { updateBacklinkGraph(getAllModels(), protyle); - updateTitle(undefined, id !== protyle.block.rootID, protyle.model.parent.headElement.getAttribute("data-id")); } /// #endif if (callback) { diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index ab450c60b..34c92cef8 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -35,12 +35,15 @@ export class Breadcrumb { constructor(protyle: IProtyle) { const element = document.createElement("div"); element.className = "protyle-breadcrumb"; + const isFocus = protyle.options.action.includes(Constants.CB_GET_ALL) let html = `
-`; + + +`; if (protyle.options.render.breadcrumbContext) { html += ` -`; +`; } element.innerHTML = html; this.element = element.firstElementChild as HTMLElement; @@ -65,6 +68,10 @@ export class Breadcrumb { }); event.preventDefault(); break; + } else if (target.getAttribute("data-type") === "exit-focus") { + zoomOut(protyle, protyle.block.rootID); + event.preventDefault(); + break } else if (target.getAttribute("data-type") === "context") { if (target.classList.contains("block__icon--active")) { fetchPost("/api/filetree/getDoc", { diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts index 16049f06a..caaef1b19 100644 --- a/app/src/util/onGetConfig.ts +++ b/app/src/util/onGetConfig.ts @@ -203,7 +203,7 @@ const initBar = () => { -