Issue
- In a Wiki portlet's comment section within CKEditor, when attempting to insert a picture, the image is actually not inserted - although it is added to Documents.
- An empty line is added instead.
- No errors shown in browser console, nor at Liferay logs.
Reproduction Steps:
- Set up DXP 7.1 with CKEditor
- Start up the portal and log in as admin
- Add Wiki portlet to a test page
- At Wiki's comment section, add an image in CKEditor
Environment
- DXP 7.1 configured with CKEditor, using the following properties at portal-ext.properties:
editor.wysiwyg.portal-web.docroot.html.portlet.message_boards.edit_message.html.jsp=ckeditor editor.wysiwyg.portal-web.docroot.html.taglib.ui.discussion.jsp=ckeditor
Resolution
Such behavior is actually intended by design and there is a property which provides the ability to control the feature of displaying specific type of HTML elements in Wiki's comment section:
Input a list of semicolon delimited elements and attributes allowed in discussion comments. This will be used by the editor to allow that specific markup and by the backend to sanitize the content.
Attributes can be optionally specified as a comma delimited list. If no attribute is specified, all the attributes will be cleaned up when the discussion comment is added.
The supported syntax is a subset of the one documented in http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules-section-string-format
The following grammar describes the supported subset (parenthesis is used for grouping, '*' means zero or more repetitions, and '|' is used to describe alternatives):
allowed-content : element (; element)*
element : element-name | element-name[attribute (, atribute)*]Defaults:
discussion.comments.allowed.content=a[href];em;p;span[class];strong;u
By default, the IMG element is not allowed, and that causes the described experience.
For example if the following property is added into the portal-ext.properties file, the images are inserted to the Wiki comment section:
discussion.comments.allowed.content=a[href];em;p;span[class];strong;u;img[src]