An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Simplify full-width heading number offsets https://github.com/siyuan-note/siyuan/issues/18704
Danielbcb0f31fc213
diff --git a/app/src/protyle/util/headingNumber.test.ts b/app/src/protyle/util/headingNumber.test.tsindex 888d3c1f58..368bc27fc6 100644--- a/app/src/protyle/util/headingNumber.test.ts+++ b/app/src/protyle/util/headingNumber.test.ts@@ -161,7 +161,8 @@ describe("renderHeadingNumbers", () => {assert.match(css, /data-node-id="heading"/);assert.match(css, /--b3-protyle-heading-number:"1\.1"/);assert.match(css, /data-node-id="heading"[^}]*calc\(12px \+ \.5em\)/);- assert.match(css, /data-node-id="chinese-heading"[^}]*calc\(24px \+ 0px\)/);+ assert.match(css, /data-node-id="chinese-heading"[^}]*heading-number-offset:24px/);+ assert.doesNotMatch(css, /calc\([^)]*\+ 0px\)/);assert.match(css, /padding-inline-start:var\(--b3-protyle-heading-number-offset\)/);assert.match(css, />:first-child\[contenteditable]::before/);assert.doesNotMatch(css, />\[contenteditable]/);diff --git a/app/src/protyle/util/headingNumberCore.ts b/app/src/protyle/util/headingNumberCore.tsindex 62c6cef145..6575063528 100644--- a/app/src/protyle/util/headingNumberCore.ts+++ b/app/src/protyle/util/headingNumberCore.ts@@ -113,10 +113,10 @@ export const buildHeadingNumberStyles = (scope: string, styles: IHeadingNumberSt"unicode-bidi:isolate;user-select:none;pointer-events:none;}",];styles.forEach(style => {- const spacing = headingNumberNeedsSpacing(style.number) ? ".5em" : "0px";+ const offset = headingNumberNeedsSpacing(style.number) ? `calc(${style.offset} + .5em)` : style.offset;rules.push(`${scopeSelector} [data-type="NodeHeading"][data-node-id="${escapeCSSString(style.id)}"]{` +`--b3-protyle-heading-number:"${escapeCSSString(style.number)}";` +- `--b3-protyle-heading-number-offset:calc(${style.offset} + ${spacing});}`);+ `--b3-protyle-heading-number-offset:${offset};}`);});return rules.join("");};