How to include richtext in a custom xtype as multifield | Community
Skip to main content
Level 2
October 16, 2015
Solved

How to include richtext in a custom xtype as multifield

  • October 16, 2015
  • 5 replies
  • 1763 views

Hi,

I have a requirement of adding a richtext in a custom multifield.

There is a richtext component created under '/apps/website/components/richtext/items/items/richtext'

This richtext would have 3 plugins as well.

 

Now my custom multifield xtype should have the below

1) Text Field

2) Pathfield

3) Richtext(with the additional plugins. Same as /apps/website/components/richtext/items/items/richtext).

 

I tried the below option

1)

this.text = new CQ.form.RichText({

                anchor: '100%',

                fieldLabel : "Enter Text",

                width : '400',

                "rtePlugins" :{

                    "edit" : {

                        "features" : ['cut', 'copy', 'paste-plaintext']

                    },

                    "subsuperscript" : {

                        "features" : "*"

                    },

                    "spellcheck" : {

                        "features" : "*"

                    },

                    "undo" : {

                        "features" : "*"

                    },

                    "findreplace" : {

                        "features" : "*"

                    },

                    "misctools" : {

                        "features" : "*"

                    }

                },

                listeners : {

                    change :{

                        scope : this,

                        fn : this.updateHidden

                    },

                    dialogclose: {

                        scope : this,

                        fn : this.updateHidden

                    },

                    destroy: function(){

                        this.el.dom={};

                    }

                }

            });

            this.add(this.text);

 

However in the dialog I'm able to add the xtype only once.

On click of add item I see the below error in console

 

TypeError: features is undefined
var featCnt = features.length;

Please let me know how I can get rid of this error.

2) Is there an option to include xtype as cqinclude

  path : '/apps/website/components/richtext/items/items/richtext.infinity.json',

  xtype : 'cqinclude',  

 

Thanks

Narendra.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

there are some changes compare to 5.5 in 5.6.1 w.r.t rte that might be causing to break. Sorry I do not have sample to share. 

5 replies

October 16, 2015

Check and see if this works for you http://aemfaq.blogspot.co.nz/2013/04/richtext-in-multifield-widget.html.

As far as i know it is not recommended to have a richtext within a multifield as you can run into several issue. Do test on all the browsers thoroughly before you roll out anything.

Sham_HC
Level 10
October 16, 2015
Naren1224Author
Level 2
October 16, 2015

Hi Sham,

Thanks for your response.

I tried comparing the hooks.js in my local instance with the one in the package downloaded from the link provided. I didnt find any difference.

However, I have a requirement to add some plugins in my richtext, as per the js provided above.

While doing so, I got the below error.

TypeError: features is undefined
var featCnt = features.length;

The same code while trying in CQ5.5 doesnt show any error. Is there something which should is cusing this error in CQ5.6.1 alone.

Please assist.

 

Thanks

Naren

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

there are some changes compare to 5.5 in 5.6.1 w.r.t rte that might be causing to break. Sorry I do not have sample to share. 

smacdonald2008
Level 10
October 16, 2015

Here is a community article that we have. However - the RichText Editor in this community article is defined at the JCR level - not in JS script:

http://helpx.adobe.com/experience-manager/using/creating-aem-multifield-components.html