Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Richtext - customize b tag into strong tag

Avatar

Level 3

Hi community,

 

in aem 6.5, how can i customize bold <b> tag into <strong>?

i have tried with:

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig jcr:primaryType="nt:unstructured">
<semanticMarkupMap jcr:primaryType="nt:unstructured"
strong="b"/>
</typeConfig>
</docType>
</htmlRules>

but it seems that the replacement is random (not stable). sometime it's work and sometime no. debugging the clientlibs: /libs/clientlibs/granite/richtext.js i saw the "deprecated" word:

davidef34326447_0-1630081741029.png

and during the 

this.elementsToChange = clear(this.elementsToChange);

the list sometime is 0 and other time is correctly catched!

 

davidef34326447_1-1630081835398.png

 

What i'm wrong? my suspect is related to the "<strong>" tag acceptance.. seems that from this customization the tag is replaced and from another side, the tag is converted againt into <b>.

 

tks,

 

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @davidef34326447 

 

Did you try adding the below code? It works perfectly fine for me on AEM 6.5.9.0. It works in any AEM 6.5 version as I am using it from 6.5.3.0 onwards.

 

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
isXhtmlStrict="{Boolean}true"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>

 

Thanks! 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @davidef34326447 

 

Did you try adding the below code? It works perfectly fine for me on AEM 6.5.9.0. It works in any AEM 6.5 version as I am using it from 6.5.3.0 onwards.

 

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
isXhtmlStrict="{Boolean}true"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>

 

Thanks! 

Avatar

Community Advisor

Hi @davidef34326447,

The culprit is markup map node which says to map strong as b(strong="b") instead of b to strong(b="strong")

You can update the typeConfig node as @Asutosh_Jena_ mentioned and remove the semanticmarkupMap node