Skip to content

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

:sparkles: Add recursive list conversion submenu https://github.com/siyuan-note/siyuan/issues/16942

Daniel964d70342839
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index e852ff84d7..fba6609b11 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "تضمين القوائم الفرعية",
"selectRelationItems": "اختر العناصر المرتبطة",
"filterOperatorContainsAnyItem": "يحتوي على أي عنصر",
"filterOperatorDoesNotContainAnyItem": "لا يحتوي على أي عنصر",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 1526d3c1f8..35891772e7 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Unterlisten einbeziehen",
"selectRelationItems": "Verknüpfte Einträge auswählen",
"filterOperatorContainsAnyItem": "Enthält eines",
"filterOperatorDoesNotContainAnyItem": "Enthält keines",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index 3619b05ac5..c2d7c1de46 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Include sublists",
"selectRelationItems": "Select entries",
"filterOperatorContainsAnyItem": "Contains any item",
"filterOperatorDoesNotContainAnyItem": "Does not contain any item",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 35e52cbbd1..7413cf184c 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Incluir sublistas",
"selectRelationItems": "Seleccionar elementos relacionados",
"filterOperatorContainsAnyItem": "Contiene cualquiera",
"filterOperatorDoesNotContainAnyItem": "No contiene ninguno",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 3fc1075f2c..9754afe11f 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Inclure les sous-listes",
"selectRelationItems": "Sélectionner des éléments liés",
"filterOperatorContainsAnyItem": "Contient au moins un élément",
"filterOperatorDoesNotContainAnyItem": "Ne contient aucun élément",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index 18398e40e9..0ea8c6225f 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "כלול רשימות משנה",
"selectRelationItems": "בחירת פריטים מקושרים",
"filterOperatorContainsAnyItem": "מכיל פריט כלשהו",
"filterOperatorDoesNotContainAnyItem": "אינו מכיל אף פריט",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index 0ced304d08..b2c3f8f8f7 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "उपसूचियां शामिल करें",
"selectRelationItems": "संबंधित आइटम चुनें",
"filterOperatorContainsAnyItem": "किसी भी आइटम को शामिल करता है",
"filterOperatorDoesNotContainAnyItem": "किसी भी आइटम को शामिल नहीं करता",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 855d0f1cc1..582fe1b056 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Sertakan subdaftar",
"selectRelationItems": "Pilih item terkait",
"filterOperatorContainsAnyItem": "Berisi salah satu item",
"filterOperatorDoesNotContainAnyItem": "Tidak berisi item apa pun",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 55c0fc6eec..0cc1bb4f0a 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Includi sottoliste",
"selectRelationItems": "Seleziona elementi collegati",
"filterOperatorContainsAnyItem": "Contiene almeno un elemento",
"filterOperatorDoesNotContainAnyItem": "Non contiene alcun elemento",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index b93bc3db3b..3679943ccb 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "サブリストを含める",
"selectRelationItems": "関連項目を選択",
"filterOperatorContainsAnyItem": "いずれかを含む",
"filterOperatorDoesNotContainAnyItem": "いずれも含まない",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index f5ba6fc589..2f1fa027a1 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "하위 목록 포함",
"selectRelationItems": "연결 항목 선택",
"filterOperatorContainsAnyItem": "항목 중 하나 포함",
"filterOperatorDoesNotContainAnyItem": "어떤 항목도 포함하지 않음",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index d88e42de66..92f0ff0a22 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Sublijsten opnemen",
"selectRelationItems": "Gerelateerde items selecteren",
"filterOperatorContainsAnyItem": "Bevat een van de items",
"filterOperatorDoesNotContainAnyItem": "Bevat geen van de items",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 076f24fd57..a65e33af30 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Uwzględnij podlisty",
"selectRelationItems": "Wybierz powiązane elementy",
"filterOperatorContainsAnyItem": "Zawiera dowolny element",
"filterOperatorDoesNotContainAnyItem": "Nie zawiera żadnego elementu",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 869d962228..c51520e1cf 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Incluir sublistas",
"selectRelationItems": "Selecionar itens relacionados",
"filterOperatorContainsAnyItem": "Contém qualquer item",
"filterOperatorDoesNotContainAnyItem": "Não contém nenhum item",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index ea24454755..4d56317b49 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Включить вложенные списки",
"selectRelationItems": "Выбрать связанные элементы",
"filterOperatorContainsAnyItem": "Содержит любой элемент",
"filterOperatorDoesNotContainAnyItem": "Не содержит ни одного элемента",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 9fa7176113..03e4fd8fc8 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Zahrnúť vnorené zoznamy",
"selectRelationItems": "Vybrať súvisiace položky",
"filterOperatorContainsAnyItem": "Obsahuje ľubovoľnú položku",
"filterOperatorDoesNotContainAnyItem": "Neobsahuje žiadnu položku",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 0a2cb02a0d..4f80f25b2c 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "รวมรายการย่อย",
"selectRelationItems": "เลือกรายการที่เชื่อมโยง",
"filterOperatorContainsAnyItem": "มีรายการใดรายการหนึ่ง",
"filterOperatorDoesNotContainAnyItem": "ไม่มีรายการใดเลย",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index f93a815e0f..00b9ae4b75 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Alt listeleri dahil et",
"selectRelationItems": "İlişkili öğeleri seç",
"filterOperatorContainsAnyItem": "Herhangi bir öğeyi içerir",
"filterOperatorDoesNotContainAnyItem": "Hiçbir öğeyi içermez",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 6ae98347ea..deb66c96e1 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "Включити вкладені списки",
"selectRelationItems": "Вибрати пов’язані елементи",
"filterOperatorContainsAnyItem": "Містить будь-який елемент",
"filterOperatorDoesNotContainAnyItem": "Не містить жодного елемента",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index b697ae5be4..9896788154 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "包括子列表",
"selectRelationItems": "选择条目",
"filterOperatorContainsAnyItem": "包含任一",
"filterOperatorDoesNotContainAnyItem": "不包含任一",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 4d1df05209..de62a08687 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,5 @@
{
+ "includeSublists": "包括子清單",
"selectRelationItems": "選擇項目",
"filterOperatorContainsAnyItem": "包含任一項",
"filterOperatorDoesNotContainAnyItem": "不包含任一項",
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 2075090cbb..ecba8b4116 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -1460,7 +1460,7 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
protyle,
nodeElement,
- type: "CancelListRecursively"
+ type: "CancelList"
}));
turnIntoSubmenu.push(this.turnsIntoOne({
menuId: "quote",
@@ -1479,7 +1479,17 @@ export class Gutter {
selectsElement: [nodeElement],
type: "Blocks2Callout"
}));
- if (nodeElement.getAttribute("data-subtype") === "o") {
+ const listSubtype = nodeElement.getAttribute("data-subtype");
+ const recursiveTurnIntoSubmenu: IMenu[] = [this.turnsOneInto({
+ menuId: "recursiveParagraph",
+ id,
+ icon: "iconParagraph",
+ label: window.siyuan.languages.paragraph,
+ protyle,
+ nodeElement,
+ type: "CancelListRecursively"
+ })];
+ if (listSubtype === "o") {
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "list",
id,
@@ -1488,8 +1498,7 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert.list.custom,
protyle,
nodeElement,
- type: "ConvertListType",
- targetListType: "u",
+ type: "OL2UL"
}));
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "check",
@@ -1499,10 +1508,29 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert.check.custom,
protyle,
nodeElement,
+ type: "UL2TL"
+ }));
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveList",
+ id,
+ icon: "iconList",
+ label: window.siyuan.languages.list,
+ protyle,
+ nodeElement,
type: "ConvertListType",
- targetListType: "t",
+ targetListType: "u"
}));
- } else if (nodeElement.getAttribute("data-subtype") === "t") {
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveCheck",
+ id,
+ icon: "iconCheck",
+ label: window.siyuan.languages.check,
+ protyle,
+ nodeElement,
+ type: "ConvertListType",
+ targetListType: "t"
+ }));
+ } else if (listSubtype === "t") {
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "list",
id,
@@ -1511,8 +1539,7 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert.list.custom,
protyle,
nodeElement,
- type: "ConvertListType",
- targetListType: "u",
+ type: "TL2UL"
}));
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "orderedList",
@@ -1522,8 +1549,27 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert["ordered-list"].custom,
protyle,
nodeElement,
+ type: "TL2OL"
+ }));
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveList",
+ id,
+ icon: "iconList",
+ label: window.siyuan.languages.list,
+ protyle,
+ nodeElement,
type: "ConvertListType",
- targetListType: "o",
+ targetListType: "u"
+ }));
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveOrderedList",
+ id,
+ icon: "iconOrderedList",
+ label: window.siyuan.languages["ordered-list"],
+ protyle,
+ nodeElement,
+ type: "ConvertListType",
+ targetListType: "o"
}));
} else {
turnIntoSubmenu.push(this.turnsOneInto({
@@ -1534,8 +1580,7 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert["ordered-list"].custom,
protyle,
nodeElement,
- type: "ConvertListType",
- targetListType: "o",
+ type: "UL2OL"
}));
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "check",
@@ -1545,10 +1590,36 @@ export class Gutter {
accelerator: window.siyuan.config.keymap.editor.insert.check.custom,
protyle,
nodeElement,
+ type: "OL2TL"
+ }));
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveOrderedList",
+ id,
+ icon: "iconOrderedList",
+ label: window.siyuan.languages["ordered-list"],
+ protyle,
+ nodeElement,
+ type: "ConvertListType",
+ targetListType: "o"
+ }));
+ recursiveTurnIntoSubmenu.push(this.turnsOneInto({
+ menuId: "recursiveCheck",
+ id,
+ icon: "iconCheck",
+ label: window.siyuan.languages.check,
+ protyle,
+ nodeElement,
type: "ConvertListType",
- targetListType: "t",
+ targetListType: "t"
}));
}
+ turnIntoSubmenu.push({
+ id: "includeSublists",
+ icon: "iconListItem",
+ label: window.siyuan.languages.includeSublists,
+ type: "submenu",
+ submenu: recursiveTurnIntoSubmenu
+ });
} else if (type === "NodeBlockquote" && allowStructuralMutation) {
turnIntoSubmenu.push(this.turnsOneInto({
menuId: "paragraph",
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index d818a852af..298f9e4b3e 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1466,7 +1466,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle,
nodeElement: selectsElement[0],
id: selectsElement[0].getAttribute("data-node-id"),
- type: "CancelListRecursively",
+ type: "CancelList",
});
} else if (type === "NodeBlockquote") {
turnsOneInto({
@@ -1705,24 +1705,21 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle,
nodeElement: selectsElement[0],
id,
- type: "ConvertListType",
- targetListType: isMatchCheck ? "t" : "u",
+ type: isMatchCheck ? "UL2TL" : "OL2UL",
});
} else if (subType === "t" && (isMatchList || isMatchOList)) {
turnsOneInto({
protyle,
nodeElement: selectsElement[0],
id,
- type: "ConvertListType",
- targetListType: isMatchList ? "u" : "o",
+ type: isMatchList ? "TL2UL" : "TL2OL",
});
} else if (subType === "u" && (isMatchCheck || isMatchOList)) {
turnsOneInto({
protyle,
nodeElement: selectsElement[0],
id,
- type: "ConvertListType",
- targetListType: isMatchCheck ? "t" : "o",
+ type: isMatchCheck ? "OL2TL" : "UL2OL",
});
}
} else {