edit/page: disable image size attributes in editor
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 22 Dec 2020 12:33:24 +0000 (13:33 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 24 Dec 2020 03:35:43 +0000 (04:35 +0100)
Disallow width and height, with Advanced Content Filtering enabled following
<https://ckeditor.com/docs/ckeditor4/latest/guide/dev_disallowed_content.html
#how-to-allow-everything-except>.

edit/page.js

index d5a2d503d434ba0cb9d7de38e518a0aace65e863..21ec6b4a4c3f189adcf0d365fb94bc39415e602b 100644 (file)
@@ -119,10 +119,20 @@ CKEDITOR.on('instanceCreated', function (event) {
                var config = editor.config;
                config.language = 'nl';
                config.extraPlugins = 'inlinesave,placeholder,image2,uploadimage';
-               config.allowedContent = true;
+               config.removePlugins = 'image'; // conflicts with image2
+               config.allowedContent = {
+                       $1: {
+                               elements: CKEDITOR.dtd,
+                               attributes: true,
+                               styles: true,
+                               classes: true,
+                       },
+               };
+               config.disallowedContent = 'img[width,height]';
                config.entities = false; // keep unicode
                config.filebrowserImageUploadUrl = '/edit/page?output=ckjson';
                config.image2_alignClasses = ['left', 'center', 'right'];
+               config.image2_prefillDimensions = false;
                config.image2_disableResizer = true;
                config.stylesSet = [
                        { name: 'Paginakop', element: 'h2' },