Skip to content

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

:art: Distinguish conditional resource menu entries https://github.com/siyuan-note/siyuan/issues/18484

Daniela7075b775877
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 3adcd11fdc..eb3382d01f 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -31,6 +31,33 @@ test("entry catalog paths are unique and indexed", () => {
assert.deepEqual(new Set(getEntryPaths()), new Set(paths));
});
+test("conditional block resource menus have distinct configuration labels", () => {
+ const windowDescriptor = Object.getOwnPropertyDescriptor(globalThis, "window");
+ Object.defineProperty(globalThis, "window", {
+ configurable: true,
+ value: {
+ siyuan: {
+ languages: {
+ assets: "Assets",
+ audio: "Audio",
+ video: "Video",
+ },
+ },
+ },
+ });
+ try {
+ assert.equal(getEntryCatalogNode("gutter.single.assetVideo")?.label(), "Video - Assets");
+ assert.equal(getEntryCatalogNode("gutter.single.assetAudio")?.label(), "Audio - Assets");
+ assert.equal(getEntryCatalogNode("gutter.single.assetIFrame")?.label(), "IFrame - Assets");
+ } finally {
+ if (windowDescriptor) {
+ Object.defineProperty(globalThis, "window", windowDescriptor);
+ } else {
+ Reflect.deleteProperty(globalThis, "window");
+ }
+ }
+});
+
test("sortable entry catalog groups contain valid separator positions", () => {
getEntryOrderParents().forEach((parentPath) => {
const children = getEntryCatalogChildren(parentPath);
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index 62c673020f..b8e3fb3d0b 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -299,7 +299,7 @@ const gutterSingle = () => [
node("exportCSV", () => `${window.siyuan.languages.export} CSV`),
node("showDatabaseInFolder", lang("showInFolder")),
separator("separator_VideoOrAudio"),
- node("assetVideo", lang("assets"), true, [
+ node("assetVideo", location(lang("video"), lang("assets")), true, [
node("asset", lang("assets")),
separator("separator_rename"),
node("rename", lang("rename")),
@@ -307,7 +307,7 @@ const gutterSingle = () => [
node("export", lang("export")),
node("copyFile", lang("copyFile")),
]),
- node("assetAudio", lang("assets"), true, [
+ node("assetAudio", location(lang("audio"), lang("assets")), true, [
node("asset", lang("assets")),
separator("separator_rename"),
node("rename", lang("rename")),
@@ -316,7 +316,7 @@ const gutterSingle = () => [
node("copyFile", lang("copyFile")),
]),
separator("separator_IFrame"),
- node("assetIFrame", lang("assets"), true, [
+ node("assetIFrame", location(literal("IFrame"), lang("assets")), true, [
node("asset", lang("assets")),
separator("separator_openBy"),
node("openBy", lang("openBy")),