Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to include richtext in a custom xtype as multifield

Avatar

Avatar
Validate 1
Level 1
Naren1224
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Naren1224
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Naren1224
Level 1

15-10-2015

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Sham_HC
Level 10

15-10-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. 

Answers (4)

Answers (4)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-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

Avatar

Avatar
Validate 1
Level 1
Naren1224
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Naren1224
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Naren1224
Level 1

15-10-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

Avatar

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Sham_HC
Level 10

15-10-2015

Avatar

Avatar
Validate 10
Level 2
samthadhani
Level 2

Likes

4 likes

Total Posts

52 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 10
Level 2
samthadhani
Level 2

Likes

4 likes

Total Posts

52 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
samthadhani
Level 2

15-10-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.