Content Model: Handle Delete and Backspace#1660
Merged
Merged
Conversation
JiuqingSong
requested review from
Andres-CT98,
BryanValverdeU,
flyingbee2012,
ianeli1 and
juliaroldi
March 24, 2023 18:39
JiuqingSong
marked this pull request as ready for review
March 24, 2023 18:39
This was referenced Mar 27, 2023
BryanValverdeU
approved these changes
Mar 28, 2023
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 part of Content Model Stage 3: Handle Delete and Backspace keydown event with Content Model.
This is the first step. In this change, I separate existing
deleteSelectionAPI into 3 steps:forward(for DELETE key) orbackward(for BACKSPACE key)), get the sibling content and delete it. This can be several different cases:2.1 There is text segment, we only delete one character
2.2 There is other type of segments such as image, br, we delete the whole segment
2.3 There is no segment in the same paragraph, then we will look for sibling block, and if there are blocks such as table, divider, ..., delete the whole block
During this process, if there are entities got impacted, we will trigger EntityOperation event so that plugins know entity will be deleted.
There are still some known issues that need to be solved by further changes, such as
PREtag when Content Model is cached, need to fix it separately. (Content Model: PRE tag is incorrectly cached #1661)And since there are still these known issues, this new behavior is not enabled by default. To test it, need to manually turn on plugin
ContentModelEditPlugin: