This commit is contained in:
Vanessa 2022-08-29 21:20:28 +08:00
parent 74bfa2ecd9
commit 4ede229dd0
5 changed files with 19 additions and 19 deletions

View file

@ -102,14 +102,14 @@ const openFile = (options: IOpenFileOptions) => {
if (initData) {
const initObj = JSON.parse(initData);
if (initObj.rootId === options.rootID || initObj.blockId === options.rootID) {
initObj.blockId = options.id
initObj.mode = options.mode
initObj.blockId = options.id;
initObj.mode = options.mode;
if (options.zoomIn) {
initObj.action = [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS]
initObj.action = [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS];
} else {
initObj.action = options.action
initObj.action = options.action;
}
delete initObj.scrollAttr
delete initObj.scrollAttr;
item.headElement.setAttribute("data-initdata", JSON.stringify(initObj));
item.parent.switchTab(item.headElement);
return true;

View file

@ -163,12 +163,12 @@ export const initTabMenu = (tab: Tab) => {
const model = tab.model;
let rootId;
if ((model && model instanceof Editor)) {
rootId = model.editor.protyle.block.rootID
rootId = model.editor.protyle.block.rootID;
} else {
const initData = tab.headElement.getAttribute("data-initdata")
const initData = tab.headElement.getAttribute("data-initdata");
if (initData) {
const initDataObj = JSON.parse(initData);
rootId = initDataObj.rootId || initDataObj.blockId
rootId = initDataObj.rootId || initDataObj.blockId;
}
}
if (rootId) {

View file

@ -120,7 +120,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
if (scrollObj && protyle.options.mode !== "preview") {
restoreScroll(protyle, scrollObj);
}
removeLoading(protyle)
removeLoading(protyle);
});
};

View file

@ -1068,7 +1068,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle,
nodeElement,
type: "Blocks2Ps",
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1079,7 +1079,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 1
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1090,7 +1090,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 2
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1101,7 +1101,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 3
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1112,7 +1112,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 4
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1123,7 +1123,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 5
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1134,7 +1134,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nodeElement,
type: "Blocks2Hs",
level: 6
})
});
event.preventDefault();
event.stopPropagation();
return true;
@ -1482,7 +1482,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
let html = "";
if (selectsElement.length === 0) {
selectsElement.push(nodeElement)
selectsElement.push(nodeElement);
}
selectsElement.forEach(item => {
item.querySelectorAll('[contenteditable="true"]').forEach(editItem => {

View file

@ -1,6 +1,6 @@
import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {fetchPost} from "../../util/fetch";
import {focusBlock, focusByRange, focusByWbr, focusSideBlock, getEditorRange} from "../util/selection";
import {getContenteditableElement, getTopAloneElement} from "./getBlock";
import {getTopAloneElement} from "./getBlock";
import {Constants} from "../../constants";
import {blockRender} from "../markdown/blockRender";
import {processRender} from "../util/processCode";