Preserve ordered list numbering offsets across load and save#1112
Open
zoltanhosszu wants to merge 3 commits into
Open
Preserve ordered list numbering offsets across load and save#1112zoltanhosszu wants to merge 3 commits into
zoltanhosszu wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Any list not starting at 1 lost its offset on the next edit, snapping back to 1, 2, 3. Allow `start` on <ol> through both sanitizers, so content persisted while start was being stripped recovers its numbering instead of staying broken. The repair runs in the editor element's `$generateNodesFromDOM` funnel, covering initial value load and paste alike.
6169736 to
dab2f42
Compare
Remove unused numbered_list fixtures Navigate to the editor page before setting the test value Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0352c0a to
5772df8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Loading an editor with a list that doesn't start at 1 snaps the numbering back to 1:
After load, the items render as 1, 2 — and saving persists the loss.
Root cause
Lexical numbers ordered lists from the
startattribute on<ol>and ignores thevalueattributes on<li>when importing ($convertListItemElementnever reads them; aListNodetransform renumbers items sequentially from the list's start).valueis only written on export, for display fidelity.Lexxy's sanitizers kept the cosmetic attribute and stripped the semantic one:
valueon<li>was allowlisted on both sides, butstarton<ol>was stripped by DOMPurify when computing the form value and by Loofah when saving through Action Text. So any list with an offset lost it on the next edit — leaving exactly the HTML above in the database.Fix
starton<ol>through DOMPurify (client) and Loofah (server), so the bug is fixed going forward.