Search code examples
aemrte

AEM Touch UI RTE common rtePlugins configuration


in classic ui, you can use xtype:cqinclude to include rtePlugins from a different path basically creating one place for standard RTE plugins, How can I do the same in Touch UI?

I have tried using the granite UI include widget, but that does not help as it was not meant for including nodes, but granite widgets/components


Solution

  • I found the solution by debugging RTE, I noticed that RTE sends a request to get the rtePlugins (as JSON) from JCR (using the JSON servlet). with that understanding, I was able to use sling:superResourceType on the rtePlugins node to refer to another rtePlugins node on the JCR. since the JSON servlet will actually respect the superType relationship. Read more abour Sling Resource Merger here: https://docs.adobe.com/docs/en/aem/6-1/develop/platform/sling-resource-merger.html

    eg. if I define rtePlugins node under apps/project/customeRtePlugins/rtePlugins, then in my actual RTE in my touch dialog, I can do the following:

    <rte
        jcr:primaryType="nt:unstructured"
        sling:resourceType="cq/gui/components/authoring/dialog/richtext"                                                                
        name="./rte"
        useFixedInlineToolbar="{Boolean}true">
    
        <rtePlugins 
             jcr:primaryType="nt:unstructured"
             sling:resourceSuperType="apps/project/customeRtePlugins/rtePlugins"/>
    
    </rte>