This commit is contained in:
Vanessa 2022-07-20 09:08:49 +08:00
parent b53c0e4758
commit 85aaede426
4 changed files with 8 additions and 11 deletions

View file

@ -327,17 +327,17 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt
}; };
export const isCurrentEditor = (blockId: string) => { export const isCurrentEditor = (blockId: string) => {
const activeElement = document.querySelector('.layout__wnd--active > .layout-tab-bar > .item--focus') const activeElement = document.querySelector(".layout__wnd--active > .layout-tab-bar > .item--focus");
if (activeElement) { if (activeElement) {
const tab = getInstanceById(activeElement.getAttribute("data-id")) const tab = getInstanceById(activeElement.getAttribute("data-id"));
if (tab instanceof Tab && tab.model instanceof Editor) { if (tab instanceof Tab && tab.model instanceof Editor) {
if (tab.model.editor.protyle.block.rootID !== blockId) { if (tab.model.editor.protyle.block.rootID !== blockId) {
return false; return false;
} }
} }
} }
return true return true;
} };
const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => { const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => {
models.outline.find(item => { models.outline.find(item => {

View file

@ -457,7 +457,7 @@ export class Graph extends Model {
}, response => { }, response => {
element.classList.remove("fn__rotate"); element.classList.remove("fn__rotate");
if (id) { if (id) {
this.blockId = id this.blockId = id;
} }
if (!isCurrentEditor(this.blockId)) { if (!isCurrentEditor(this.blockId)) {
return; return;

View file

@ -122,19 +122,16 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
return; return;
} }
let exportType = "HTML (SiYuan)" let exportType = "HTML (SiYuan)";
let extension = "html"
switch (option.type) { switch (option.type) {
case "htmlmd": case "htmlmd":
exportType = "HTML (Markdown)"; exportType = "HTML (Markdown)";
break; break;
case "word": case "word":
exportType = "Word .docx"; exportType = "Word .docx";
extension = "docx";
break; break;
case "pdf": case "pdf":
exportType = "PDF"; exportType = "PDF";
extension = "pdf";
break; break;
} }

View file

@ -65,12 +65,12 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>
action: "update", action: "update",
id, id,
data: oldHTML data: oldHTML
}) });
doOperation.push({ doOperation.push({
action: "update", action: "update",
id, id,
data: blockElement.outerHTML data: blockElement.outerHTML
}) });
} }
const tempElement = document.createElement("template"); const tempElement = document.createElement("template");
tempElement.innerHTML = html; tempElement.innerHTML = html;