summaryrefslogtreecommitdiffstats
path: root/editors/ckeditor_4_4/config.js
blob: c8c1289bccdbab5f562da479ee03533d54030cc8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/**
 * @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

//spremenljivka za ID elementa od txtUrl
var urlsrc = '';

// Url strani za embedd uploaderja
var site_url = $('#srv_site_url').val();

// Jezik za image uploader
var lang_code = 'sl';

CKEDITOR.editorConfig = function (config) {
    //config.language = 'sl';
    config.skin = 'moonocolor';

    lang_code = config.language;

    config.toolbar = [
        {name: 'document', items: ['Source', '-']},
        {name: 'clipboard', items: ['PasteText','RemoveFormat', 'Undo', 'Redo', 'Scayt']},
        {name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', 'Strike', '-']},
        {name: 'links', items: ['Link', 'Unlink', 'Image', 'SpecialChar']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
        {name: 'insert', items: ['CreateDiv', 'Flash', 'Table', 'IFrame', 'Youtube', 'Abbr']},
        {name: 'vec', items:['-', 'Styles', 'Format',  'FontSize', 'Font',  'Outdent', 'Indent', 'HorizontalRule']}
    ];

    config.toolbar_Full = [
        {name: 'document', items: ['Source', '-']},
        {name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', '-']},
        {name: 'links', items: ['Link']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'clipboard', items: ['Undo', 'Redo']},
        {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
        {name: 'insert', items: ['Table', 'Image', 'Youtube', 'Abbr']},
        {name: 'vec', items:['-', 'FontSize', 'Font', 'RemoveFormat', 'Strike', 'Unlink', 'Outdent', 'Indent', 'PasteText', 'PasteFromWord', 'HorizontalRule']}
    ];

    config.toolbar_Content = [
        {name: 'document', items: ['Source', '-']},
        {name: 'clipboard', items: ['PasteText','RemoveFormat', 'Undo', 'Redo', 'Scayt']},
        {name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', 'Strike', '-']},
        {name: 'links', items: ['Link', 'Unlink', 'Image', 'SpecialChar']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
        {name: 'insert', items: ['CreateDiv', 'Flash', 'Table', 'IFrame', 'Youtube', 'Abbr']},
        {name: 'vec', items:['-', 'Styles', 'Format', 'FontSize', 'Font',  'Outdent', 'Indent', 'HorizontalRule']}
    ];
    config.toolbar_Database = [
        {name: 'document', items: ['Source', '-']},
        {name: 'clipboard', items: ['PasteText','RemoveFormat', 'Undo', 'Redo', 'Scayt']},
        {name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', 'Strike', '-']},
        {name: 'links', items: ['Link', 'Unlink', 'Image', 'SpecialChar']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
        {name: 'insert', items: ['CreateDiv', 'Flash', 'Table', 'IFrame', 'Youtube', 'Abbr']},
        {name: 'vec', items:['-', 'Styles', 'Format',  'FontSize', 'Font',  'Outdent', 'Indent', 'HorizontalRule']}
    ];
    config.toolbar_Forum = [
        {name: 'document', items: ['Source', '-']},
        {name: 'clipboard', items: ['PasteText','RemoveFormat', 'Undo', 'Redo', 'Scayt']},
        {name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', 'Strike', '-']},
        {name: 'links', items: ['Link', 'Unlink', 'Image', 'SpecialChar']},
        {name: 'colors', items: ['TextColor', 'BGColor']},
        {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
        {name: 'insert', items: ['Table']},
        {name: 'vec', items:['-', 'FontSize', 'Font',  'Outdent', 'Indent']}
    ];
	config.toolbar_HotSpot = [
        //{name: 'insert', items: ['Image', 'ImageMap']}
		{name: 'insert', items: ['Image']}
    ];

    config.removeButtons = 'Cut,Copy,Paste,Subscript,Superscript';

    config.extraPlugins = 'youtube,abbr,vecikon';
    config.extraAllowedContent = {
        'abbr' : {
            attributes: '*',
            classes: '*'
        },
        'span' : {
            attributes: ['color*', 'background-color*','text-align*','font-family*','font-size*'],
            classes: '*'
        },
        'p' : {
            classes: '*'
        },
        'div' : {
            classes: '*'
        },
        'iframe': {
            attributes: ['allowfullscreen*', 'frameborder*', 'height*', 'width*', 'src*']
        },
        's' : {}
    };
    config.disallowedContent = 'h1, h2, h3, h4, h5, h6';

    // Full page mode (allow html, body...)
    //config.fullPage = true;

    //DEV TOOLS
    //config.extraPlugins = 'devtools';

    /*YOUTUBE EMBED CONFIG*/
    config.youtube_width = '560';
    config.youtube_height = '315';
    config.youtube_related = false;
    config.youtube_older = false;
    config.youtube_privacy = false;

    // Ostale privzete nastavitve
    config.entities = false;					// naj uporabi entitije.
    config.entities_processNumerical = true;		// naj entitije spravi v stevilke (in ne &scaron!)
    config.startupFocus = true;
    config.enterMode = CKEDITOR.ENTER_BR;
    config. shiftEnterMode = CKEDITOR.ENTER_P;
    config.pasteFromWordRemoveStyles = true;
    config.keystrokes = [[CKEDITOR.ALT + 84 /*T*/, 'abbr' ]];

    // Ne vem kje se to drugace lahko nastavi, potem naredimo kar tako:)
    if(lang_code == 'en')
        config.image_previewText = "Image preview.";
    else
        config.image_previewText = "Predogled slike.";

}

CKEDITOR.on('instanceReady', function() {
    $(".cke_button__source_label").text("");
});

//CKEDITOR.on('key', function() {
//    alert('nek');
//});

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;

    if (dialogName == 'image') {

         //odstrani 'Link' in 'Advanced' zavihek v pojavnem oknu 'Image'
        dialogDefinition.removeContents('Link');

        // Get a reference to the 'Image Info' tab.
        var infoTab = dialogDefinition.getContents('info');

        //odstranimo polja v pojavnem oknu 'Image'//
        infoTab.remove('txtHSpace');
        infoTab.remove('txtVSpace');
        infoTab.remove('txtBorder');

        //dodamo div browse file
        infoTab.add(
            {
                type: 'html',
                id: 'uploadSlikeEnka',
                label: 'Naloži sliko',
                html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="'+site_url+'editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1&url='+urlsrc+'&lang='+lang_code+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>'
            },
            'txtAlt'
        );
        infoTab.remove('txtAlt'); //alternative text
    }

    if (dialogName == 'link') {

        // Get a reference to the 'Image Info' tab.
        var infoTab = dialogDefinition.getContents('info');


        //dodamo div browse file
        infoTab.add(
            {
                type: 'html',
                id: 'uploadDatotekeEnka',
                label: 'Naloži datoteko',
                html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="'+site_url+'editors/ckeditor_4_4/uploader/EnkaUploader.php?url='+urlsrc+'&lang='+lang_code+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>'
            }
        );
    }
});