-
Notifications
You must be signed in to change notification settings - Fork 166
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 - Step 8: Finally enable readonly types in all format API #2651
Merged
Conversation
This file contains 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
JiuqingSong
requested review from
BryanValverdeU,
juliaroldi,
flyingbee2012,
ianeli1,
vinguyen12 and
Andres-CT98
May 31, 2024 19:35
BryanValverdeU
approved these changes
Jun 3, 2024
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.
Now all format API are using readonly types, we can finally enable the readonly type from root level.
This includes:
formatContentModel
, we provide aShallowMutableContentModelDocument
to callback instead of originalContentModelDocument
. Then if we need to do any modification to blocks under this model object, we need to usemutateBlock
to convert it to a mutable block. This is a breaking change. Ideally after this change we should bump the major version. However, given that we just bump to version 9 recently, I'll prefer keep current major version and later we can provide a document on how to fix the build failures when integrate the new version.experimentalFeatures
to allow pass in feature names.PersistCache
. When this feature name is passed intoEditorOptions.experimentalFeatures
, we will keep cached element in content model as long as we caniterateSelection
, do not delete cached element for selected blocks whenPersistCache
is enableddomIndexer
, do not delete cached element for current block whenPersistCache
is enabled. I also need to convert it to a class so that it can hold private membersIn order to let
iterateSelections
know ifPersistCache
is enabled, I did a workaround here to store this information in Content Model as a private member. So that we don't need to change the caller code everywhere. Once this feature is fully graduated, we can remove this private member.