ckeditor5-angular icon indicating copy to clipboard operation
ckeditor5-angular copied to clipboard

the [data]="text" property not updates if text variable was changed

Open IgorKurkov opened this issue 4 years ago • 7 comments

Hello guys. I noticed some interesting behavior with ckeditor5-angular. So regular template of the editor:

 <ckeditor
    [config]="config"
    [data]="text"
    [editor]="Editor"
    (change)="handleChange($event)"
  ></ckeditor>

if the text property was changed by @Input() after the config is set - so text can't be changed inside the editor anymore. For example: I set up the field. set the config. text is still undefined. Editor loads with no text inside. The @Input() receive variable text changes - and there some text already. But it isn't going forward to the <ckeditor> component. It does not affect this change of [data] unfortunately. As for me - it happened because change detection does not work as should inside component. BTW we could use ngModel,

 <ckeditor
    [config]="config"
    [(ngModel)]="text"
    [editor]="Editor"
    (change)="handleChange($event)"
  ></ckeditor>

and it will be automatically updated/bound/etc, but - the question is - is it a non-overengineering way for this case? or do we need to have the working DI there? Am I wrong?

IgorKurkov avatar Jun 29 '20 20:06 IgorKurkov

@ma2ciek, can you take a look at it?

Mgsy avatar Jul 06 '20 06:07 Mgsy

This is my question as well.

dashtaki avatar Jul 28 '20 13:07 dashtaki

Sorry guys for the late response, I'll take a look.

ma2ciek avatar Jul 29 '20 14:07 ma2ciek

any update on this

codejunction avatar Apr 14 '21 14:04 codejunction

has anyone solved this problem?

takarka avatar Jun 15 '21 11:06 takarka

This topic is quite large (detecting the input properties changes) and the data property is not the only one that can be changed runtime. I reported this issue in #264.

ma2ciek avatar Jun 30 '21 12:06 ma2ciek

Hi guys, soon 1 year anniversary of this case. Nothing special, but I think any dev meet this issue want to ask why so obvious bugs don't fix for so long time? there no problem with runtime, it's just about data binding. Anyway, hope you will resolve this issue sometime.

IgorKurkov avatar Jul 01 '21 09:07 IgorKurkov