Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/5298

Vanessa5022e3c6c9ee
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index afc0bb0fed..685e68af9d 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -414,7 +414,10 @@ export const resizeTabs = () => {
setPadding(item.editor.protyle);
if (typeof echarts !== "undefined") {
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);
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index 225f85d3f9..251c1a82d9 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -315,16 +315,18 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
if (errorTip) {
showMessage(errorTip.substr(0, errorTip.length - 2) + " " + window.siyuan.languages.invalid);
}
- getAllModels().editor.forEach(item => {
- if (item.editor.protyle.block.rootID === id) {
- const refElement = item.editor.protyle.title.element.querySelector(".protyle-attr--refcount");
- if (refElement) {
- nodeAttrHTML += refElement.outerHTML;
+ if (!isMobile()) {
+ getAllModels().editor.forEach(item => {
+ if (item.editor.protyle.block.rootID === id) {
+ const refElement = item.editor.protyle.title.element.querySelector(".protyle-attr--refcount");
+ 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}, () => {
if (attrsResult.bookmark !== attrs.bookmark) {
const bookmark = getDockByType("bookmark").data.bookmark;
diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts
index 8be307c08b..e240eff4bc 100644
--- a/app/src/menus/navigation.ts
+++ b/app/src/menus/navigation.ts
@@ -30,9 +30,6 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
const name = getNotebookName(notebookId);
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.append(newFileMenu(notebookId, "/", true));
- /// #if !BROWSER
- genImportMenu(notebookId, "/");
- /// #endif
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
if (!window.siyuan.config.readonly) {
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));
}
}).element);
+ if (!window.siyuan.config.readonly) {
+ genImportMenu(notebookId, "/");
+ }
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.export,
icon: "iconUpload",
@@ -127,7 +127,6 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
name = getDisplayName(name, false, true);
if (!window.siyuan.config.readonly) {
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({
label: window.siyuan.languages.copy,
@@ -142,25 +141,26 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
}
}])
}).element);
- if (!isMobile()) {
- 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);
- }
+ window.siyuan.menus.menu.append(movePathToMenu(notebookId, pathString));
+ window.siyuan.menus.menu.append(deleteMenu(notebookId, name, pathString));
+ window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(renameMenu({
path: pathString,
notebookId,
name,
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
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.search,
@@ -179,10 +179,6 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
}).element);
/// #endif
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[] = [{
icon: "iconRight",
@@ -237,6 +233,9 @@ export const initFileMenu = (notebookId: string, pathString: string, id: string,
submenu: openSubmenus,
}).element);
}
+ if (!window.siyuan.config.readonly) {
+ genImportMenu(notebookId, pathString);
+ }
window.siyuan.menus.menu.append(exportMd(id));
return window.siyuan.menus.menu;
};