每个人。我想找出使用angular js实现为ck编辑器更新语言的可能解决方案,现在仅当我使用$ state.reload完全刷新页面时,语言才会更改。但是不知何故,它可能应该...任何想法都得到赞赏
link: function ($scope, element, attrs, ngModel) {
var config = {
language: $translate.preferredLanguage()
};
CKEDITOR.timestamp = (new Date()).valueOf();
if (angular.isDefined(attrs.maxTextLength) && angular.isFunction($scope.maxTextLength) && $scope.maxTextLength() > 0) {
config.wordcount = {
showCharCount: true,
showParagraphs: false,
showWordCount: false,
maxCharCount: $scope.maxTextLength(),
countSpacesAsChars: true
};
}
config.removePlugins = 'elementspath';
config.disallowedContent = 'span{font,font-size,font-family}';
let ck = CKEDITOR.replace(element[0], config);
$rootScope.$on('$translateChangeSuccess', function(event, args) {
// it catches that translations has been updated, but contents are not gettin traslated
console.log(CKEDITOR.instances) // shows empty object :(
config.language = 'nl';
CKEDITOR.replace(element[0], config);
});