Hi,
Im trying to use CKEditor with AngularJS for WYSIWYG editor with data-binding and everything seems to be working well. Extreme configurability helped a lot with our requirement matching.
We are now facing an issue with dirty form.
Problem:
model -> abc<br>def\n
ckeditor dataprocessor makes it -> abc<br />def
which breaks model & editor content equality and hence causes form to be dirty.
All i want is to set the model with preprocessed value after initialization so the equality stays.
Here is angular code for it:
app.directive('contenteditable', function() {
return {
require : 'ngModel',
link : function(scope, element, attrs, ctrl) {
var editor = CKEDITOR.inline(element[0]);
// view -> model
editor.on('pasteState', function() {
scope.$apply(function() {
ctrl.$setViewValue(editor.getData());
});
});
// model -> view
ctrl.$render = function() {
editor.setData(ctrl.$viewValue);
};
// load init value from DOM
ctrl.$render();
}
};
});
Did quiet a bit of searching but dint find anything apart from turning off the plugin wch obviously is not recomended. Any suggestions?
solved: http://stackoverflow.com/questions/17252422/inline-ckeditor-angularjs-dataprocessing