-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
The editor doesn't work with zone.js (and hence Angular) #413
Comments
Just discovered that the problem is probably not related to Angular but Zone.js. Instead of trying to implement ckeditor in an angular2 app, I try the other way around. So, I started from the working minimum working project of ckeditor5 with webpack and I just added this package:
Then, I added the following line in my main file:
Then I get the error:
The message is slightly different but I think that the root cause is the same, so it seems that the incompatibility is with Zone and not Angular. I will try to dig a bit deeper but I'm pretty sure that this exceeds my skills :p EDIT After some searches, it looks like the "issue" (between quotes because I'm really not sure it really is an issue ^^) comes from the function
And the editor suddenly showed up, although it does not work correctly (the bold function does not work, hitting Ctrl + B put the caret at the beginning, etc...). I also put a:
Just before this condition and everytime the next line works (so the condition),
However, when it fails, it does not contain an object as such but an HTML element, for example:
So it would look like the issue comes from the fact that an event is bound to an HTML element (that maybe is not yet on the page? Or in the shadow DOM?). Once again, I'm far from an expert, so maybe the issue is not in ckeditor but in Zone. I leave you, experts, the call :p EDIT II - He's back Hi, me again :-D I'm still investigating and I ended up in the function
By
And poof, everything works... Of course, I changed the behaviour of the method, this was just a test, but I'll check what |
Hi, here is the conclusion of my search (the final chapter of the lovely little story above). I'm not 100% sure but if I'm not wrong, ZoneJs overrides some function like Therefore, when
This returned me:
While doing this in a simple HTML page (without ZoneJS) returned me:
Off the top of my head, the solution would consist in having a white list of all method overriden by ZoneJs and checking this first in I'll have a look at that tomorrow, altough, I'm wondering... Is it up to ckeditor to be compatible with ZoneJs or the other way around? I feel that it's the former, but I'm not 100% sure... On step further would be to know if lodash should be compatible with ZoneJs or not (as I just saw that |
First of all – the award of the hero of the month goes to you! 🥇 🍾 You saved us a lot of time and trouble! Huge thanks! So, I don't like what zone.js did. It's a bad practice to modify native prototypes – it's asking for troubles. We'd never do that and I think no library should touch objects it doesn't own. Especially... if it's such a low-level library like zone.js because then the impact is so wide and unpredictable that it just gives me creeps ;/ Anyway, there are two options – either zone.js fixes this or we do. From a puristic POV I'd say that it should be zone.js. It's very unlikely that they'll stop changing the native prototypes, so at least they could fix the However, we could also consider changing our current "is native node" check. I like the current one, but we could figure something more generic (like you proposed). After all, we would never name any of our methods "addEventListener" :D. So, I'd propose first to ask zone.js's team to fix it on their side and wait for a reply. Thank you again for looking into this. |
Alright, I'll create an issue in the zone repo and I'll keep you up to date ;-) |
Hi, just good a feedback and they will make isNative return |
Yeah, I've seen it – angular/zone.js#666. And it's a perfect issue number for such a bug :D Thanks! |
Thought exactly the same ;-) I'll follow the release of zone.js and then I'll come back here to post if they really solved the issue or not. I guess you can close this issue. Thanks |
This issue can be closed as the version 0.8.4 of zone.js solves it. Thanks ;-) |
FWIW, I've updated to the latest zone.js and still get this error. |
This is sad ;/ Could you check whether this is a problem with |
It's now about two weeks later, I never went back to look at this issue, but it is magically working. |
Better this than when things magically break :D. Thanks for the info! |
Just noting here for anyone stumbling upon this that is indeed not fixed even with the current zone.js version |
Hi,
I'm currently trying to use ckeditor5 within an angular2 application and... I'm struggling a bit. I can create two different applications (one via the bare minimum for angular2 and the other via the bare minimum for ckeditor5), but when I merge them, it does not work anymore.
First of, here are the main pieces of the application. Let's start with the webpack configuration file:
This configuration is a merge between https://github.com/CKEditor5/ckeditor5.github.io/blob/master/webpack.config.js and https://angular.io/docs/ts/latest/guide/webpack.html. However, I moved the reference to "regenerator-runtime/runtime" in a vendor.ts file:
For the rest, my component is very simple and is composed of the ts file:
And the template:
The result of this is the following error:
The stack trace is actually way longer than that because of zonejs. As I realise that it is pretty difficult to help me like this, here is the code of this app : ng2.zip. Just run
npm run build
and then start a simple http server in the "dist" folder.The text was updated successfully, but these errors were encountered: