feat: proper ordered list cycling

This commit is contained in:
Steffen Becker committed 2026-07-05 11:51:07 +02:00
1 parent cc1e606d7a
commit e44f09ef42
14 files changed
+429 -91

No files matched your search

+16 -30
View File
@@ -377,44 +377,30 @@
margin-bottom: 0.212cm;
}
/* Ordered-list numbering styles (Toolbar split-button dropdown → orderedList
`listStyleType` attr, rendered as data-list-style). The dot variants reuse the
built-in counter styles (which already render with a trailing "."); the bracket
variants override the suffix via @counter-style … system: extends. `decimal`
needs no rule (the <ol> default already renders "1."). Keep in sync with
src/lib/editor/orderedListTypes.ts and export/odt.ts. */
/* Ordered-list numbering, keyed by data-eff-list-style — the effective numbering
orderedList.ts's plugin resolves per <ol> from its attr + ancestor chain. Dot
variants reuse the built-in counter styles; bracket variants override the suffix. */
@counter-style oledit-decimal-paren { system: extends decimal; suffix: ") "; }
@counter-style oledit-lower-alpha-paren { system: extends lower-alpha; suffix: ") "; }
@counter-style oledit-upper-alpha-paren { system: extends upper-alpha; suffix: ") "; }
@counter-style oledit-lower-roman-paren { system: extends lower-roman; suffix: ") "; }
@counter-style oledit-upper-roman-paren { system: extends upper-roman; suffix: ") "; }
.paper .tiptap ol[data-list-style="decimal"] { list-style-type: decimal; }
.paper .tiptap ol[data-list-style="decimal-paren"] { list-style-type: oledit-decimal-paren; }
.paper .tiptap ol[data-list-style="lower-alpha"] { list-style-type: lower-alpha; }
.paper .tiptap ol[data-list-style="lower-alpha-paren"] { list-style-type: oledit-lower-alpha-paren; }
.paper .tiptap ol[data-list-style="upper-alpha"] { list-style-type: upper-alpha; }
.paper .tiptap ol[data-list-style="upper-alpha-paren"] { list-style-type: oledit-upper-alpha-paren; }
.paper .tiptap ol[data-list-style="lower-roman"] { list-style-type: lower-roman; }
.paper .tiptap ol[data-list-style="lower-roman-paren"] { list-style-type: oledit-lower-roman-paren; }
.paper .tiptap ol[data-list-style="upper-roman"] { list-style-type: upper-roman; }
.paper .tiptap ol[data-list-style="upper-roman-paren"] { list-style-type: oledit-upper-roman-paren; }
/* Default numbering per nesting depth when no data-list-style is set — Word's
multilevel template 1. → a. → i., repeating (DEFAULT_ORDERED_CYCLE in
orderedListTypes.ts). Explicit attrs win via the higher-specificity rules above. */
.paper .tiptap ol { list-style-type: decimal; }
.paper .tiptap ol ol { list-style-type: lower-alpha; }
.paper .tiptap ol ol ol { list-style-type: lower-roman; }
.paper .tiptap ol ol ol ol { list-style-type: decimal; }
.paper .tiptap ol ol ol ol ol { list-style-type: lower-alpha; }
.paper .tiptap ol ol ol ol ol ol { list-style-type: lower-roman; }
.paper .tiptap ol[data-eff-list-style="decimal"] { list-style-type: decimal; }
.paper .tiptap ol[data-eff-list-style="decimal-paren"] { list-style-type: oledit-decimal-paren; }
.paper .tiptap ol[data-eff-list-style="lower-alpha"] { list-style-type: lower-alpha; }
.paper .tiptap ol[data-eff-list-style="lower-alpha-paren"] { list-style-type: oledit-lower-alpha-paren; }
.paper .tiptap ol[data-eff-list-style="upper-alpha"] { list-style-type: upper-alpha; }
.paper .tiptap ol[data-eff-list-style="upper-alpha-paren"] { list-style-type: oledit-upper-alpha-paren; }
.paper .tiptap ol[data-eff-list-style="lower-roman"] { list-style-type: lower-roman; }
.paper .tiptap ol[data-eff-list-style="lower-roman-paren"] { list-style-type: oledit-lower-roman-paren; }
.paper .tiptap ol[data-eff-list-style="upper-roman"] { list-style-type: upper-roman; }
.paper .tiptap ol[data-eff-list-style="upper-roman-paren"] { list-style-type: oledit-upper-roman-paren; }
/* Legal/outline numbering (1., 1.1., 1.2.1. …): the whole chain rendered via CSS
counters. Applies to the multilevel list and its attr-less nested ordered lists;
a nested explicit style breaks out via its own data-list-style rule. */
.paper .tiptap ol[data-list-style="multilevel"] > li::marker,
.paper .tiptap ol[data-list-style="multilevel"] ol:not([data-list-style]) > li::marker {
counters. The plugin tags the multilevel list and every attr-less member of its
chain with data-eff-list-style="multilevel". */
.paper .tiptap ol[data-eff-list-style="multilevel"] > li::marker {
content: counters(list-item, ".") ". ";
}