Legacy Knowledge Base
Published Jul. 2, 2025

Images are not inserted in CKEditor of Wiki portlet

Written By

József Géczi

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

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:

  1. Set up DXP 7.1 with CKEditor
  2. Start up the portal and log in as admin
  3. Add Wiki portlet to a test page
  4. 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] 

 

 

Did this article resolve your issue ?

Legacy Knowledge Base