Add superscript tag dynamically | Community
Skip to main content
Level 3
December 15, 2020
Solved

Add superscript tag dynamically

  • December 15, 2020
  • 4 replies
  • 1771 views

All, I have a problem statement where webhe have supposed to show ® as superscript.But this has not been aded by content author so now am trying to update dynamically . Is there any suggested approach

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

@samr99530769, you can inject this XML block into your touchUI cq_dialog.xml

<subsuperscript jcr:primaryType="nt:unstructured" features="*"/>

Full list of richText options can be found here, https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46

 

4 replies

shelly-goel
Adobe Employee
Adobe Employee
December 15, 2020

@samr99530769  To update the content programmatically, you can create a custom servlet which can take content path as input and then using QueryBuilder/ QueryManger find all the nodes under the specified path that contains the character to be superscripted.

Iterate through the list of nodes and parse the "text" property and update the property adding <sup> </sup> tags around the character using string operations. Save the node and replicate if needed.

Query would be something like this: SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/<your-site-path>]) and CONTAINS(s.*, '<string to be superscripted>')

Kiran_Vedantam
Community Advisor
Community Advisor
December 15, 2020

Superscript is a plugin that is available in RTE. You can enable and author it as per your requirement.

 

Advantages:

Authoring activity

No code changes

One time activity

No technical knowledge needed

 

Disadvantages:

Time-consuming

 

Reference: https://experienceleague.adobe.com/docs/experience-manager-65/administering/operations/rich-text-editor.html?lang=en#operations

 

If you want to add it programmatically, you need to search the nodes that need the tag to be added and update the node.

 

Pros:

Less time consuming

 

Cons:

Depending upon the content, the updation might take time and might impact the server performance

As this is one-time activity (hopefully) the code is useless next time

 

Thanks,

Kiran Vedantam

vanegi
Adobe Employee
Adobe Employee
December 15, 2020

Hi @samr99530769

You can install the package that contains a Touch UI component that uses the RTE including superscript tag plugin as described in below documentation link. 

 

More details at:

https://helpx.adobe.com/experience-manager/using/touchUI_RTE_configure.html#:~:text=You%20can%20create%20an%20Adobe,that%20correspond%20to%20RTE%20plugins

 

Thanks!!

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
December 15, 2020

@samr99530769, you can inject this XML block into your touchUI cq_dialog.xml

<subsuperscript jcr:primaryType="nt:unstructured" features="*"/>

Full list of richText options can be found here, https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46