mirror of
https://github.com/siyuan-note/siyuan
synced 2026-04-21 13:37:52 +00:00
This commit is contained in:
parent
bb0a4e8358
commit
0cce5aa0da
3 changed files with 12 additions and 6 deletions
|
|
@ -361,7 +361,6 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
|||
editor.parent.parent.switchTab(editor.parent.headElement);
|
||||
editor.parent.parent.showHeading();
|
||||
if (options.mode !== "preview" && !editor.editor.protyle.preview.element.classList.contains("fn__none")) {
|
||||
// TODO https://github.com/siyuan-note/siyuan/issues/3059
|
||||
return true;
|
||||
}
|
||||
if (options.zoomIn) {
|
||||
|
|
@ -442,9 +441,6 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
|||
if (options.action?.includes(Constants.CB_GET_OUTLINE)) {
|
||||
hideElements(["select"], editor.editor.protyle);
|
||||
}
|
||||
if (options.mode) {
|
||||
setEditMode(editor.editor.protyle, options.mode);
|
||||
}
|
||||
};
|
||||
|
||||
const newTab = (options: IOpenFileOptions) => {
|
||||
|
|
@ -633,6 +629,9 @@ export const updateOutline = (models: IModels, protyle: IProtyle, reload = false
|
|||
let blockId = "";
|
||||
if (protyle && protyle.block) {
|
||||
blockId = protyle.block.rootID;
|
||||
if (!blockId && reload && item.type === "local") {
|
||||
blockId = item.blockId;
|
||||
}
|
||||
}
|
||||
if (blockId === item.blockId && !reload && item.isPreview !== protyle.preview.element.classList.contains("fn__none")) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -703,7 +703,8 @@ export const newModelByInitData = (app: App, tab: Tab, json: any) => {
|
|||
blockId: json.blockId,
|
||||
mode: json.mode,
|
||||
scrollPosition: json.scrollPosition,
|
||||
action: typeof json.action === "string" ? (json.action ? [json.action, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS]) : json.action.concat(Constants.CB_GET_FOCUS),
|
||||
action: Array.isArray(json.action) ? json.action.concat(Constants.CB_GET_FOCUS) :
|
||||
(json.action ? [json.action, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS]),
|
||||
});
|
||||
}
|
||||
return model;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import {App} from "../index";
|
|||
import {exportByMobile, isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {checkFold} from "../util/noRelyPCFunction";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {Editor} from "../editor";
|
||||
import {setEditMode} from "../protyle/util/setEditMode";
|
||||
|
||||
export const exportAsset = (src: string) => {
|
||||
return {
|
||||
|
|
@ -164,7 +166,11 @@ export const openEditorTab = (app: App, ids: string[], notebookId?: string, path
|
|||
label: window.siyuan.languages.preview,
|
||||
click: () => {
|
||||
ids.forEach((id) => {
|
||||
openFileById({app, id, mode: "preview"});
|
||||
openFileById({
|
||||
app, id, mode: "preview", afterOpen(editor: Editor) {
|
||||
setEditMode(editor.editor.protyle, "preview");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue