cryptpad/customize.dist/ckeditor-config.js

83 lines
3.4 KiB
JavaScript
Raw Normal View History

2023-10-20 22:35:26 +08:00
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2017-04-13 23:09:35 +08:00
/* global CKEDITOR */
CKEDITOR.editorConfig = function( config ) {
2017-02-22 01:21:30 +08:00
var fixThings = false;
// https://dev.ckeditor.com/ticket/10907
2017-02-22 01:59:42 +08:00
config.needsBrFiller= fixThings;
config.needsNbspFiller= fixThings;
config.disableObjectResizing = true;
config.removeButtons= 'Source,Maximize';
2017-02-22 01:21:30 +08:00
// magicline plugin inserts html crap into the document which is not part of the
// document itself and causes problems when it's sent across the wire and reflected back
config.removePlugins= 'resize,elementspath,liststyle';
2017-06-22 00:04:35 +08:00
config.resize_enabled= false; //bottom-bar
2020-04-08 22:16:04 +08:00
config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag,print,blockbase64,mathjax,wordcount,comments';
config.toolbarGroups= [
// {"name":"clipboard","groups":["clipboard","undo"]},
//{"name":"editing","groups":["find","selection"]},
{"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"},
2017-12-22 00:07:06 +08:00
{"name":"colors"},
{"name":"print"}];
2017-02-22 01:21:30 +08:00
2019-04-02 20:19:41 +08:00
config.mathJaxLib = '/pad/mathjax/MathJax.js?config=TeX-AMS_HTML';
config.font_defaultLabel = 'Arial';
config.fontSize_defaultLabel = '16';
config.accessibility = 'true';
config.keystrokes = [
[ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ],
[ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ],
[ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ],
[ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ],
[ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 76 /*L*/, 'link' ],
[ CKEDITOR.CTRL + 76 /*L*/, undefined ],
[ CKEDITOR.CTRL + 66 /*B*/, 'bold' ],
[ CKEDITOR.CTRL + 73 /*I*/, 'italic' ],
[ CKEDITOR.CTRL + 85 /*U*/, 'underline' ],
[CKEDITOR.ALT + 109 /*-*/, 'toolbarCollapse' ],
[37 /* Left Arrow */, 'focusPreviousButton'],
[39 /* Right Arrow */, 'focusNextButton'],
//enter
[13, 'clickFocusedButton'],
//space bar
[32, 'clickFocusedButton']
];
2017-02-22 01:21:30 +08:00
//skin: 'moono-cryptpad,/pad/themes/moono-cryptpad/'
//skin: 'flat,/pad/themes/flat/'
2017-06-20 16:03:13 +08:00
//config.skin= 'moono-lisa,/pad/themes/moono-lisa/'
2017-02-22 01:21:30 +08:00
//skin: 'moono-dark,/pad/themes/moono-dark/'
//skin: 'office2013,/pad/themes/office2013/'
2017-02-22 01:59:42 +08:00
};
2017-08-22 21:50:10 +08:00
(function () {
// These are overrides inside of ckeditor which add ?ver= to the CSS files so that
// every part of ckeditor will get in the browser cache.
var fix = function (x) {
if (x.map) { return x.map(fix); }
return (/\/components\/.*\.css$/.test(x)) ? (x + '?ver=' + CKEDITOR.timestamp) : x;
2017-08-22 21:50:10 +08:00
};
CKEDITOR.tools._buildStyleHtml = CKEDITOR.tools.buildStyleHtml;
CKEDITOR.document._appendStyleSheet = CKEDITOR.document.appendStyleSheet;
CKEDITOR.tools.buildStyleHtml = function (x) { return CKEDITOR.tools._buildStyleHtml(fix(x)); };
CKEDITOR.document.appendStyleSheet = function (x) { return CKEDITOR.document._appendStyleSheet(fix(x)); };
2017-09-05 18:16:49 +08:00
}());