angular-ui / ui-tinymce

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

reinit tinymce options cause of $scope value #219

Closed QuadroKnoX closed 8 years ago

QuadroKnoX commented 8 years ago

Hey guys I have a question or better a problem with the options: I have a textarea <textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea> which should refresh the option content_css after a click on the button with another value. I know you can't really refresh the options, just kill and reinit but when I tried tinyMCE.remove(); it is removing my textarea totally and then when I used $scope.tinymceOptions I can't reinit it, or am I just too confused?

Thx for any help :)

Quick fiddle-Sample what I mean: https://jsfiddle.net/QuadroKnoX/k6tacgwn/

deeg commented 8 years ago

Take a look at the demo included with the project for how to use it.

I am confused with your question. Looking at the fiddle, I don't even see ui-tinymce or tinymce included anywhere, is it?

Also why are you setting $scope.CSS to be the model of the first input? What is supposed to go in there?

I am going to close this ticket as I do not see a bug, but I can continue to help here if you have more questions.

QuadroKnoX commented 8 years ago

Well the problem is that I want to manually change the css path when I hit refresh, that it reloads the editor with the new path of the content_css, but when I use tinymce.remove(), it is removing the textarea and I dont know how to use the similar function of tinymce.init() in the angular version after that.

deeg commented 8 years ago

Can you try using the event '$tinymce:refresh'.

$scope.$emit('$tinymce:refresh');

This should refresh the editor and not remove it. Let me know how you make out.

QuadroKnoX commented 8 years ago

Thanks this did the job but I had to use: $scope.$broadcast('$tinymce:refresh'); Anways that did it, thanks a lot!

deeg commented 8 years ago

Ah yes, my fault, glad it is working for you now.