diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index b72c3dde6..570bc5ee0 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -455,14 +455,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
}
/// #if !MOBILE
if (protyle.breadcrumb) {
- 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");
- }
+ protyle.breadcrumb.toggleExit(id === protyle.block.rootID)
}
/// #endif
fetchPost("/api/filetree/getDoc", {
diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts
index cea319c85..17dae65a1 100644
--- a/app/src/protyle/breadcrumb/index.ts
+++ b/app/src/protyle/breadcrumb/index.ts
@@ -82,9 +82,7 @@ export class Breadcrumb {
size: window.siyuan.config.editor.dynamicLoadBlocks,
}, getResponse => {
onGet(getResponse, protyle, [Constants.CB_GET_HL]);
- const exitFocusElement = this.element.parentElement.querySelector('[data-type="exit-focus"]');
- exitFocusElement.classList.add("fn__none");
- exitFocusElement.nextElementSibling.classList.add("fn__none");
+ this.toggleExit(true);
});
target.classList.add("block__icon--active");
}
@@ -147,6 +145,17 @@ export class Breadcrumb {
this.mediaRecorder.startRecordingNewWavFile();
}
+ public toggleExit(hide: boolean) {
+ const exitFocusElement = this.element.parentElement.querySelector('[data-type="exit-focus"]');
+ if (hide) {
+ exitFocusElement.classList.add("fn__none");
+ exitFocusElement.nextElementSibling.classList.add("fn__none");
+ } else {
+ exitFocusElement.classList.remove("fn__none");
+ exitFocusElement.nextElementSibling.classList.remove("fn__none");
+ }
+ }
+
public showMenu(protyle: IProtyle, position: { x: number, y: number }) {
let id;
const cursorNodeElement = hasClosestBlock(getEditorRange(protyle.element).startContainer);
diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts
index 32d860774..598dd5f79 100644
--- a/app/src/protyle/header/Title.ts
+++ b/app/src/protyle/header/Title.ts
@@ -48,8 +48,9 @@ export class Title {
if (window.siyuan.config.editor.displayBookmarkIcon) {
this.element.classList.add("protyle-wysiwyg--attr");
}
+ // 标题内需要一个空格,避免首次加载出现`请输入文档名`干扰
this.element.innerHTML = `
-
`;
+
`;
this.editElement = this.element.querySelector(".protyle-title__input");
this.editElement.addEventListener("paste", (event: ClipboardEvent) => {
event.stopPropagation();
diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts
index 2703a4bd4..1b24df733 100644
--- a/app/src/protyle/scroll/saveScroll.ts
+++ b/app/src/protyle/scroll/saveScroll.ts
@@ -67,6 +67,7 @@ export const getDocByScroll = (options: {
size: Constants.SIZE_GET_MAX,
}, response => {
actions.push(Constants.CB_GET_ALL);
+ options.protyle.breadcrumb?.toggleExit(false);
onGet(response, options.protyle, actions, options.scrollAttr);
if (options.cb) {
options.cb();
@@ -79,6 +80,7 @@ export const getDocByScroll = (options: {
startID: options.scrollAttr.startId,
endID: options.scrollAttr.endId,
}, response => {
+ options.protyle.breadcrumb?.toggleExit(true);
onGet(response, options.protyle, actions, options.scrollAttr);
if (options.cb) {
options.cb();
diff --git a/app/src/protyle/util/setEditMode.ts b/app/src/protyle/util/setEditMode.ts
index bd0e9c4a1..879e2241c 100644
--- a/app/src/protyle/util/setEditMode.ts
+++ b/app/src/protyle/util/setEditMode.ts
@@ -11,11 +11,7 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
protyle.scroll?.element.classList.add("fn__none");
if (protyle.options.render.breadcrumb) {
protyle.breadcrumb?.element.classList.add("fn__none");
- if (protyle.block.showAll) {
- const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
- exitFocusElement.classList.add("fn__none");
- exitFocusElement.nextElementSibling.classList.add("fn__none");
- }
+ protyle.breadcrumb.toggleExit(true);
}
protyle.preview.render(protyle);
} else if (type === "wysiwyg") {
@@ -31,11 +27,7 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
}
if (protyle.options.render.breadcrumb) {
protyle.breadcrumb?.element.classList.remove("fn__none");
- if (protyle.block.showAll) {
- const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
- exitFocusElement.classList.remove("fn__none");
- exitFocusElement.nextElementSibling.classList.remove("fn__none");
- }
+ protyle.breadcrumb.toggleExit(!protyle.block.showAll);
}
}
hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle);
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 1ccb6a97a..fc2ccb8ae 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -903,14 +903,7 @@ const getArticle = (options: {
const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();
options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + matchElement.getBoundingClientRect().top - contentRect.top - contentRect.height / 2;
}
- const exitFocusElement = options.edit.protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
- if (!foldResponse.data) {
- exitFocusElement.classList.add("fn__none");
- exitFocusElement.nextElementSibling.classList.add("fn__none");
- } else {
- exitFocusElement.classList.remove("fn__none");
- exitFocusElement.nextElementSibling.classList.remove("fn__none");
- }
+ options.edit.protyle.breadcrumb.toggleExit(!foldResponse.data);
});
});
};