【问题标题】:Problem with PrimeFaces TextEditor in Dialog after update from PrimeFaces 7 to 8从 PrimeFaces 7 更新到 8 后,对话框中的 PrimeFaces TextEditor 出现问题
【发布时间】:2020-11-24 14:24:27
【问题描述】:

我有一个带有 PrimeFaces 的 JSF 应用程序,我正在更新到 PrimeFaces 版本 8(当前使用版本 7)。

更新后,我在对话框中使用 TextEditor 时出现了奇怪的行为。我使用 commandLink 打开对话框并更新对话框以刷新其内容。当我这样做时,我在 JavaScript 控制台上得到一个错误。

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)

错误来自代码:

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

其中 t 为 null,因此 t.innerHTML 会引发错误。

但是 - 如果我只打开对话框而不更新它 - 一切正常。

我创建了一个最小样本。第一个 fink 工作正常,第二个链接会产生错误。

<!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>

在此示例中,更新没有用,但会产生与我的完整页面相同的错误,其中我有填充编辑器和对话框中其他字段的支持 bean。

有没有人经历过类似的事情或知道如何解决这个问题?我查看了 PrimeFaces 8.0.x 版本的发行说明,但没有发现 TextEditor 有任何问题。不更新对话框不是一种选择;-)

【问题讨论】:

标签: jsf primefaces


【解决方案1】:

好的,问题已在 6.2 中修复:https://github.com/primefaces/primefaces/issues/2802

但是,当 QuillJS 1.3.7 升级为安全 CVE 时,此更改丢失。

我刚刚提交了一个 PR,希望能在 8.0.4 和 9.0 中解决这个问题。

公关:https://github.com/primefaces/primefaces/issues/2802

【讨论】:

  • 非常感谢!
  • 感谢您的报告!
猜你喜欢
  • 1970-01-01
  • 2013-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-06
  • 2022-09-08
  • 1970-01-01
相关资源
最近更新 更多