refactor(painter-dom): unify footnote/endnote story detection (SD-2838)#3383
Open
luccas-harbour wants to merge 5 commits into
Conversation
Move the footnote/endnote story-block detection out of renderer.ts into a dedicated notes/story.ts module with explicit kind discrimination, and add unit tests covering both the helper and the painter read-only side effect.
Wrap the painter read-only contenteditable assignment into applyNoteStoryFrameAttributes so the two fragment-frame call sites share one helper, and move its coverage into a focused test alongside the new module.
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.
Summary
Consolidates the footnote/endnote story-block-id checks that were previously duplicated between the DOM painter and the super-editor's body DOM index. This is a pure refactor — no behavioral changes — and continues the SD-2838 effort to unify rendering helpers.
painters/dom/src/notes/story.ts:getNoteStoryKind(blockId)— classifies a block id asfootnote/endnote/semantic-footnote/semantic-endnote.isNonBodyStoryBlockId(blockId)— boolean shortcut used by the renderer's position-mapping guard and by the editor's DOM index exclusion.shouldApplyPlainFootnotePainterReadOnly(blockId)— encodes the existing rule that only plainfootnote-*frames getcontenteditable="false"at the painter layer (endnotes and semantic notes have dedicated editing sessions).notes/frame.ts(applyNoteStoryFrameAttributes) and routes bothpaintpaths inrenderer.tsthrough it.isNonBodyStoryBlockIdfrom@superdoc/painter-domand replaces the duplicated prefix list insuper-editor/.../DomPositionIndex.tswith a single call.DomPositionIndexexclusion test withit.eachover all four block-id variants so the unified rule is exercised everywhere.notes/story.tsandnotes/frame.tshelpers, plus a smoke test thatisNonBodyStoryBlockIdis re-exported from the painter-dom entry point.