Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Model cache improvement: Let Content model update cache for child list change #2613

Merged
merged 133 commits into from
Jun 12, 2024

Conversation

JiuqingSong
Copy link
Contributor

@JiuqingSong JiuqingSong commented May 2, 2024

As a part of cache improvement, when user type in a new line, browser will change the HTML from

<div><br></div>

into

<div>[Typed text]</div>

This will generate 3 mutations:

  1. Insert a new text node
  2. Remove original BR node
  3. Modify the text content to the typed content

In this change, I'm making TextMutationObserver and DomIndexer to be able to handle these changes without regenerating the whole content model. In general, it will first check if the mutations can be handled, then let domIndexer add/remove/modify existing content model to reflect these mutations:

  1. Insert a new text node => Create a new ContentModelText
  2. Remove original BR node => Remove existing ContentModelBr
  3. Modify the text content to the typed content => Update model text

Now with this change, in most normal editing operations, we don't need to regenerate content model. The remaining ones are move about entity. We will handle them later.

@JiuqingSong
Copy link
Contributor Author

#2510

@JiuqingSong JiuqingSong changed the title Perf step 2: Let Content model update cache for child list change Content Model cache improvement: Let Content model update cache for child list change Jun 10, 2024
@JiuqingSong JiuqingSong marked this pull request as ready for review June 10, 2024 23:13
@JiuqingSong JiuqingSong merged commit 00bb508 into master Jun 12, 2024
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/reconcilechildlist branch June 12, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants