:mobile: preview outline
This commit is contained in:
parent
23e6f86236
commit
9b6fe676ab
4 changed files with 12 additions and 7 deletions
|
@ -4,7 +4,7 @@ import {Tree} from "../../util/Tree";
|
|||
import {getDockByType, setPanelFocus} from "../util";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {getAllModels} from "../getAll";
|
||||
import {hasClosestBlock, hasClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {hasClosestBlock, hasClosestByClassName, hasTopClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {updateHotkeyTip} from "../../protyle/util/compatibility";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {Constants} from "../../constants";
|
||||
|
|
|
@ -16,6 +16,7 @@ import {getEditorRange} from "../util/selection";
|
|||
import {setPadding} from "../ui/initUI";
|
||||
/// #if !MOBILE
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {setPanelFocus} from "../../layout/util";
|
||||
/// #endif
|
||||
/// #if !BROWSER
|
||||
import {getCurrentWindow, systemPreferences} from "@electron/remote";
|
||||
|
@ -25,7 +26,6 @@ import {hideElements} from "../ui/hideElements";
|
|||
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||
import {reloadProtyle} from "../util/reload";
|
||||
import {deleteFile} from "../../editor/deleteFile";
|
||||
import {setPanelFocus} from "../../layout/util";
|
||||
|
||||
export class Breadcrumb {
|
||||
public element: HTMLElement;
|
||||
|
@ -44,9 +44,11 @@ export class Breadcrumb {
|
|||
<button class="b3-tooltips b3-tooltips__w block__icon block__icon--show fn__flex-center" data-menu="true" aria-label="${window.siyuan.languages.more}"><svg><use xlink:href="#iconMore"></use></svg></button>`;
|
||||
this.element = element.firstElementChild as HTMLElement;
|
||||
element.addEventListener("click", (event) => {
|
||||
/// #if !MOBILE
|
||||
if (protyle.model) {
|
||||
setPanelFocus(protyle.model.element.parentElement.parentElement);
|
||||
}
|
||||
/// #endif
|
||||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isEqualNode(element)) {
|
||||
const id = target.getAttribute("data-node-id");
|
||||
|
|
|
@ -11,14 +11,14 @@ import {shell} from "electron";
|
|||
/// #endif
|
||||
/// #if !MOBILE
|
||||
import {openAsset, openBy} from "../../editor/util";
|
||||
import {getAllModels} from "../../layout/getAll";
|
||||
import {setPanelFocus} from "../../layout/util";
|
||||
/// #endif
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {processRender} from "../util/processCode";
|
||||
import {highlightRender} from "../render/highlightRender";
|
||||
import {speechRender} from "../render/speechRender";
|
||||
import {avRender} from "../render/av/render";
|
||||
import {setPanelFocus} from "../../layout/util";
|
||||
import {getAllModels} from "../../layout/getAll";
|
||||
|
||||
export class Preview {
|
||||
public element: HTMLElement;
|
||||
|
@ -166,17 +166,18 @@ export class Preview {
|
|||
avRender(protyle.preview.previewElement);
|
||||
speechRender(protyle.preview.previewElement, protyle.options.lang);
|
||||
protyle.preview.previewElement.scrollTop = oldScrollTop;
|
||||
getAllModels().outline.find(item => {
|
||||
/// #if !MOBILE
|
||||
response.data = response.data.outline;
|
||||
getAllModels().outline.forEach(item => {
|
||||
if (item.type === "pin" || (item.type === "local" && item.blockId === protyle.block.rootID)) {
|
||||
response.data = response.data.outline;
|
||||
item.isPreview = true;
|
||||
item.update(response, protyle.block.rootID);
|
||||
if (item.type === "pin") {
|
||||
item.updateDocTitle(protyle.background.ial);
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
/// #endif
|
||||
});
|
||||
}, protyle.options.preview.delay);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
|
|||
protyle.breadcrumb?.element.classList.remove("fn__none");
|
||||
protyle.breadcrumb.toggleExit(!protyle.block.showAll);
|
||||
}
|
||||
/// #if !MOBILE
|
||||
updateOutline(getAllModels(), protyle, true);
|
||||
/// #endif
|
||||
}
|
||||
hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue