我有一个 CkEditor 指令。我只需要在指令中配置 ckeditor 工具栏,需要帮助...这是我的指令
.directive('fosCkEditor', ['$compile',
function($compile) {
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);
};
}
};
}
]);
最佳答案
为什么不使用ng-ckeditor?:
https://github.com/esvit/ng-ckeditor
来自 ng-ckeditor 文档:
<textarea ckeditor="editorOptions" ng-model="modelName"></textarea>
// add dependency
angular.module('app', ['ngCkeditor'])
// setup editor options
$scope.editorOptions = {
language: 'ru',
uiColor: '#000000'
};
关于javascript - 在 Angularjs 指令中配置 CkEditor 工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34873974/