mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
This commit is contained in:
parent
a0f5387bb4
commit
4a9f9cf63a
4 changed files with 929 additions and 101 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@ import {Constants} from "../constants";
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {onGet} from "../protyle/util/onGet";
|
import {onGet} from "../protyle/util/onGet";
|
||||||
import {addLoading} from "../protyle/ui/initUI";
|
import {addLoading} from "../protyle/ui/initUI";
|
||||||
import {scrollCenter} from "../util/highlightById";
|
import {highlightById, scrollCenter} from "../util/highlightById";
|
||||||
import {isInEmbedBlock} from "../protyle/util/hasClosest";
|
import {isInEmbedBlock} from "../protyle/util/hasClosest";
|
||||||
import {setEditMode} from "../protyle/util/setEditMode";
|
import {setEditMode} from "../protyle/util/setEditMode";
|
||||||
import {hideElements} from "../protyle/ui/hideElements";
|
import {hideElements} from "../protyle/ui/hideElements";
|
||||||
|
|
@ -42,6 +42,9 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
|
||||||
if (blockElement) {
|
if (blockElement) {
|
||||||
pushBack();
|
pushBack();
|
||||||
scrollCenter(window.siyuan.mobile.editor.protyle, blockElement, true);
|
scrollCenter(window.siyuan.mobile.editor.protyle, blockElement, true);
|
||||||
|
if (action.includes(Constants.CB_GET_HL)) {
|
||||||
|
highlightById(window.siyuan.mobile.editor.protyle, id, true);
|
||||||
|
}
|
||||||
closePanel();
|
closePanel();
|
||||||
// 更新文档浏览时间
|
// 更新文档浏览时间
|
||||||
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: window.siyuan.mobile.editor.protyle.block.rootID});
|
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: window.siyuan.mobile.editor.protyle.block.rootID});
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,18 @@ export const initFramework = (app: App, isStart: boolean) => {
|
||||||
if (itemType === type) {
|
if (itemType === type) {
|
||||||
if (type === "sidebar-outline-tab") {
|
if (type === "sidebar-outline-tab") {
|
||||||
if (!window.siyuan.mobile.docks.outline) {
|
if (!window.siyuan.mobile.docks.outline) {
|
||||||
window.siyuan.mobile.docks.outline = new MobileOutline(app);
|
window.siyuan.mobile.docks.outline = new MobileOutline({
|
||||||
|
app,
|
||||||
|
blockId: window.siyuan.mobile.editor?.protyle.block.rootID,
|
||||||
|
isPreview: window.siyuan.mobile.editor?.protyle.preview.element.classList.contains("fn__none")
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
window.siyuan.mobile.docks.outline.update();
|
fetchPost("/api/outline/getDocOutline", {
|
||||||
|
id: window.siyuan.mobile.editor.protyle.block.rootID,
|
||||||
|
preview: window.siyuan.mobile.editor.protyle.preview.element.classList.contains("fn__none")
|
||||||
|
}, response => {
|
||||||
|
window.siyuan.mobile.docks.outline.update(response);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (type === "sidebar-backlink-tab") {
|
} else if (type === "sidebar-backlink-tab") {
|
||||||
if (!window.siyuan.mobile.docks.backlink) {
|
if (!window.siyuan.mobile.docks.backlink) {
|
||||||
|
|
@ -142,7 +151,12 @@ export const initFramework = (app: App, isStart: boolean) => {
|
||||||
sidebarElement.style.transform = "translateX(0px)";
|
sidebarElement.style.transform = "translateX(0px)";
|
||||||
const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type");
|
const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type");
|
||||||
if (type === "sidebar-outline-tab") {
|
if (type === "sidebar-outline-tab") {
|
||||||
window.siyuan.mobile.docks.outline.update();
|
fetchPost("/api/outline/getDocOutline", {
|
||||||
|
id: window.siyuan.mobile.editor.protyle.block.rootID,
|
||||||
|
preview: window.siyuan.mobile.editor.protyle.preview.element.classList.contains("fn__none")
|
||||||
|
}, response => {
|
||||||
|
window.siyuan.mobile.docks.outline.update(response);
|
||||||
|
});
|
||||||
} else if (type === "sidebar-backlink-tab") {
|
} else if (type === "sidebar-backlink-tab") {
|
||||||
window.siyuan.mobile.docks.backlink.update();
|
window.siyuan.mobile.docks.backlink.update();
|
||||||
} else if (type === "sidebar-bookmark-tab") {
|
} else if (type === "sidebar-bookmark-tab") {
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,8 @@ export class Preview {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// #else
|
||||||
|
window.siyuan.mobile.docks.outline?.setCurrentByPreview(nodeElement);
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue