Support undeletable anchor Step 3: Support anchor#2972
Merged
JiuqingSong merged 6 commits intomasterfrom Apr 3, 2025
Merged
Conversation
Contributor
|
Just curious, what happens if user with DevTools delete the element or with third party code the body of the editor is edited? Maybe just a corner case, but was curious what happens in that scenario |
BryanValverdeU
approved these changes
Apr 3, 2025
Collaborator
Author
Then we will lose those info. |
juliaroldi
added a commit
that referenced
this pull request
Apr 4, 2025
* Support undeletable anchor Step 1: Support hidden properties (#2970) * Support undeletable anchor Step 1: Support hidden properties * improve comments * Support undeletable anchor Step 2: Add undeletable property to link (#2971) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3: Support anchor (#2972) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3 * Find previously marked paragraph (#2975) * Support undeletable anchor Step 4: Prevent deleting undeletable anchor (#2973) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3 * Support undeletable anchor Step 4 * improve * add test * fix typo * bump version * fix version --------- Co-authored-by: Jiuqing Song <jisong@microsoft.com>
juliaroldi
added a commit
that referenced
this pull request
Apr 7, 2025
* Support undeletable anchor Step 1: Support hidden properties (#2970) * Support undeletable anchor Step 1: Support hidden properties * improve comments * Support undeletable anchor Step 2: Add undeletable property to link (#2971) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3: Support anchor (#2972) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3 * Find previously marked paragraph (#2975) * Support undeletable anchor Step 4: Prevent deleting undeletable anchor (#2973) * Support undeletable anchor Step 1: Support hidden properties * Support undeletable anchor step 2 * improve comments * Support undeletable anchor Step 3 * Support undeletable anchor Step 4 * improve * add test * fix typo * Do not enable paragraph map by default (#2978) * Check selection for empty anchor (#2979) Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com> * fix test --------- Co-authored-by: Jiuqing Song <jisong@microsoft.com>
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.
This is the first step to support undeletable anchor.
The final goal is to allow adding anchor such as and specify what kind of anchor is not deletable, then all editing function will not delete it.
In this PR I'm adding support to anchor -- an
<A>element with name but no href.In order to support anchor, we need to let element parser recognize A element that has no href, also need to support empty anchor: A element without child. When that happens, add an empty text segment as the holder of anchor.
We also need to modify some utility functions such as
normalizeParagraphandisSegmentEmptyto let them keep those empty text segment which has anchor link.