-
Notifications
You must be signed in to change notification settings - Fork 104
/
ckedit.js
58 lines (51 loc) · 1.99 KB
/
ckedit.js
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
this.ckan.module('ckedit', function (jQuery, _) {
return {
options: {
site_url: ""
},
initialize: function () {
jQuery.proxyAll(this, /_on/);
this.el.ready(this._onReady);
},
_onReady: function() {
var config = {};
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
];
// Remove some buttons, provided by the standard plugins, which we don't
// need to have in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
// Set the most common block elements.
config.format_tags = 'p;h1;h2;h3;pre';
// Make dialogs simpler.
config.removeDialogTabs = 'image:advanced;link:advanced';
config.extraPlugins = 'divarea,ckanview,templates,font';
config.height = '400px';
config.customConfig = false;
config.allowedContent = true;
var csrf_field = $('meta[name=csrf_field_name]').attr('content');
var csrf_token = $('meta[name='+ csrf_field +']').attr('content');
config.fileTools_requestHeaders = {
'X-Requested-With': 'XMLHttpRequest',
'X-CSRFToken': csrf_token
};
config.filebrowserUploadUrl = this.options.site_url + 'pages_upload';
// Override default config options with ones provided by plugins
if (window.ckan.pages && window.ckan.pages.override_config) {
$.extend(config, window.ckan.pages.override_config);
}
var editor = $(this.el).ckeditor(config);
},
}
});