config.js 3.62 KB
/**
 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

CKEDITOR.plugins.add('artecode', {
    init: function (editor) {
        editor.addCommand('insertJS', {
            exec: function (editor) {
                editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-javascript">Amazing Js code</code></pre>');
            }
        });
        editor.ui.addButton('insertJS', {
            label: 'Wstaw JS',
            command: 'insertJS',
            icon: this.path + 'js.png'
        });

        editor.addCommand('insertHTML', {
            exec: function (editor) {
                editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-twig">Amazing HTML5/TWIG code</code></pre>');
            }
        });
        editor.ui.addButton('insertHTML', {
            label: 'Wstaw HTML',
            command: 'insertHTML',
            icon: this.path + 'html5.png'
        });

        editor.addCommand('insertCSS', {
            exec: function (editor) {
                editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-less">Amazing CSS3/LESS code</code></pre>');
            }
        });
        editor.ui.addButton('insertCSS', {
            label: 'Wstaw CSS3',
            command: 'insertCSS',
            icon: this.path + 'css3.png'
        });

        editor.addCommand('insertBash', {
            exec: function (editor) {
                editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-bash">Amazing Bash code</code></pre>');
            }
        });
        editor.ui.addButton('insertBash', {
            label: 'Wstaw Bash',
            command: 'insertBash',
            icon: this.path + 'bash.png'
        });

        editor.addCommand('insertPhp', {
            exec: function (editor) {
                editor.insertHtml('<p><br/></p><pre><code class="line-numbers language-php">Amazing PHP7 code</code></pre>');
            }
        });
        editor.ui.addButton('insertPhp', {
            label: 'Wstaw PHP',
            command: 'insertPhp',
            icon: this.path + 'php7.png'
        });
    }
});


CKEDITOR.editorConfig = function (config) {
    config.extraPlugins = 'artecode';

    config.toolbar = [
        {name: 'document', groups: ['mode', 'document', 'doctools', 'clipboard', 'undo'], items: ['Source', '-', 'Save', '-', 'Templates', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
        {name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
        {name: 'artecode', items: ['insertPhp', 'insertHTML', 'insertJS', 'insertCSS', 'insertBash']},
        {name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},
        {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']},
        {name: 'links', items: ['Link', 'Unlink', 'Anchor']},
        {name: 'styles', items: ['Format', 'Font', 'FontSize']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'editing', groups: ['find', 'selection', 'spellchecker'], items: ['Replace']},
        {name: 'tools', items: ['Maximize', 'ShowBlocks']},
        {name: 'others', items: ['-']},
        {name: 'about', items: ['About']}
    ];
    config.disableNativeSpellChecker = false;
};