Permalink
Browse files

Merge pull request #3341 from alexleeelkins/pimcore4

Supply sample configuration for WYSIWYG/CKEditor for filtering out HTML tags in Paste with Word
  • Loading branch information...
brusch committed Sep 14, 2018
2 parents dece9fe + 585ca19 commit ac2c5e09a75786cdab9ff62beca05eca0842ee33
Showing with 50 additions and 0 deletions.
  1. +50 −0 docs/Development_Documentation/03_Documents/01_Editables/40_WYSIWYG.md
@@ -80,6 +80,7 @@ There is also an additional way to specify the configuration by adding `customCo
```
##### Global Configuration
You can add a Global Configuration for all WYSIWYG Editors for all documents by setting ```pimcore.document.tags.wysiwyg.defaultEditorConfig```
For this purpose, you can create a plugin and add the configuration in the new created file `/plugins/MyPlugin/static/js/editmode.js` like this:
@@ -94,6 +95,55 @@ and add the file to your `plugin.xml`:
</pluginDocumentEditmodeJsPaths-extjs6>
```
Alternatively, you can simply create a plugin that directly modifies the CKeditor configuration file.
To do so, create a new plugin via the Pimcore interface and add the following to the generated startup.js file inside the pimcoreReady handler.
This sample configuration filters out span tags from the pasted content when pasted via Paste with Word functionality:
```js
// See documentation for allowing/disallowing tags, etc, @ https://ckeditor.com/docs/ckeditor4/latest/guide/dev_disallowed_content.html#how-to-allow-everything-except
if (CKEDITOR) {
CKEDITOR.config.allowedContent = {
$1: {
elements: CKEDITOR.dtd,
attributes: true,
styles: true,
classes: true
}
};
CKEDITOR.config.disallowedContent = 'span';
}
```
##### CKEditor Configuration
The default CKEditor configuration files can be found in pimcore/static/js/lib/ckeditor and pimcore/static6/js/lib/ckeditor as config.js.
This sample configuration filters out span tags from the pasted content when pasted via Paste with Word functionality:
```js
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
// See documentation for allowing/disallowing tags, etc, @ https://ckeditor.com/docs/ckeditor4/latest/guide/dev_disallowed_content.html#how-to-allow-everything-except
config.allowedContent = {
$1: {
elements: CKEDITOR.dtd,
attributes: true,
styles: true,
classes: true
}
};
config.disallowedContent = 'span';
};
```
### Text Output in Editmode
With the following code you can get the text even in editmode:

0 comments on commit ac2c5e0

Please sign in to comment.