Expand my Community achievements bar.

SOLVED

Rich Text Editor Hyperlinks not working

Avatar

Former Community Member

Hello,

I configured my rich text editor, but I am not able to generate the link to the url using the hyperlink plugin in rich text editor. When I select the text and click hyperlink button, I dont see a dialog asking for relative url. I see in the documentation that a dialog will be popped asking for relative url - http://dev.day.com/docs/en/cq/5-4/wcm/using_rich_text_editor.html#Links. Can anyone help me out if I need to do any additional configuration.

Following is the dialog.xml of the rich text editor with rteplugins 

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="cq:Dialog"
    height="400"
    helpPath="en/cq/current/wcm/default_components.html#Text"
    title="Text"
    xtype="tabpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <tab1
            jcr:primaryType="cq:Widget"
            anchor="100%"
            title="Text"
            xtype="panel">
            <items jcr:primaryType="cq:WidgetCollection">
                <text
                    jcr:primaryType="cq:Widget"
                    fieldLabel="Description"
                    height="400"
                    hideLabel="{Boolean}false"
                    name="./text"
                    xtype="richtext">
                    <rtePlugins jcr:primaryType="nt:unstructured">
                        <links jcr:primaryType="nt:unstructured">
                            <linkDialogConfig
                                jcr:primaryType="nt:unstructured"
                                height="{Long}316">
                                <linkAttributes jcr:primaryType="cq:WidgetCollection">
                                    <linkAdvanced
                                        jcr:primaryType="cq:Widget"
                                        collapsed="{Boolean}true"
                                        collapsible="{Boolean}true"
                                        inputValue="advanced"
                                        name="./linkdialog/cq:adhocLinkTrackingTab"
                                        title="Link tracking"
                                        xtype="dialogfieldset">
                                        <items jcr:primaryType="cq:WidgetCollection">
                                            <enable
                                                jcr:primaryType="nt:unstructured"
                                                attribute="enabletracking"
                                                fieldDescription="override analytics framework settings"
                                                fieldLabel="Custom link tracking"
                                                name="./linkdialog/cq:adhocLinkTrackingEnableTracking"
                                                xtype="checkbox">
                                                <listeners
                                                    jcr:primaryType="nt:unstructured"
                                                    check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>
                                            </enable>
                                            <events
                                                jcr:primaryType="nt:unstructured"
                                                attribute="adhocevents"
                                                fieldDescription="e.g.: event2, event7"
                                                fieldLabel="Include SiteCatalyst events"
                                                name="./linkdialog/cq:adhocLinkTrackingEvents"
                                                xtype="textfield"/>
                                            <evars
                                                jcr:primaryType="nt:unstructured"
                                                attribute="adhocevars"
                                                fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"
                                                fieldLabel="Include SiteCatalyst variables"
                                                name="./linkdialog/cq:adhocLinkTrackingEvars"
                                                xtype="textfield"/>
                                        </items>
                                    </linkAdvanced>
                                </linkAttributes>
                            </linkDialogConfig>
                        </links>
                        <misctools
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <edit
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <findreplace
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <format
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <image
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <keys
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <justify
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <lists
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <paraformat
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <spellcheck
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <styles
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <subsuperscript
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <table
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <undo
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                    </rtePlugins>
                </text>
                <isRichTextFlag
                    jcr:primaryType="cq:Widget"
                    ignoreData="{Boolean}true"
                    name="./textIsRich"
                    value="true"
                    xtype="hidden"/>
            </items>
        </tab1>
        <tab2
            jcr:primaryType="cq:Widget"
            xtype="componentstyles"/>
    </items>
</jcr:root>

 

I even followed the instructions and created dialog.xml as per this blog - http://www.cognifide.com/blogs/cq/shared-plugin-configuration-for-rte-in-components/. I was not successful.

 

Thanks

Sachin.

1 Accepted Solution

Avatar

Correct answer by
Level 10

It works in 5.6.1 could you go to geomtrixx page [1] and open any text component & you can use hyperlink plugin. If it works in geometrixx but not in your custom page or component in the firebug console you should have some javascript error can you post the name.   If does not work in geometrixx what is the browser version & error on console?

[1]   http://localhost:4502/content/geometrixx/en.html

View solution in original post

9 Replies

Avatar

Level 10

What version of CQ are you using? 

Avatar

Level 2

Here is 5.6.1 referenced link :  http://dev.day.com/docs/en/cq/current/wcm/using_rich_text_editor.html

Here is sample RTE plug-ins 

 

 <rtePlugins jcr:primaryType="nt:unstructured">
                                    <thresholds
                                        jcr:primaryType="nt:unstructured"
                                        thresholds="[20;yellow,25;red]"/>
                                    <misctools
                                        jcr:primaryType="nt:unstructured"
                                        features="[specialchars]">
                                     </misctools>
                                    <spellcheck
                                        jcr:primaryType="nt:unstructured"
                                        features="[checktext]"/>
                                    <justify
                                        jcr:primaryType="nt:unstructured"
                                        features="[]"/>
                                    <lists
                                        jcr:primaryType="nt:unstructured"
                                        features="[]"/>
                                    <links
                                        jcr:primaryType="nt:unstructured"
                                        features="[modifylink,unlink]"
                                        name="./links1"/>
                                </rtePlugins>

Avatar

Former Community Member

Still I am not able to get a dialog asking for relative url when I clicked on hyperlink button on rich text editor.

 

 

Thanks

Avatar

Former Community Member

There seems to be a bug in 5.6.1 version. I tested in 5.4 version and its working fine. Can anyone confirm?

Avatar

Correct answer by
Level 10

It works in 5.6.1 could you go to geomtrixx page [1] and open any text component & you can use hyperlink plugin. If it works in geometrixx but not in your custom page or component in the firebug console you should have some javascript error can you post the name.   If does not work in geometrixx what is the browser version & error on console?

[1]   http://localhost:4502/content/geometrixx/en.html

Avatar

Former Community Member

Thanks Sham for the reply.

I tried in my personel Macbook with just running CQ instance. Its working fine.

But when I check out the code from SVN branch of my company, its not working. Even the foundation text component is not working. 

I see a JS error being thrown. I guess some issue in the code base I checked out.

Below is the error being thrown. Looks like a framework error. Can anyone help me if they are aware of this error.

Uncaught TypeError: Cannot call method 'getEditContext' of null

 createToolbarDef: function() {
        return {
            "itemId": this.id,
            "cls": "x-btn-icon",
            "iconCls": this.css,
            "enableToggle": (this.toggle !== false),
            "scope": this,
            "handler": function() {
                var editContext = this.plugin.editorKernel.getEditContext();
                var cmd = (this.cmdDef ? this.cmdDef.cmd : this.id);
                var cmdValue = (this.cmdDef ? this.cmdDef.cmdValue : undefined);
                var env = {
                    "editContext": editContext
                };
                this.plugin.execute(cmd, cmdValue, env);
            },
            "clickEvent": "mousedown",
            "tooltip": this.tooltip,
            "tabIndex": -1
        };
    },

Avatar

Level 10

Seems like custom implementation Or overlaying the oob component causing the issue.