ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.48k forks source link

widgetRepository.instanceInserted() or widget.inserted() event #4516

Open voborl00 opened 3 years ago

voborl00 commented 3 years ago

Type of report

Feature request

Provide description of the new feature

I cannot find a way how to distinguish between newly inserted widget (based on paste or insertHtml) and already existing widget, because every existing event is called same way for both "states" of them.

What I've tried:

So if there would be some widgetRepository.instanceInserted() or widget.inserted() event which is called only when widget is html-inserted, pasted, and so on (and only if - to filter out ckeditor page reload, ckeditor source/wysiwyg mode switch and so on) it would be perfect. Also should not be so much work to do, just few lines in right widget processing moment ;-)

Or there is some other way/workaround?

By the way, what I want to achieve is, when user inserts/pastes some html fragment with widget to do some processing, like open it's dialog for example. Now with existing events all (or none) existing widget's dialog are opened.

Thank you very much

voborl00 commented 3 years ago

widgetRepository.checkWidgets looks like being called even when there are no widget in pasted/inserted html code, so depending on it and guessing last widget instance from widget repository seems NOGO also

voborl00 commented 3 years ago

As I am in time pressure (and no dialog opening is not an option), could you please provide some workaround with existing events/methods/properties to be able to pop up edit dialog window just for newly inserted widgets? Thank you