cq:showOnCreate not working with RTE on Page properties - aem

We are using an RTE field in the page properties. The issue here is, this field doesn't render in the page properties when author is creating the page. Is this a known issue with AEM? Is there any workaround for this?
<bannerText
cq:showOnCreate="{Boolean}true"
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/richtext"
fieldLabel="Banner text"
fieldDescription="This text describes the banner message."
required="true"
name="./bannerText"
useFixedInlineToolbar="{Boolean}true">
<rtePlugins jcr:primaryType="nt:unstructured">
<format
....
<bannerText?>
PS: We are using AEM 6.5
Thanks in advance!

Related

Add granite:data to cq dialog textfield

I am trying to create a validation function for a textfield depending on the content of other textfield in a cq dialog in AEM 6.5.
I am trying to send within the cq:data the textfield name but I can get AEM to render these data attributes on DOM.
This is a piece of the cq dialog
<creditsTitle
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Credits Title"
name="./creditsTitle_t"/>
<creditsValue
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Credits"
validation="custo-validation"
name="./creditsValue_t">
<granite:data jcr:primaryType="nt:unstructured"
dependent-name="creditsTitle_t"/> </creditsValue>
And here is a ss of what gets rendered:
I want to be able to send to the "custo-validation" a parameter with the name of the field that it needs to check,in this case is the one above (creditsTitle_t), but it can be anywhere.
So far the only way I have found is with the granite:data but i can't get it working
Your code looks good. just make sure you're adding the granite namespace at the top of the file
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
sling:resourceType="cq/gui/components/authoring/dialog"
....

AEM 6.5 Pre-populate fileUpload image field in cq dialog

New to AEM, I am trying to programatically populate an fileUpload image dropzone, and silently triggered its drop event as if user had manually drop an image asset to it. Is there a way to do this?
Say I have a cq_dialog with two fileUpload image fields (set to no upload, only droppable from asset allowed), one was already populated prior, the other is empty. Upon dialog load, I want to populate the empty one with the image asset from the populated one as a default.
The snippets of the cq_dialog looks like this:
<imageontopWrap
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="layout-showhide-targets"
showhidetargetvalue="imageontop">
<items jcr:primaryType="nt:unstructured">
<image1
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
allowUpload="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image Asset"
fileReferenceParameter="./myImageTopPath"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./myImageTop"
title="Upload Image Asset"
useHTML5="{Boolean}true"/>
<altText1
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Alt Text"
name="./myImageTopAltText"/>
</items>
</imageontopWrap>
<imageonleftWrap
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="layout-showhide-targets"
showhidetargetvalue="imageonleft">
<items jcr:primaryType="nt:unstructured">
<image2
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
allowUpload="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image Asset"
fileReferenceParameter="./myImageLeftPath"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./myImageLeft"
title="Upload Image Asset"
useHTML5="{Boolean}true"/>
<altText2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Alt Text"
name="./myImageLeftAltText"/>
</items>
</imageonleftWrap>
I had created a clientLib for this cq_dialog, just wasn't sure the js codes to copy the image reference and trigger the drop using script.
Any help is much appreciated.
Here is the mechanism through you can achive what you require I hope. I am not sure about the exact js code though for which you have to do some googling on listners.
On dialog load, store the reference of the first image drop container in a js variable.
Then find the path of the image that is being stored/authored in the first image container.
Populate the same path in the second image drop path.
As I said, above is just a mechanism to help how you can achive your requirement.

Update RTE component to use Block Quotes in AEM

I'm currently using Rich Text Editor (RTE) in my AEM 6.2 project. I would like to configure RTE to use blockquote tag. How can achieve this?
<blockquote>
Component code:
<paraformat jcr:primaryType="nt:unstructured" features="*">
<formats jcr:primaryType="cq:WidgetCollection">
<p jcr:primaryType="nt:unstructured" description="Paragraph" tag="p"/>
<h1 jcr:primaryType="nt:unstructured" description="Heading 1" tag="h1"/>
<h2 jcr:primaryType="nt:unstructured" description="Heading 2" tag="h2"/>
<h3 jcr:primaryType="nt:unstructured" description="Heading 3" tag="h3"/>
<h4 jcr:primaryType="nt:unstructured" description="Heading 4" tag="h4"/>
<h5 jcr:primaryType="nt:unstructured" description="Heading 5" tag="h5"/>
<blockquote jcr:primaryType="nt:unstructured" description="Block Quote" tag="blockquote"/>
</formats>
</paraformat>
Reference:
RTE in JCR
Dialog View
Thanks.
You can add a new block element by following the instructions at official documents:
Adding custom paragraph formats to RTE
Basically, you overlay the RTE and extend the paraformat plugin by introducing the new elements. Summary steps are:
Overlay your RTE
Create cq:EditConfig/inplaceEditing/paraformat/format node under your RTE control.
Create a node for your style, name it blockquote and give it the following properties -> Description: Block Quote & Tag: blockquote
Make sure you add all other default formats like p, H1, H2 etc.
That's it. You should see your new paragraph style available in the paragraph styles dropdown.
This is a summary as all the pictures will make this post too long but a detailed post can be found at: http://www.aemcq5tutorials.com/tutorials/configure-rte-plugin-in-touch-ui/
Optionally, you will need to check if blockquote element is allowed by inspecting your /libs/cq/xssprotection/config.xml file. The file is self explanatory with lots of comments but in general you should check under <tag-rules> to ensure that your tag is supported. OOTB AEM 6.2 allows blockquote element but some upgrades might have lost it.

CQ5-How to add rte plugin in custom widget

I have added richtext in the custom widget but i dont know how to add aditinal plugins for richtext.
Please help how we can achieve the same.
I am trying to add superscript/subscript in the richtext but not able to achieve the same.
Here is a code snippet that I've used to add this functionality to a richtext field.
<text
jcr:primaryType="cq:Widget"
hideLabel="{Boolean}true"
name="./text"
xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
</rtePlugins>
</text>
This snippet belongs in the dialog.xml of your custom component.
please have a look at the documentation for configuring the rich text editor for more information.

How to realize the "undo" functionality in CQ5 Rich Text Editor with a button?

Using CQ Rich Text Editor, I can undo the editing with strg + z. How to connect this functionality with a button? In other words where to find the javascript which is responsible for undo functionality?
In your RTE plugins (in the xml file), use:
<table
jcr:primaryType="nt:unstructured"
features="*"/>
<undo
jcr:primaryType="nt:unstructured"
features="*"/>
Hope this solves your problem.
For more info check here