PageSourceSearch

https://dpartmnt.com.au/ckeditor/form-config.js

js dpartmnt.com.au collected 2026-10-04 23:39:13 UTC 6,635 bytes, 150 lines download raw bytes

1/**
2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5
6CKEDITOR.disableAutoInline = true;
7CKEDITOR.editorConfig = function( config ) {
8    config.versionCheck = false;    // Prevent users see information about LTS version
9
10	// Define changes to default configuration here.
11	// For complete reference see:
12	// http://docs.ckeditor.com/#!/api/CKEDITOR.config
13
14    // The toolbar groups arrangement, optimized for two toolbar rows.
15	config.toolbarGroups = [
16		/*{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
17		{ name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },{ name: 'insert' },
18		{ name: 'forms' },
19		{ name: 'tools' },
20		{ name: 'document',	   groups: [ 'mode', 'document', 'doctools' ]},
21		{ name: 'others' },
22		'/',
23		*/
24		{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
25		{ name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
26		{ name: 'links' },
27		{ name: 'styles' },
28		{ name: 'colors'}
29	];
30
31	// Remove some buttons provided by the standard plugins, which are
32	// not needed in the Standard(s) toolbar.
33	config.removeButtons = 'Underline';
34
35	// Enable native browser spell checking
36	config.disableNativeSpellChecker = false;
37
38	// Remove the image alignment option in the image alignment dialog. We prefer to use a style of "display on <side>"
39	// where we can also add padding etc.
40	config.disallowedContent = 'img{float}';
41
42	// Set the most common block elements.
43	config.format_tags = 'p;h1;h2;h3;h4;pre';
44
45	// Simplify the dialog windows.
46	config.removeDialogTabs = 'image:advanced;link:advanced';
47
48	//Allow application to define a styles configuration
49	    //If this file doesn't exist we need to skip this config or it will prevent CKEDITOR loading
50	    config.stylesSet = 'kms_styles:https://storage.googleapis.com/kms-au.appspot.com/sites/dpartmnt-2021/app/7305/js/styles.6e61a643fbd204a95d3f.js';
51	    //If this file doesn't exist we should skip this config as it will require an extra HTTP request
52	    config.contentsCss = 'https://storage.googleapis.com/kms-au.appspot.com/sites/dpartmnt-2021/app/7305/css/editor.e9540849fcecb07b0393.css';
53	
54	config.removePlugins = 'sourcearea';
55	config.extraPlugins = 'sourcedialog,';
56	config.extraAllowedContent = "section[*](*); article[*](*); header[*](*); nav[*](*); aside[*](*); ol[start]; a[data-*]";
57
58    
59
60	
61
62
63    //TODO: use GCS direct upload URL and dynamically set this, or update in the fileUploadRequest event handler
64	config.imageUploadUrl = 'placeholder';
65	config.getAssetUploadUrl = '/kms/upload-asset-direct-url/';
66};
67
68
69
70CKEDITOR.on( 'dialogDefinition', function( ev )
71   {
72      // Take the dialog name and its definition from the event data.
73      var dialogName = ev.data.name;
74      var dialogDefinition = ev.data.definition;
75
76      // Check if the definition is from the dialog we're
77      // interested in (the 'image' dialog). This dialog name found using DevTools plugin
78      if ( dialogName == 'image' )
79      {
80         // Remove the 'Link' and 'Advanced' tabs from the 'Image' dialog.
81         //dialogDefinition.removeContents( 'link' );
82         //dialogDefinition.removeContents( 'advanced' );
83
84         // Get a reference to the 'Image Info' tab.
85         var infoTab = dialogDefinition.getContents( 'info' );
86
87         // Remove unnecessary widgets/elements from the 'Image Info' tab.
88         infoTab.remove( 'txtHSpace');
89         infoTab.remove( 'txtVSpace');
90      }
91   });
92// This should customise the upload process for the paste image process. Different API to the "brwose and upload" file stuff
93// https://docs.ckeditor.com/#!/guide/dev_file_upload
94/*CKEDITOR.on ('fileUploadRequest', function (evt) {
95    evt.requestData._csrf_token = evt.editor.kms.csrf_token;
96});*/
97CKEDITOR.on( 'dialogDefinition', function( ev )
98   {
99      // Take the dialog name and its definition from the event data.
100      var dialogName = ev.data.name;
101      var dialogDefinition = ev.data.definition;
102
103      // Check if the definition is from the dialog we're
104      // interested in (the 'image' dialog). This dialog name found using DevTools plugin
105      if ( dialogName == 'link' )
106      {
107         // Get a reference to the 'upload' tab.
108         var uploadTab = dialogDefinition.getContents( 'upload' );
109         //We could update the url here, but we know it's been set in the config correctly already.
110         //var uploadbtn = dialogDefinition.getContentElement( 'upload','upload' );
111         //uploadbtn._.definition.action = uploadbtn._.definition.action.replace ('secure_uploads=false','secure_uploads=true');
112         secure_uploads = false;
113         if (ev.editor.config.hasOwnProperty('kms')){
114            if (ev.editor.config.kms.hasOwnProperty('secure_uploads')) {
115                secure_uploads=ev.editor.config.kms.secure_uploads;
116            }
117
118         }
119         uploadTab.elements.push({
120              type: 'vbox',
121              id: 'kmsOptions',
122              children: [{
123                id: 'secure_uploads',
124                type: 'checkbox',
125                label: 'Secure Upload',
126                'default': (secure_uploads) ? 'checked' : null,
127                onClick: function() {
128
129                    // We want to update the URL of the upload process based on this.
130                    // Assume initial state was set in config.
131                    var dialog = this.getDialog();
132                    var uploadbtn = dialog.getContentElement('upload','upload' );
133                    var upload_form = uploadbtn.getInputElement().$.form; //not sure if this is really part of CKEDITOR public API. OH WELL, it works!
134                    if (this.getValue()) {
135                        // replace 'secure_uploads=false'
136                        //filebrowser.url = filebrowser.url.replace('secure_uploads=false','secure_uploads=true')
137                        upload_form.action = upload_form.action.replace('secure_uploads=false','secure_uploads=true');
138                        uploadbtn._.definition.action = uploadbtn._.definition.action.replace('secure_uploads=false','secure_uploads=true');//definitely not really part of CKEDITOR public API.
139                    } else {
140                        upload_form.action = upload_form.action.replace('secure_uploads=true','secure_uploads=false');
141                        uploadbtn._.definition.action = uploadbtn._.definition.action.replace('secure_uploads=true','secure_uploads=false');
142                    }
143
144                    return true;
145                }
146              }]
147         });
148      }
149   });
150

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.