How can I do it?
I managed to get the data in CKEditor using textarea
with the name
attribute corresponding to my model and a script
tag with ng:bind-template
to call CKEDITOR.replace
.
Then I created a CKEditor plugin that detects changes and writes them back to textarea
. The problem is that textarea
loses its event handlers when CKEditor is initialized, and CKEditor does not write changes to textarea
. It makes me think that I am approaching this wrong.
Next, I tried to use ng:eval-order="LAST" ng:eval="setupCKEditor()"
and configure the editor from the setupCKEditor()
function. This did not work, because even with ng:eval-order="LAST"
function still runs before the nodes are created.
I found that adding a setTimeout(function () {...},0)
around CKEDITOR.replace
helps. Now the only problem is that when you change the model, it does not redraw the screen until another field is edited.
scope.$root.$eval();
seems to fix this.
Update
We ended up abandoning this, since we could never get it to work reliably. We switched to TinyMCE with Angular-UI for a while , and then ended up creating something normal.
source share