angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

Passing a call back function save_onsavecallback is not triggered when save button is clicked #260

Open davidsekar opened 8 years ago

davidsekar commented 8 years ago

I'm trying to set callback save_onsavecallback for the save plugin. But it looks like it is not at all registered as a callback through the init options.

I expected to see $scope is not defined or some error. but It did nothing. There is something else that I'm missing while sending the callback function,

I have posted a query in SO if someone has done similar thing with the save plugin http://stackoverflow.com/questions/37512082/angular-directive-how-to-trigger-a-save-method-in-the-controller-whentinymce-s

Kindly let me know if you want me to share some additional code snippet

lucasgranberg commented 8 years ago

Do you have the save plugin enabled? I don't think it is by default.

davidsekar commented 8 years ago

Yes I'm pretty sure. That I have included "save" plugin in the list of plugins and the Save icon appeared in the toolbar as expected. but the callback method isn't triggered as expected.

may be I will create a plunker for submitting over here for investigation

davidsekar commented 8 years ago

Here is the sample setup, how i use in my project. https://plnkr.co/edit/tFCIqWTet7009kvPVdln?p=preview

davidsekar commented 8 years ago

This seems to be the issue : when save_enablewhendirty is set as true (default), the callback is not trigged at all. When this option is set to false. Everything seems to work fine. (A StackOverflow user has identified that it is working when set to false. Never occurred to me, as i just didn't want to modify the default value )

Cause : Even though the content with TinyMCE is changed. It says that the control is still untouched. ng-untouched ng-valid ng-not-empty ng-dirty ng-valid-parse

ershwetabansal commented 7 years ago

Hey Dan, I was facing the same issue with ui-tinymce where save callback is not getting called. I have created a PR along with tests to fix the issue. Could you please check the same and merge it if you find it okay.