mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-08 21:51:32 +08:00
🎨 openfile
This commit is contained in:
parent
cc613f7d57
commit
fb6b4e48ca
@ -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", {
|
||||
|
@ -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);
|
||||
|
@ -48,6 +48,7 @@ export class Title {
|
||||
if (window.siyuan.config.editor.displayBookmarkIcon) {
|
||||
this.element.classList.add("protyle-wysiwyg--attr");
|
||||
}
|
||||
// 标题内需要一个空格,避免首次加载出现`请输入文档名`干扰
|
||||
this.element.innerHTML = `<span aria-label="${window.siyuan.languages.gutterTip2}" class="protyle-title__icon" data-type="a" data-position="right"><svg><use xlink:href="#iconFile"></use></svg></span>
|
||||
<div contenteditable="true" data-position="center" spellcheck="${window.siyuan.config.editor.spellcheck}" class="protyle-title__input" data-tip="${window.siyuan.languages._kernel[16]}"> </div><div class="protyle-attr"></div>`;
|
||||
this.editElement = this.element.querySelector(".protyle-title__input");
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user