Skip to content

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

:art: Move heading conversions below other block types https://github.com/siyuan-note/siyuan/issues/19159

Danielc21799d4cf58
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 09cd3faa8b..51abfc2ef0 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -623,6 +623,16 @@ test("callout presets stay aligned across block menu scopes", () => {
});
});
+test("heading conversions follow list conversions across block menu scopes", () => {
+ const headingKeys = ["heading1", "heading2", "heading3", "heading4", "heading5", "heading6"];
+ ["gutter.single.turnInto", "gutter.multi.turnInto"].forEach((path) => {
+ const keys = getEntryCatalogChildren(path).map(item => item.key);
+ const headingIndex = keys.indexOf("heading1");
+ assert.equal(headingIndex, keys.indexOf("check") + 1);
+ assert.deepEqual(keys.slice(headingIndex, headingIndex + headingKeys.length), headingKeys);
+ });
+});
+
test("tab conversion belongs to the single block conversion menu", () => {
const keys = getEntryCatalogChildren("gutter.single.turnInto").map(item => item.key);
assert.equal(keys[keys.indexOf("tabs") - 1], "calloutCustom");
@@ -630,7 +640,7 @@ test("tab conversion belongs to the single block conversion menu", () => {
assert.equal(getEntryCatalogNode("gutter.single.turnInto.tabs")?.simple, true);
assert.equal(getEntryCatalogNode("gutter.single.turnInto.tabs")?.type, "entry");
assert.equal(getEntryCatalogNode("gutter.multi.turnInto.tabs"), undefined);
- assert.equal(keys[keys.indexOf("superBlock") - 1], "check");
+ assert.equal(keys[keys.indexOf("superBlock") - 1], "heading6");
assert.equal(keys[keys.indexOf("superBlock") + 1], "code");
assert.equal(getEntryCatalogNode("gutter.single.turnInto.superBlock")?.simple, true);
assert.equal(getEntryCatalogNode("gutter.single.turnInto.superBlock")?.type, "entry");
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index c6ec94ce43..728e74dd60 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -203,12 +203,6 @@ const gutterCopyChildren = (includeCopyAsPNG = false) => [
const gutterTurnInto = (multi: boolean) => node("turnInto", lang("turnInto"), true, [
node("paragraph", lang("paragraph")),
- node("heading1", lang("heading1")),
- node("heading2", lang("heading2")),
- node("heading3", lang("heading3")),
- node("heading4", lang("heading4")),
- node("heading5", lang("heading5")),
- node("heading6", lang("heading6")),
node("quote", lang("quote")),
node("callout", lang("callout")),
node("calloutNote", location(lang("callout"), literal("Note"))),
@@ -221,6 +215,12 @@ const gutterTurnInto = (multi: boolean) => node("turnInto", lang("turnInto"), tr
node("list", lang("list")),
node("orderedList", lang("ordered-list")),
node("check", lang("check")),
+ node("heading1", lang("heading1")),
+ node("heading2", lang("heading2")),
+ node("heading3", lang("heading3")),
+ node("heading4", lang("heading4")),
+ node("heading5", lang("heading5")),
+ node("heading6", lang("heading6")),
...(!multi ? [node("superBlock", lang("superBlock"))] : []),
node("code", lang("code")),
node("table", lang("table")),