Reputation: 43
I use the PrimeFaces' textEditor component and a String variable (JEE) contains the text entered.
When I initialize this variable with "null" or "" just before calling the component, this variable then contains: <p><br></p>
As a result the placeholder is not displayed and the cursor is positioned on a second line.
How can I delete this value?
Here is my code:
<p:contextMenu>
<p:menuitem value="Ajouter une note" actionListener="#{noteManagerBean.initialiserNote()}"
oncomplete="PF('widgetNoteDialog').show()"
update="idNoteDialog"/>
</p:contextMenu>
<p:dialog id="idNoteDialog" widgetVar="widgetNoteDialog" style="position: absolute; border: none; border-radius: 0; z-index: 2" class="effetZoom" showEffect="fade" hideEffect="fade" closable="false" resizable="false">
<p:textEditor placeholder="Entrez votre texte ici" value="#{noteManagerBean.noteTexte}" height="129" style="width: 294px; position: absolute; top: 0px; left: 12px; margin-left: -1px; background-color: transparent">
<f:facet name="toolbar">
<span class="ql-formats">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
</span>
</f:facet>
</p:textEditor>
</p:dialog>
@SessionScoped
@Named
public class NoteManagerBean implements Serializable {
private String noteTexte;
public void initialiserNote() {
setNoteTexte(null);
}
Upvotes: 1
Views: 1494
Reputation: 12039
I believe your problem is related to the fix for this issue: https://github.com/primefaces/primefaces/issues/3170
Its trying to determine whether the Editor is already showing HTML or not.
getEditorValue: function() {
var html = $(this.editorContainer[0]).find('p').text();
var value = (html == '<p><br></p>') ? '' : html;
return value;
},
Upvotes: 1