-
Notifications
You must be signed in to change notification settings - Fork 167
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
Fix crash when enabling Watermark plugin #1221
Conversation
Do you know why the original way not work? |
Although the change may fix the issue, but I'm afraid it also hides the real root cause. |
Fun debugging session 😄 constructor(private contentDiv: HTMLDivElement, options?: EditorOptions) { //this.contentDiv gets assigned
super(contentDiv, options); //Editor gets initialized
this.getDarkColor = options?.getDarkColor; //then this, all built
} In reality the Conveniently, none of this happens if we have content in the editor: } else if (!hasFocus && !isShowing && this.editor.isEmpty()) {
insertEntity( |
I tried and I can repro. So it seems the problem is in ContentModel side pane plugin only. In that case, we can just to a null check in that plugin and if content DIV is not ready yet, just skip creating content model. We'd like to hide the detail of editor as much as possible. |
This reverts commit fdafaa1.
…crosoft/roosterjs into u/ianeli/fix-watermark-toggle
Steps to repro:
domToContentModel gets called with an
undefined
root, causing a crash.Instead of using the experimental editor's contentDiv, we can access the editor core's directly, which seems to fix the problem.