jsf - 从 PrimeFaces 7 更新到 8 后,对话框中的 PrimeFaces TextEditor 出现问题
问题描述
我有一个带有 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 为空,因此 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 有任何问题。不更新对话框不是一个选项;-)
解决方案
好的,问题已在 6.2 中修复:https ://github.com/primefaces/primefaces/issues/2802
但是,当 QuillJS 1.3.7 升级为安全 CVE 时,此更改丢失。
我刚刚提交了一个 PR,希望能在 8.0.4 和 9.0 中解决这个问题。
推荐阅读
- kubernetes - 如何在负载下安全终止 Pod
- c++ - 确保传递给函数的参数是唯一的
- r - 如何在 facet_wrap 中使用 ggpubr 或 rstatix 申请循环以进行多重比较统计
- graphql - 我无法解决的 Graphql 架构设计问题
- dependency-injection - 依赖注入和数据模型
- c - 使用 C 中的函数进行输入不起作用
- javascript - 使用 react-router 验证 url
- wso2 - wso2 api manager 3.1.0 中的订阅工作流实现
- azure - azure powerhsell 集成帐户合作伙伴创建身份无效
- maven - 如何使用 mvn clean install 传递自定义输入并在 mojo 类中访问此输入?