pe:ckEditor insertText from bean

UI Components for JSF
Post Reply
vished
Posts: 479
Joined: 02 Feb 2014, 17:38

14 Sep 2018, 09:55

Hi all,

I´m trying to add an text from my bean to my pe:ckEditor. This is working, but I would like to add also HTML text etc.

Code: Select all

<p:commandButton global="false" update=":growl"
immediate="true"
onclick="PrimeFaces.widgets.editorWidgetVar.instance.insertText('#{emailReceiverInboxController.email.text'});"
value="TEST" icon="fa fa-copy" />

Code: Select all

	<pe:ckEditor widgetVar="editorWidgetVar" width="100%"
													value="#{emailReceiverInboxController.email.text}"
													height="300"
													toolbar="[[ 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor',  'Undo','Redo' ],[ 'Styles', 'Format', 'Font', 'FontSize' ],
                  								[ 'Image', 'Table' ], [ 'Link', 'Unlink' ],
                  								[ 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter','JustifyRight', 'JustifyBlock'], ['Source' ]
                  								]">
												</pe:ckEditor>
If I have a normal text like "TEST" than it´s working. But for HTML code / line break etc. it seems not working.
I got in Firebug this error message:

SyntaxError: '' string literal contains an unescaped line break

Any ideas?
PF 8.0

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

14 Sep 2018, 14:08

You probably have to escape the value of #{emailReceiverInboxController.email.text}

In your backing bean trying and use Commons Lang StringEcapeUtils and do escapeHtml() or something like that.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests