This commit is contained in:
Vanessa 2022-06-27 12:06:21 +08:00
parent 2ba32ffc7c
commit 5022e3c6c9
3 changed files with 35 additions and 31 deletions

View file

@ -414,7 +414,10 @@ export const resizeTabs = () => {
setPadding(item.editor.protyle); setPadding(item.editor.protyle);
if (typeof echarts !== "undefined") { if (typeof echarts !== "undefined") {
item.editor.protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => { item.editor.protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => {
echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_")).resize(); const chartInstance = echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_"))
if (chartInstance) {
chartInstance.resize();
}
}); });
} }
}, 200); }, 200);

View file

@ -315,16 +315,18 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
if (errorTip) { if (errorTip) {
showMessage(errorTip.substr(0, errorTip.length - 2) + " " + window.siyuan.languages.invalid); showMessage(errorTip.substr(0, errorTip.length - 2) + " " + window.siyuan.languages.invalid);
} }
getAllModels().editor.forEach(item => { if (!isMobile()) {
if (item.editor.protyle.block.rootID === id) { getAllModels().editor.forEach(item => {
const refElement = item.editor.protyle.title.element.querySelector(".protyle-attr--refcount"); if (item.editor.protyle.block.rootID === id) {
if (refElement) { const refElement = item.editor.protyle.title.element.querySelector(".protyle-attr--refcount");
nodeAttrHTML += refElement.outerHTML; if (refElement) {
nodeAttrHTML += refElement.outerHTML;
}
item.editor.protyle.title.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
item.editor.protyle.wysiwyg.renderCustom(attrsResult);
} }
item.editor.protyle.title.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML; });
item.editor.protyle.wysiwyg.renderCustom(attrsResult); }
}
});
fetchPost("/api/attr/resetBlockAttrs", {id, attrs: attrsResult}, () => { fetchPost("/api/attr/resetBlockAttrs", {id, attrs: attrsResult}, () => {
if (attrsResult.bookmark !== attrs.bookmark) { if (attrsResult.bookmark !== attrs.bookmark) {
const bookmark = getDockByType("bookmark").data.bookmark; const bookmark = getDockByType("bookmark").data.bookmark;

View file

@ -30,9 +30,6 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
const name = getNotebookName(notebookId); const name = getNotebookName(notebookId);
window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.append(newFileMenu(notebookId, "/", true)); window.siyuan.menus.menu.append(newFileMenu(notebookId, "/", true));
/// #if !BROWSER
genImportMenu(notebookId, "/");
/// #endif
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
if (!window.siyuan.config.readonly) { if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(renameMenu({ window.siyuan.menus.menu.append(renameMenu({
@ -104,6 +101,9 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
shell.openPath(pathPosix().join(window.siyuan.config.system.dataDir, notebookId)); shell.openPath(pathPosix().join(window.siyuan.config.system.dataDir, notebookId));
} }
}).element); }).element);
if (!window.siyuan.config.readonly) {
genImportMenu(notebookId, "/");
}
window.siyuan.menus.menu.append(new MenuItem({ window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.export, label: window.siyuan.languages.export,
icon: "iconUpload", icon: "iconUpload",
@ -127,7 +127,6 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
name = getDisplayName(name, false, true); name = getDisplayName(name, false, true);
if (!window.siyuan.config.readonly) { if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(newFileMenu(notebookId, pathString, true)); window.siyuan.menus.menu.append(newFileMenu(notebookId, pathString, true));
genImportMenu(notebookId, pathString);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({ window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.copy, label: window.siyuan.languages.copy,
@ -142,25 +141,26 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
} }
}]) }])
}).element); }).element);
if (!isMobile()) { window.siyuan.menus.menu.append(movePathToMenu(notebookId, pathString));
window.siyuan.menus.menu.append(new MenuItem({ window.siyuan.menus.menu.append(deleteMenu(notebookId, name, pathString));
label: window.siyuan.languages.attr, window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
click() {
fetchPost("/api/block/getDocInfo", {
id
}, (response) => {
openFileAttr(response.data.ial, id);
});
}
}).element);
}
window.siyuan.menus.menu.append(renameMenu({ window.siyuan.menus.menu.append(renameMenu({
path: pathString, path: pathString,
notebookId, notebookId,
name, name,
type: "file" type: "file"
})); }));
window.siyuan.menus.menu.append(movePathToMenu(notebookId, pathString)); window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.attr,
click() {
fetchPost("/api/block/getDocInfo", {
id
}, (response) => {
openFileAttr(response.data.ial, id);
});
}
}).element);
/// #if !MOBILE /// #if !MOBILE
window.siyuan.menus.menu.append(new MenuItem({ window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.search, label: window.siyuan.languages.search,
@ -179,10 +179,6 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
}).element); }).element);
/// #endif /// #endif
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(deleteMenu(notebookId, name, pathString));
if (!isMobile()) {
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
} }
const openSubmenus: IMenu[] = [{ const openSubmenus: IMenu[] = [{
icon: "iconRight", icon: "iconRight",
@ -237,6 +233,9 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
submenu: openSubmenus, submenu: openSubmenus,
}).element); }).element);
} }
if (!window.siyuan.config.readonly) {
genImportMenu(notebookId, pathString);
}
window.siyuan.menus.menu.append(exportMd(id)); window.siyuan.menus.menu.append(exportMd(id));
return window.siyuan.menus.menu; return window.siyuan.menus.menu;
}; };