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

#2855 Add a parameter for formatContentModel to allow auto detection of new/removed entities #2887

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

JiuqingSong
Copy link
Collaborator

Now we can let editor (EntityPlugin) to auto detect changed entity (added, removed) during formatContentModel.

To do this, set context.autoDetectChangedEntities to be true:

editor.formatContentModel((model, context)=>{
 ... // add or remove entities
 context.autoDetectChangedEntities = true;

 return true;
});

Then there will be code to search all changed entities and trigger entityOperation event for each of them.

But if possible, you can still use context.newEntities and context.deletedEntities to manually specify changed entities since they have better performance. Once autoDetectChangedEntities is set to true, context.newEntities and context.deletedEntities will be ignored.

@JiuqingSong JiuqingSong merged commit 2a249dd into master Nov 22, 2024
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/2855 branch November 22, 2024 18:51
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