CKEditor config doesn't change text to right-to-left

3k views Asked by At

I have edited config.js to

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

But I still get the editor to be left-to-right in my Question2Answer platform. What should I do else to make my editor right-to-left?

1

There are 1 answers

4
Bhalchandra K On BEST ANSWER

Following HTML and Script worked for me, instead of using the global configuration file for application i used inline configuration as below -

HTML

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

Script

<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>