ckeditor / ckeditor4-vue

Official CKEditor 4 Vue component
Other
74 stars 16 forks source link

Input event is not emitted when the value changes to its initial value (value props) #145

Open HundredBeans opened 2 years ago

HundredBeans commented 2 years ago

Are you reporting a feature request or a bug?

Bug

Provide detailed reproduction steps (if any)

This issue/bug only happens when using the one-way binding using value props

  1. Set initial value to anything and pass it to the editor as value props. E.g: empty string ('')
  2. Add a method to handle the emitted input event to see if the input event is emitted
  3. Write something to the editor, and then change the editor to its initial value. E.g: If the initial value is an empty string, try to select all and delete the content inside the editor

Codesandbox link: https://codesandbox.io/s/ckeditor4-vue-bug-report-forked-khff87?file=/src/App.vue

Expected result

The input event should be emitted when there are changes in the editor

Actual result

The input event is not emitted when the editor content is equal to the passed value props

Other details

I saw in the code that the input event is only emitted when the change is not equal to the value props. https://github.com/ckeditor/ckeditor4-vue/blob/master/src/ckeditor.js#L145-L153 I guess that's the root cause. It is fine if the user is using two-way binding because the value is always changing.

KarolDawidziuk commented 2 years ago

Hi @HundredBeans and thank you for the report.

I can confirm this issue.