-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"TypeError: Cannot read property 'unselectable' of null" thrown when working with CKEditor in integrations #4390
Comments
Based on browser console - null is at line: /~https://github.com/ckeditor/ckeditor4/blob/major/core/creators/themedui.js#L458 (so, exactly as @Dumluregn said). My current status:
|
It makes sense and explains why it fails in the frameworks - they usually do some magic during the component initialisation which often happens before the component is actually rendered. |
To be precise, in angular, the element is not hidden on not visible, but physically it's not in the document structure - that's why |
Alright! Note: Below angular sample is targeting After analyzing the test case from angular: https://stackblitz.com/edit/angular-issue-4390 I was able to create the same environment in plain CKEditor4: https://stackblitz.com/edit/js-yndfve DOM structure during editor creation in angular (with hidden editor element inside
Potentially I even have some solution idea which targets |
Fast fix approach in var id = '#' + this.spaceId( name );
var spaceElem = this.editor.container.findOne( id );
return spaceElem; So we are looking for space elements inside the editor container - no in the entire document as before. However... We have iframe element that contains editor data. It has full DOM tree structure, so e.g. Whenever unhide element with The same happens when the editor is initialized properly, then I hide it with So there is no editor data... Seems that |
Do you mean that the editor data is erased when Since this issue was also reproducible without |
Previously space elements were searched in the entire document. During editor container is safer scope for this: - we are expecting 'space' elements inside editor container anyway - #4390 - there could be situations when document is not available
Yes. Also, data bindings are gone. I create two editors bound to data with https://ckeditor.com/docs/ckeditor4/latest/guide/dev_angular.html#integration-with-ngmodel After hide & show the first one - I update data in the second one. The first editor shows no changes. |
Iframe reloading is caused by reattaching element. Angular use it, but it's more like expected behaviour... I tried set data manually and with onload event - but I'm crashing on
|
Previously space elements were searched in the entire document. During editor container is safer scope for this: - we are expecting 'space' elements inside editor container anyway - #4390 - there could be situations when document is not available
After research and a talk with @f1ames we decide to split this issue into two separate features:
|
Summary:
Lines 123 to 125 in 1aa2119
then ckeditor4/core/dom/document.js Lines 148 to 151 in 1aa2119
Since everything is detached - there is no proper There is no verification whenever space was correctly found, this line gives an error: ckeditor4/core/creators/themedui.js Line 458 in 5380706
Manually recreation involves dealing with different |
I found a related issue: ckeditor/ckeditor4-react#109 So it's no longer only a detached state issue... |
Just a friendly reminder for anyone trying to test the features in integrations - easy way of using the latest CKE4 major version is nightly build: https://nightly.ckeditor.com/latest/standard/ckeditor/ckeditor.js. |
I've pass However... Inside #4390 (comment)
So I'll investigate it now. |
When the editor is created with delay, I've updated ckeditor/ckeditor4-angular#190 description so that we should use |
Partially solvable with current ckeditor4 |
We have a root issue reported in Angular: ckeditor/ckeditor4-angular#114 and the CKE4 upstream is fixed. So I'd say this issue is solved, not blocked 🤔 WDYT @sculpt0r? |
@Dumluregn sounds reasonable :) |
Is there a chance to get this released as 4.16.2? We experience this issue quite often using the official Angular module for our application, so it would be nice to get rid of it (: |
Hello, unfortunately this is quite a big new feature and as such is going to be released as 4.17.0. If you want to test this feature earlier, you can use the nightly build temporarily: https://nightly.ckeditor.com/latest/standard/ckeditor/ckeditor.js (you can replace |
Hello, thanks for your answer! I could see that the milestones for 4.17 are completed. Can we support somehow to get this new feature rather sooner than later? |
Hi @ezintz Also, you can try to apply changes to your own CKE4 source code(see: #4390 (comment)). But it will be more convenient to wait for the official realease. |
Hi @sculpt0r, thanks for your answer! I am glad and happy that you want to have a stable and working version released - I really appreciate your work! 🙂 We just keep having this error in our logs and sometimes the users are blocked, so we are willing to help and try to contribute 😉, if there is a way. I may try the nightly builds with our application already, thank you. Thanks again for all your work! |
I'm running into this error while using Vue 2. Which details do you need from me to fully describe the problem? |
Type of report
Bug/Task/Feature?
Provide detailed reproduction steps (if any)
Demo was provided by one of users in Angular: ckeditor/ckeditor4-angular#114 (comment).
Expected result
Errors are not thrown.
Actual result
TypeError: Cannot read property 'unselectable' of null
error is thrown and CKEditor crashes.Other details
There is an error that occurs in various frameworks where you try to integrate CKEditor. It was reported in Drupal, Laravel and Angular and now I encountered it while testing ckeditor/ckeditor4-angular#143.
The issue is most probably caused by this line:
Although the issue wasn't reproduced in the CKEditor itself so far, I think it could be worth to at least take a look at it as it makes integrating it a bit more difficult than it should be. It's hard to classify the character of this issue, so it may need to be relabeled.
The text was updated successfully, but these errors were encountered: