Custom format remover plugin for CKEditor.
This commit is contained in:
parent
1d49121cb6
commit
bbd3aa2ec8
@ -117,6 +117,7 @@ Core:
|
|||||||
- Preparations for the SAML plugin; Fixed caching of main views [#3535].
|
- Preparations for the SAML plugin; Fixed caching of main views [#3535].
|
||||||
- Removed unnecessary OPTIONS request in config [#3541].
|
- Removed unnecessary OPTIONS request in config [#3541].
|
||||||
- Added possibility to upload custom fonts for projector and pdf [#3568].
|
- Added possibility to upload custom fonts for projector and pdf [#3568].
|
||||||
|
- Use custom format cleanup plugin for CKEditor [#3576].
|
||||||
|
|
||||||
Mediafiles:
|
Mediafiles:
|
||||||
- Fixed reloading of PDF on page change [#3274].
|
- Fixed reloading of PDF on page change [#3274].
|
||||||
|
50
openslides/core/static/js/core/remove-format-plugin.js
Normal file
50
openslides/core/static/js/core/remove-format-plugin.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
(function () {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('OpenSlidesApp.core.remove-format-plugin', [
|
||||||
|
'OpenSlidesApp.core',
|
||||||
|
])
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Plugin for the CKEditor that hooks into the removeformat plugin
|
||||||
|
* which is a default plugin enabled by 'cleanup' in the config
|
||||||
|
* toolbar.
|
||||||
|
* We change the behavior of the removeformat command here:
|
||||||
|
* It should not remove any tags and styles, but only the
|
||||||
|
* 'DISALLOWED_STYLES'. Removeformat traverses through the DOM
|
||||||
|
* and calles for every element the custom filter down below.
|
||||||
|
* We change the element and return false, so the removeformat
|
||||||
|
* plugin does not clean it up.
|
||||||
|
*/
|
||||||
|
.factory('OSRemoveFormatPlugin', [
|
||||||
|
'Editor',
|
||||||
|
'gettextCatalog',
|
||||||
|
function (Editor, gettextCatalog) {
|
||||||
|
var DISALLOWED_STYLES = ['color', 'background-color'];
|
||||||
|
return {
|
||||||
|
getPlugin: function () {
|
||||||
|
return {
|
||||||
|
init: function (editor) {
|
||||||
|
editor.addRemoveFormatFilter(function (element) {
|
||||||
|
_.forEach(DISALLOWED_STYLES, function (style) {
|
||||||
|
element.removeStyle(style);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
.run([
|
||||||
|
'Editor',
|
||||||
|
'OSRemoveFormatPlugin',
|
||||||
|
function (Editor, OSRemoveFormatPlugin, gettext) {
|
||||||
|
Editor.registerPlugin('OSRemoveFormat', OSRemoveFormatPlugin.getPlugin());
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
}());
|
@ -7,6 +7,7 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'OpenSlidesApp.core',
|
'OpenSlidesApp.core',
|
||||||
'OpenSlidesApp.core.start',
|
'OpenSlidesApp.core.start',
|
||||||
'OpenSlidesApp.core.csv',
|
'OpenSlidesApp.core.csv',
|
||||||
|
'OpenSlidesApp.core.remove-format-plugin',
|
||||||
'OpenSlidesApp.poll.majority',
|
'OpenSlidesApp.poll.majority',
|
||||||
'ui.router',
|
'ui.router',
|
||||||
'colorpicker.module',
|
'colorpicker.module',
|
||||||
|
Loading…
Reference in New Issue
Block a user