Expand my Community achievements bar.

SOLVED

How to include richtext in a custom xtype as multifield

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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. 

View solution in original post

5 Replies

Avatar

Former Community Member

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.

Avatar

Level 2

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

Avatar

Correct answer by
Level 10

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. 

Avatar

Level 10

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