如何更改语言angular js ck编辑器

时间:2020-11-04 12:42:26

标签: angularjs ckeditor multilingual

每个人。我想找出使用​​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);
    });

0 个答案:

没有答案