如何在多字段中使用RichText(在CQ5对话框中)? (防止“ this.el.dom未定义”错误) [英] How to use richtext in multifield (in CQ5 dialog)? (prevent "this.el.dom is undefined" error)

查看:91
本文介绍了如何在多字段中使用RichText(在CQ5对话框中)? (防止“ this.el.dom未定义”错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义组件,并尝试在对话框的多文件内使用RTE( xtype = richtext )。

I have created a custom component, and try to use RTE (xtype="richtext") inside the multifiled in my dialog.

现在,当我尝试删除项目时,或者在对话框关闭后&重新打开再添加一个对话框,对话框既不会关闭,也不会使用确定按钮保存数据。

Now, when I try to delete item, or after dialog was closed & reopened add another one the dialog will neither close, nor save the data with OK button.

dialog.xml:

<myField
    jcr:primaryType="cq:Widget"
    name="./myField"
    xtype="multifield">
    <fieldConfig
        jcr:primaryType="cq:Widget"
        xtype="richtext">
    </fieldConfig>
</myField>

Sham HC在 AEM常见问题解答



  1. 使用文本字段代替 richtext ,或尝试不使用 多字段中的richtext

  2. 如果 richtext 多字段中的c $ c>是必需的,然后按照以下步骤进行操作,并在您的开发环境中进行验证。

  1. Use textfield instead of a richtext Or try not to use a richtext in a multifield.
  2. If richtext in a multifield is required then follow below and verify in your development envirnoment.

覆盖/libs/cq/ui/widgets/source/widgets/form/RichText.js
在方法syncValue的覆盖文件中(第910行)

Overlay /libs/cq/ui/widgets/source/widgets/form/RichText.js At the overlayed file for the method syncValue (Line 910) replace [1] with [2].

[1] this.el.dom.value = html;
[2] if(this.el.dom){this.el.dom.value = html;}



问题是我想在不更改Adobe代码的情况下使用make。

The problem is that I would like to use make it without changing Adobe's code.

推荐答案

我发现了一种变通方法,不需要更改CQ小部件的代码。
您需要设置 richtext destroy 事件处理程序,以创建虚拟 this.el.dom

I have found a workaround, that does not require changing CQ widget's code. You need to set richtext's destroy event handler, to create dummy this.el.dom:

<myField
    jcr:primaryType="cq:Widget"
    name="./myField"
    xtype="multifield">
    <fieldConfig
        jcr:primaryType="cq:Widget"
        xtype="richtext">
        <listeners
            jcr:primaryType="nt:unstructured"
            destroy="function() {this.el.dom={};}"/>
    </fieldConfig>
</myField>

这篇关于如何在多字段中使用RichText(在CQ5对话框中)? (防止“ this.el.dom未定义”错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