JSFiddle - React, Tailwind, and code Playground
by Evan Sharp
HTML
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://ckeditor.com/apps/ckeditor/4.2/ckeditor.js"></script>
<script src="http://code.angularjs.org/1.1.5/angular.min.js"></script>
<div data-ng-app="app" data-ng-controller="myCtrl">
<h3>CKEditor 4.2:</h3>
<textarea data-ng-model="ckContent" data-ck-editor></textarea>
<br />
<textarea data-ng-model="ckContent" data-ck-editor></textarea>
<textarea data-ng-model="ckContent"></textarea>
<pre>{{ckContent}}</pre>
</div>
JavaScript
var app = angular.module('app', []);
app.directive('ckEditor', [function () {
return {
require: '?ngModel',
link: function ($scope, elm, attr, ngModel) {
var ck = CKEDITOR.replace(elm[0]);
ck.on('pasteState', function () {
$scope.$apply(function () {
ngModel.$setViewValue(ck.getData());
});
});
ngModel.$render = function (value) {
ck.setData(ngModel.$modelValue);
};
}
};
}])
function myCtrl($scope){
$scope.ckContent = 'test';
}