Skip to content

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

:art: Move tab task toggle into block menu https://github.com/siyuan-note/siyuan/issues/17642

Daniel712d06216317
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy
index 7a6a11af89..65b8d937ce 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy
@@ -6,7 +6,7 @@
"id": "20200924101225-k254i8g",
"title": "Content Block Type",
"type": "doc",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -1336,7 +1336,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091538-a55chyw",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2786,7 +2786,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260906003122-tfblsll",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2801,12 +2801,30 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260906003122-gtkz3ie",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Each tab item has a title and body and supports nested content and block references. Right-click a tab title and use the task option to toggle task mode for the group."
+ "Data": "Each tab item has a title and body and supports nested content and block references. To toggle task mode for the group, open the block icon menu and select "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Tabbed container"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Task"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy
index 7b1e5f2213..e927961bf9 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy
@@ -6,7 +6,7 @@
"id": "20200905090211-2vixtlf",
"title": "内容块类型",
"type": "doc",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -1369,7 +1369,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104090624-9qgquxh",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2868,7 +2868,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260906003122-tqc63mt",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2883,12 +2883,30 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260906003122-xun3tcl",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
"Type": "NodeText",
- "Data": "页签项包含标题和正文,支持嵌套内容和块引用。右键点击页签标题,可通过任务选项切换整组的任务模式。"
+ "Data": "页签项包含标题和正文,支持嵌套内容和块引用。在块标菜单中选择 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "页签块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "任务"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",可切换整组的任务模式。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy
index af1fc41df2..90b3dfcc1b 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy
@@ -6,7 +6,7 @@
"id": "20211226120147-ib6yy3i",
"title": "內容區塊類型",
"type": "doc",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -1365,7 +1365,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20211226120227-esm6f20",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2786,7 +2786,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260906003122-6qha4x8",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2801,12 +2801,30 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260906003122-6we2ve6",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
"Type": "NodeText",
- "Data": "頁籤項包含標題與正文,支援巢狀內容和區塊引用。在頁籤標題上按右鍵,可透過任務選項切換整組的任務模式。"
+ "Data": "頁籤項包含標題與正文,支援巢狀內容和區塊引用。在區塊圖示選單中選擇 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "頁籤區塊"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "任務"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",可切換整組的任務模式。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy
index 7309bef751..7af485ffd1 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy
@@ -7,7 +7,7 @@
"id": "20240530101000-35bbvcx",
"title": "コンテンツブロックの種類",
"type": "doc",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -1422,7 +1422,7 @@
"Properties": {
"ID": "20240530101000-rjjxxn8",
"id": "20240530101000-p035stn",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2980,7 +2980,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260906003122-3mia0g1",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
@@ -2995,12 +2995,30 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260906003122-azyooos",
- "updated": "20260906210725"
+ "updated": "20260906220233"
},
"Children": [
{
"Type": "NodeText",
- "Data": "タブ項目にはタイトルと本文があり、入れ子の内容とブロック参照に対応しています。タイトルを右クリックし、タスクの項目でグループ全体のタスクモードを切り替えられます。"
+ "Data": "タブ項目にはタイトルと本文があり、入れ子の内容とブロック参照に対応しています。ブロックアイコンのメニューで "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "タブブロック"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "タスク"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " を選択すると、グループ全体のタスクモードを切り替えられます。"
}
]
},
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 51abfc2ef0..50dc8e0cd3 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -710,9 +710,9 @@ test("list block submenu follows the base block entries", () => {
]);
});
-test("tabs layout actions have their own configurable block menu", () => {
+test("tabs layout and task actions have their own configurable block menu", () => {
assert.deepEqual(getEntryCatalogChildren("gutter.single.tabs").map(item => item.key), [
- "tabsPositionTop", "tabsPositionLeft",
+ "tabsPositionTop", "tabsPositionLeft", "tabsTask",
]);
const keys = getEntryCatalogChildren("gutter.single").map(item => item.key);
const index = keys.indexOf("tabs");
@@ -720,6 +720,12 @@ test("tabs layout actions have their own configurable block menu", () => {
"separator_tabs", "tabs", "separator_cancelSuperBlock", "superBlock",
]);
assert.equal(getEntryCatalogNode("gutter.single.tabs")?.simple, true);
+ assert.equal(getEntryCatalogNode("gutter.single.tabs.tabsTask")?.simple, true);
+ assert.equal(getEntryCatalogNode("gutter.single.tabs.tabsTask")?.type, "entry");
+ const source = readFileSync(resolve(process.cwd(), "src/protyle/gutter/index.ts"), "utf8");
+ const submenu = source.slice(source.indexOf('id: "tabsPositionTop"'), source.indexOf('} else if (type === "NodeSuperBlock" && !protyle.disabled)'));
+ assert.deepEqual(Array.from(submenu.matchAll(/id: "([^"]+)"/g), match => match[1]),
+ getEntryCatalogChildren("gutter.single.tabs").map(item => item.key));
assert.equal(getEntryCatalogNode("gutter.single.separator_tabs")?.type, "separator");
});
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index 728e74dd60..9b553f00e2 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -368,6 +368,7 @@ const gutterSingle = () => [
node("tabs", lang("tabs"), true, [
node("tabsPositionTop", lang("tabsPositionTop")),
node("tabsPositionLeft", lang("tabsPositionLeft")),
+ node("tabsTask", lang("task")),
]),
separator("separator_cancelSuperBlock"),
node("superBlock", lang("superBlock"), true, [
diff --git a/app/src/config/entryVisibility/order.test.ts b/app/src/config/entryVisibility/order.test.ts
index 236870e46e..361e5d3fae 100644
--- a/app/src/config/entryVisibility/order.test.ts
+++ b/app/src/config/entryVisibility/order.test.ts
@@ -32,6 +32,14 @@ test("entry order ignores unknown and duplicate keys", () => {
assert.deepEqual(mergeEntryOrder(["a", "b", "c"], ["missing", "c", "c", "a"]), ["c", "a", "b"]);
});
+test("tab task action merges into saved layout menus while preserving plugin slots", () => {
+ const defaults = getEntryCatalogChildren("gutter.single.tabs").map(item => item.key);
+ const saved = ["tabsPositionLeft", "plugin:example:item", "tabsPositionTop"];
+ const merged = mergeEntryOrderPreservingUnknown(defaults, saved);
+ assert.deepEqual(merged.filter(key => key !== "tabsTask"), saved);
+ assert.deepEqual(merged, ["tabsPositionLeft", "plugin:example:item", "tabsTask", "tabsPositionTop"]);
+});
+
test("tab conversion merges into saved block menus without moving plugin slots", () => {
const entries = getEntryCatalogChildren("gutter.single.turnInto");
const defaults = entries.map(item => item.key);
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 85c1582799..02e1766185 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -128,7 +128,8 @@ import {canShowGutterInsert, genGutterBlockButtonHTML} from "./button";
import {getViewFoldOccurrenceID, hasViewFoldContext, setViewFold} from "../util/viewFold";
import {exportImage} from "../export/util";
import {CALLOUT_PRESETS, updateCalloutType, updateCustomCalloutType} from "../wysiwyg/callout";
-import {setTabsPosition, unwrapTabs} from "../wysiwyg/tabs";
+import {setTabsPosition, toggleTabsTasks, unwrapTabs} from "../wysiwyg/tabs";
+import {getTabItems} from "../render/tabsRender";
// 块类型 data-type 到本地化名称键的映射,用于块标提示中的 ${x}
const BLOCK_TYPE_LANG_KEYS: { [key: string]: string } = {
@@ -2180,6 +2181,12 @@ export class Gutter {
label: window.siyuan.languages.tabsPositionLeft,
icon: nodeElement.getAttribute("tabs-position") === "left" ? "iconSelect" : undefined,
click: () => setTabsPosition(protyle, nodeElement as HTMLElement, "left"),
+ }, {
+ id: "tabsTask",
+ label: window.siyuan.languages.task,
+ icon: "iconCheck",
+ checked: getTabItems(nodeElement as HTMLElement).some(item => item.hasAttribute("tabs-task")),
+ click: () => toggleTabsTasks(protyle, nodeElement as HTMLElement),
}],
}).element);
} else if (type === "NodeSuperBlock" && !protyle.disabled) {
diff --git a/app/src/protyle/wysiwyg/tabs.ts b/app/src/protyle/wysiwyg/tabs.ts
index f6753f7a7e..1da2caedb0 100644
--- a/app/src/protyle/wysiwyg/tabs.ts
+++ b/app/src/protyle/wysiwyg/tabs.ts
@@ -185,9 +185,6 @@ export const openTabsMenu = (protyle: IProtyle, tabs: HTMLElement, item: HTMLEle
click: () => {copyTextByType([item.dataset.nodeId], "ref");},
}]});
if (canEdit(protyle, tabs)) {
- menu.addItem({icon: "iconCheck", label: lang.task,
- checked: getTabItems(tabs).some(entry => entry.hasAttribute("tabs-task")),
- click: () => toggleTabsTasks(protyle, tabs)});
if (item.hasAttribute("tabs-task")) {
menu.addItem({icon: "iconCheck", label: lang.customTaskStatus, click: () => editTabTask(protyle, item)});
}