Customise hyperlinks in aem/cq - adobe

The following link shows RichtextEditor using Links
https://docs.adobe.com/docs/en/cq/5-6-1/wcm/using_rich_text_editor.html#Links
My requirement is I need to customise Hyperlink or I need to customise rich text editor so that I need a button like mailto:
so on clicking that button I can have a text box to enter the email address.
I have found that one needs to customise the extjs of rte pluigins, but not sure what I need to? Any thoughts?

You need to add a "HTML rules" node inside the richtext xtype of your dialog.xml. Add a "Links" node as a child of this & you can configure the allowed protocols:
<text
jcr:primaryType="cq:Widget"
xtype="richtext">
<htmlRules
jcr:primaryType="nt:unstructured">
<links
jcr:primaryType="nt:unstructured"
protocols="[http://,https://,mailto:]"/>
</htmlRules>
</text>

Related

How to edit Teaser's Tab options order on AEM?

I'm (trying) customizing the Teaser component on .content.xml to reach out to my requirements but I don't understand how I can set up an order to tabs options. The best solution would be to write some logic to hide/unhide the Teaser's fields based on the parent component, but I don't know how to do it yet. Meanwhile, I'm editing the XML file.
Options:
Image
Metadata
Text
Link & Actions
The first thing stranger is that I've written the code to show only three options but on AEM Editor keeping showing all options, with "Link & Actions" not declared on .XML. As you can see in the print below.
Path file: ui.apps/.../components/teaser/_cq_dialog/.content.xml
The second thing is that I want to put "Link & Actions" options as the last option on the tab bar. So, how make it?
The following print is my current behavior.
The behaviour you notice is due to Sling's Resource Merger feature. The same feature can be leveraged to achieve everything that you want to do.
To answer your question in parts
You see Links & Actions tab even though you've not defined it in your dialog because your component extends the OOB teaser component and the Sling Resource Merger would merge the options in the parent and the child dialogs to create the final dialog that is presented to the author.
This allows easily extending the features of the parent and only defining the custom properties within your dialog. For e.g. If you only need to add a new tab called Metadata in your teaser component it is enough to just create configurations for that new tab in your custom component and the rest of the configs will flow through from your parent component.
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata ...>
</items>
</tabs>
You can then use the following properties provided by Sling to further customise the ordering of the properties / tabs or remove / hide some properties.
sling:hideProperties - Specifies the property, or list of properties, to hide. The wildcard * hides all.
sling:hideResource - Indicates whether the resources should be completely hidden, including its children.
sling:hideChildren - Contains the child node, or list of child nodes, to hide. The properties of the node will be maintained. The wildcard * hides all.
sling:orderBefore - Contains the name of the sibling node that the current node should be positioned in front of.
Now to answer your second part, if you want to hide the Links & Actions tab completely in your component, then create a node called actions (same name as parent) and then set the property sling:hideResource to true
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata ...>
<actions
jcr:primaryType="nt:unstructured"
sling:hideResource="{Boolean}true"/>
</items>
</tabs>
Alternatively, if you don't want it removed but just moved to the end, just create a node called actions and place it after all the other nodes or use the sling:orderBefore property to specify the order of the tabs. An example of order before shown below where metadata tab appears second, followed by text and then links and actions.
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata
jcr:primaryType="nt:unstructured"
sling:orderBefore="text"
...>
<text
jcr:primaryType="nt:unstructured"
sling:orderBefore="actions"/>
</items>
</tabs>
EDIT: How do you know what tab names to use?:
Sling Resource Merger works when you overlay a component (think of it like inheritance in Java where you are extending another class).
You can overlay an existing component using the property sling:resourceSuperType on the component node. For e.g., this is the screenshot of my teaser component which is overlaying the OOB teaser component core/wcm/components/teaser/v1/teaser.
Since it is not an absolute path, the order of preference for seaching the component in the repository is /libs/ followed by /apps/
So, searching under /libs/ I was able to find the component at /libs/core/wcm/components/teaser/v1/teaser and expanding the dialog showed the following tabs. The same names need to be used in our component to override the position or visibility or any other sling merger features.
I would recommend understanding the inheritance concepts of Sling in general to make it easier working with AEM.

