CKEditor配置不会将文本从右向左更改

时间:2013-12-24 12:50:21

标签: ckeditor right-to-left question2answer

我已将config.js编辑为

CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.language = 'ar';
    config.contentsLangDirection = 'rtl';
    contentsLanguage:'ar';
    config.dialog_buttonsOrder = 'rtl';
};

但我仍然让编辑器在我的Question2Answer平台上从左到右。我该怎么办才能让我的编辑从右到左?

1 个答案:

答案 0 :(得分:2)

以下HTML和脚本为我工作,而不是使用全局配置文件的应用程序我使用内联配置如下 -

<强> HTML

<textarea id="editor" name="editor1">&lt;p&gt;Initial value.&lt;/p&gt;</textarea>

<强>脚本

<script type="text/javascript">
        CKEDITOR.on('dialogDefinition', function (ev) {
            // Take the dialog name and its definition from the event data.
            var dialogName = ev.data.name;
            var dialogDefinition = ev.data.definition;
            // Check if the definition is from the dialog we're
            // interested in (the 'image' dialog).
            if (dialogName == 'image') {
                // Get a reference to the 'Image Info' tab.
                var infoTab = dialogDefinition.getContents('info');
                // Remove unnecessary widgets/elements from the 'Image Info' tab.
                infoTab.remove('browse');
                infoTab.remove('txtHSpace');
                infoTab.remove('txtVSpace');
                infoTab.remove('txtBorder');
                infoTab.remove('txtAlt');
                infoTab.remove('txtWidth');
                infoTab.remove('txtHeight');
                infoTab.remove('htmlPreview');
                infoTab.remove('cmbAlign');
                infoTab.remove('ratioLock');
            }
        });
        CKEDITOR.config.contentsLangDirection = 'rtl';
        CKEDITOR.replace('editor');
    </script>