fix(open-knowledge): generalize clipboard open-depth guard (#2778)#734
Merged
Conversation
* wip: claim clipboard open-depth guard generalization * fix(open-knowledge): generalize clipboard open-depth guard beyond tables A partial text selection inside any marker-bearing block (blockquote, heading, list item, task item, code block, footnote definition) copied the block's markdown syntax because sliceToDocJson discards slice open depths. PR #2724 fixed the table-cell instance; this generalizes its strip loop into stripEnclosingMarkerWrappers, keyed off the live selection: table wrappers and textblocks peel unconditionally, other marker-bearing wrappers peel only while the selection covers a strict subset of their text, and a fully covered list item keeps its list carrier so the list-sibling paste splice payload is preserved. The text/html markdown tier now re-derives the original slice from the selection (PM hands it a context-unwrapped fragment with the depths gone) and applies the same strip, so partial selections stop dumping full block elements into rich-paste targets. PM stamps data-pm-slice after we return, and new round-trip tests prove OK to OK paste of stripped payloads stays clean. New test file pins the class: interior selections for every marker-bearing block on text/plain (marks preserved), the html twin, whole-structure stay-green copies, and the paste round trip. * fix(open-knowledge): keep interior copy non-empty across multiple list items The generalized open-depth guard peels the enclosing list from a text selection that spans the interior of two or more list items, leaving a fragment of bare listItems. listItem is not valid top-level doc content, so sliceToDocJson failed to fill the doc and returned an empty clipboard string, dropping the copied text entirely (worse than the original leaked markers). Lift such children to their own block content in the fill-failure path so the interior text survives without list markers, matching the two-paragraph blockquote-span result. Author: Nick Gomez <122398915+nick-inkeep@users.noreply.github.com> * fix(open-knowledge): satisfy iterable-callback-return lint in lift helper GitOrigin-RevId: 2a0652196f7912592458b8e63bd083ff9f83c1b1
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.
Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.