tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
320 stars 92 forks source link

fix: ensure form control value updates on paste by adding 'paste' to default modelEvents #365

Closed danielsefton closed 2 months ago

danielsefton commented 8 months ago

Since the paste plugin is now built-in to TinyMCE core, I believe this should be a default value in modelEvents. Otherwise it causes a lot of confusion as to why the angular form validation fails and prevents submission when pasting content into the editor.

spocke commented 6 months ago

Do you have a replication case where a paste wouldn't update the model since the change event should fire on paste so not sure this event is needed. Could you setup a codepen or codesandbox where this issue can be reproduced. Thanks

danielsefton commented 5 months ago

At the moment I don't have much time to put together a reproducable example, so it's take it or leave it really.

It makes no sense to me that you say it should fire on paste by default. Why would it fire on paste if it's not added to modelEvents? Why have paste as an option for modelEvents in the first place? All I know is that unless I added that to modelEvents the paste event did not fire and caused a lot of confusion.

danoaky-tiny commented 3 months ago

The form validation storybook seems to show that paste events trigger form changes.

danoaky-tiny commented 2 months ago

I'm closing this PR as per my previous comment seems to be true.

@danielsefton Feel free to comment here if the problem persists or if you have a replication case. Also, to explain why there is a separate paste event: there may be a case where you may not want all events that encompass the default change event (which includes paste).