Expand my Community achievements bar.

SOLVED

Touch UI (Rich Text) Overlay Component does not work when included statically on the template

Avatar

Level 4

 <div data-sly-resource="${ @path='richText' , resourceType='/apps/XXX/components/content/text'}" ></div>

 

Included Statically on a Template.  When Tries to Edit the dialog : 

I see error in console 

GET http://localhost:4502/content/a/b/c/jcr:content/richText.json?_=1458055488719 404 (Not Found)

 

But when I drop the component statically on a template it works fine. 

1 Accepted Solution

Avatar

Correct answer by
Level 8

This is because when you include it that way, the "text" resource is technically null and not available.  Since you're including it in your page component, modify the associated template and pre-set the text node.  Example:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:description="Page Template" jcr:primaryType="cq:Template" jcr:title="Page Template" allowedPaths="[/content/site/en(/.*)?]" ranking="{Long}100"> <jcr:content jcr:primaryType="cq:PageContent" sling:resourceType="site/components/page/interior" cq:designPath="/etc/designs/site"> <text jcr:primaryType="nt:unstructured" sling:resourceType="wcm/foundation/components/text" /> </jcr:content> </jcr:root>

View solution in original post

6 Replies

Avatar

Level 10

WHen you say drop on a template - do you mean while in edit mode - you drag the component from the side rail and then drop the component on a page based on a template? 

Avatar

Level 4

Yes in edit mode I drop a component on a template by dragging it from side rail and I could see dialog coming up. 

When same component is included statically E.g. 

 <div data-sly-resource="${ @path='richText' , resourceType='/apps/XXX/components/content/text'}" ></div>

When I click edit on Dialog I get error on console.

When I click Configure I see , 

Avatar

Level 4

I noticed even when I include OOTB text - Touch UI Component 

<div data-sly-resource="${ @path='11111' ,  resourceType='/libs/wcm/foundation/components/text'}" >  </div>

I get http://localhost:4502/a/b/c/jcr:content/11111.json?_=1458109466899 404 (Not Found)

Is this just something to do with my local or template ?

Avatar

Correct answer by
Level 8

This is because when you include it that way, the "text" resource is technically null and not available.  Since you're including it in your page component, modify the associated template and pre-set the text node.  Example:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:description="Page Template" jcr:primaryType="cq:Template" jcr:title="Page Template" allowedPaths="[/content/site/en(/.*)?]" ranking="{Long}100"> <jcr:content jcr:primaryType="cq:PageContent" sling:resourceType="site/components/page/interior" cq:designPath="/etc/designs/site"> <text jcr:primaryType="nt:unstructured" sling:resourceType="wcm/foundation/components/text" /> </jcr:content> </jcr:root>

Avatar

Level 1

I am currently in the same situation with a similar component. I am including (with the data-sly-resource syntax) 2 different components.

One is a responsive image component that uses droptargets, the other is using a rich text editor component. 
When I drag an asset on the responsive image, it will create the node required to save the data without any issue.
When I try to use the inplace editing of the text component, the dialog for this component fails. This is indeed due to the required node not existing.

This issue seems, as far as I have tested, to be limited to using the inplace editing feature. 

 

The template way partially works but will only work if the component is set using a template to create a page. Any available component in the sidekick will continue to have this issue when it is dragged by an author.
I have currently patched this issue by creating a subnode in java when the component initializes and does not have the node for the nested text component. However I am still looking for a cleaner way to resolve this issue.

Avatar

Level 4

Thanks this was helpful now I can see the Component / Dialog. 

But When I submit the authored content , I get 

 

http://localhost:4502/a/b/c/jcr:content/jcr:content/richText.html?forceeditcontext=true&_=1458164194121 404 (Not Found)