Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.5 <B> to <strong> in RTE

Avatar

Avatar
Validate 1
Level 2
JakeCham
Level 2

Likes

6 likes

Total Posts

75 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
JakeCham
Level 2

Likes

6 likes

Total Posts

75 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
JakeCham
Level 2

07-01-2021

I have a requirement that <b> tag should be converted into <strong> after submitting. I was able to achieve this by introducing below node structure as a sibling to rtsPlugins of my text component in apps.

<htmlRules jcr:primaryType="nt:unstructured">
    <docType jcr:primaryType="nt:unstructured">
         <typeConfig jcr:primaryType="nt:unstructured">

                   @useSemanticMarkup Boolean true         

         </typeConfig>
     <docType
<htmlRules

Problem is in our site already we have used RTE for more that 500 odd places and those RTE ,The new change is not getting reflected unless manually editing those RTE components(need to hit twice B icon).Is there anyway to overcome that existing RTE s in pages not getting reflected that change <b> to <strong>.

Thanks in advance. 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Ravi_Pampana
MVP

Likes

192 likes

Total Posts

240 posts

Correct Reply

74 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile

Avatar
Establish
MVP
Ravi_Pampana
MVP

Likes

192 likes

Total Posts

240 posts

Correct Reply

74 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile
Ravi_Pampana
MVP

07-01-2021

Hi,

 

You can try replacing the <b> to <strong> in java while reading value from node property and displaying in htl. This will not replace <b> to <strong> in the jcr node but for in html it will have <strong> instead of <b> for already added rte's. 

 

 

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
raj_mandalapu
MVP

Likes

124 likes

Total Posts

203 posts

Correct Reply

72 solutions
Top badges earned
Validate 1
Contributor
Shape 1
Give Back 5
Give Back 3
View profile
raj_mandalapu
MVP

07-01-2021

The content is already stored in the repository, so the only way you can fix this is by writing Groovy Script, the below script can help you to fix this

 

Note: the code is not tested and it is self-understanding you can modify it if it does not work for you

 

def search = "<b>"
def replace = "<strong>"
def path = "/content"
def property = 'jcr:description';
def query = createSQL2Query(path, search , property)
def result = query.execute()
result.nodes.each{node ->
def description = node.get(property)
println description
node.set('jcr:description', description.replaceAll(search ,replace))
println node.path
}
save()
def createSQL2Query(path, search, property) {
def queryManager = session.workspace.queryManager
def statement = "SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([${path}]) and s.[${property}] like '%${search}%'"
def query = queryManager.createQuery(statement, "JCR-SQL2")
query
}

Avatar

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ankur_Khare
MVP

07-01-2021

Write a groovy script to update existing nodes ,

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,428 likes

Total Posts

3,300 posts

Correct Reply

937 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,428 likes

Total Posts

3,300 posts

Correct Reply

937 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

07-01-2021

Hi,

It is not possible to change the existing stored content without editing manually or via script.