how can i change Go to text in Quick Jumper antd pagination

I tried changing go to text in ant design pagination.
document says use showQuickJumper={{ goButton: "Your text" }} but result is:
antd pagination go to text
as you see "go to" text is still visible.
how to hide it?
The showQuickJumper parameter affects the display of the quick jump block.
If a component is passed as a goButton value, then it will be displayed as a confirmation button.
In order to achieve the desired behavior and change the "Go to" text to another, you need to pass the locale parameter and override the jump_to property.
<Pagination
showQuickJumper={{
goButton: <button>Your custom button to confirm</button>
}}
total={500}
locale={{ jump_to: "Your text" }}
/>
Unfortunately there is no indication about this anywhere in the documentation. It is relevant for antd version 4.17.0 and earlier
You can use locale
<Pagination
locale={{ jump_to: "Your text", page: 'Your page' }}
/>

Cannot edit images inside sitecore field renderer

I have used Sitecore field renderer for one of my page to be edited in the Sitecore page editor. That page includes an image which needs to be reference from Sitecore media library.
So I insert the image control into the markup of the Sitecore field renderer as follows
<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />
“~/media/Images/What is a Business Account/businessAdFeatures.ashx” is the path to the image that stored in Sitecore media folder.
Now the image is rendered properly inside the page, but when I tried to edit that image (upload a new image) using Sitecore page editor it’s not allow me.
Is there any way to make the image editable (Upload a new image) when I open that page in Sitecore page editor?
Thanks
Thank you for the ideas.
But my problem is little bit different. I have Sitecore field renderer in in my sample page.
<sc:FieldRenderer ID="frTestPage" runat="server" />
From the code behind on that page, I bind a Sitecore item as follows.
frTestPage.Item = DatabaseManager.MasterDatabase.GetItem(“itemID1”);
frTestPage.FieldName = "Content";
In the item that I’m binding to the field renderer, it has richtextbox field name “Content”.
Within that “Content” field I have inserted my markup to be render to the page. So that markup consist of following img tag and other relevant HTML.
<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />
So how can I give the image src path correctly which reference to an image in Sitecore media library.
It's wrong to use hardcoded path for images:
You can see all parameters here.
If you use XSLT to render your images, you can apply the parameters on the sc:image directly:
<sc:image field="MyImage" width="150" height="100" bc="ffffff"/>
If you use UserControls (.ascx) to render your images, you can register the following tagprefix to access sc:Image and sc:FieldRenderer:
<%# Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
You can use Edit(Page Editor), then More -> Insert Image, see:
Also, to have a more edit options you can use "Edit e related Item"

Unstyling the contact-info popup in plone.app.theming on Plone 4.1

I am creating a new plone.app.theming (Diazo) theme for my site. My rules.xml has the rule:
<theme href="theme.html" css:if-content="#visual-portal-wrapper" />
This unstyles many popups, but not the contact-info AJAX popup box, which is empty. I can unstyle it using the following rule:
<notheme css:if-content="body.template-contact-info"/>
but this means that any user visiting that page, and not rendering it in a popup, will see it unstyled.
How can I successfully unstyle the contact-info popup box?
The login form popup is wrapped inside a <div class="pb-ajax">. Just look at the generated HTML that creates the popup and you will find a class or identifier that you can use to select that particular popup.
On the other hand you can also customize the Plone view that creates this piece of HTML. Though it will be much easier to try to get a class or identifier.

how to put the node:link token in the html a label?

i have installed the views and token module. i add a views field 'Node:Link' and check the 'exclude from display' option for the 'node:link' field and set the field first in the field order,now i want to overrite a views field.
i put this more >> in the rewrite the output of this field text box. but it can't work? [view_node] is the Node:Link token, how to make the more>> link ok? thank you
In the Node:Link field, enter more in Text to display: text box.
No need to put anchor tag just type [view_node] in the rewrite the output of this field text box.
Views has a built in way to make text link to other pages with tokens. I would use that instead of putting the anchor tag in the rewrite section. It's titled, "Output this field as a link"
If you're on Drupal 6 and you just want to link the field to it's node then just check the box "Link this field to it's node"

Resources