2
votes

I have a JSF application with PrimeFaces that I'm updating to PrimeFaces version 8 (currently using version 7).

After updating I have a strange behaviour with a TextEditor in a dialog. I open the dialog with a commandLink and update the dialog to refresh its contents. When I do this I get an error on the JavaScript console.

texteditor.js.xhtml?ln=primefaces&v=8.0:7 Uncaught TypeError: Cannot read property 'innerHTML' of null
    at e.value (texteditor.js.xhtml?ln=primefaces&v=8.0:7)
    at new e (texteditor.js.xhtml?ln=primefaces&v=8.0:7)
    at texteditor.js.xhtml?ln=primefaces&v=8.0:7
    at Array.map (<anonymous>)
    at e.value (texteditor.js.xhtml?ln=primefaces&v=8.0:7)
    at e.value (texteditor.js.xhtml?ln=primefaces&v=8.0:7)
    at e.value (texteditor.js.xhtml?ln=primefaces&v=8.0:7)
    at texteditor.js.xhtml?ln=primefaces&v=8.0:7
    at Array.forEach (<anonymous>)
    at e.value (texteditor.js.xhtml?ln=primefaces&v=8.0:7)

The error comes from the code:

a(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "selectItem", this).call(this, t, n), t = t || this.defaultItem, this.label.innerHTML = t.innerHTML

where t is null so t.innerHTML throws the error.

However - if I only open the dialog but don't udpate it - everything works fine.

I created a minimal sample. First fink works fine, second link creates the error.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
>

<h:head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
    <title>test</title>
</h:head>
<h:body>
    <h:form id="contentForm">
        <p:commandLink value="works"
                       oncomplete="PF('dialogTemplateSendMailToPersonVar').show()"/>
        <br/>
        <p:commandLink value="does not work"
                       oncomplete="PF('dialogTemplateSendMailToPersonVar').show()"
                       update=":templatePersonSendMailForm"/>
    </h:form>

    <p:dialog id="dialogTemplateSendMailToPersonId" widgetVar="dialogTemplateSendMailToPersonVar" dynamic="true">
        <h:form id="templatePersonSendMailForm">

            <p:textEditor id="txtTemplateText" />

        </h:form>
    </p:dialog>
</h:body>

</html>

In this sample the update is useless, but produces the same error as with my full page where I have backing beans that fill the editor and other fields in the dialog.

Has anybody experienced something similiar or any idea how to fix this? I checked the release notes for the PrimeFaces 8.0.x versions, but didn't see any issue with TextEditor. Not updating the dialog is not an option ;-)

1
Actually it looks like this issue: github.com/quilljs/quill/issues/1762Melloware

1 Answers

2
votes

OK the issue was fixed in 6.2 here: https://github.com/primefaces/primefaces/issues/2802

However when QuillJS 1.3.7 was upgraded for a security CVE this change was lost.

I just submitted a PR to fix this hopefully for 8.0.4 and 9.0.

PR: https://github.com/primefaces/primefaces/issues/2802