Skip to content

Commit 25f73c6

Browse files
authored
Merge pull request #60 from contentstack/RT-334
feat: add quotes for inline properties
2 parents 1936865 + bbcce97 commit 25f73c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/toRedactor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ export const toRedactor = (jsonValue: any,options?:IJsonToHtmlOptions) : string
225225
}
226226
if(jsonValue['classname'] || jsonValue['id']){
227227
if(jsonValue['classname'] && jsonValue['id']){
228-
text = `<span class=${jsonValue['classname']} id=${jsonValue['id']}>${text}</span>`
228+
text = `<span class="${jsonValue['classname']}" id="${jsonValue['id']}">${text}</span>`
229229
}
230230
else if(jsonValue['classname'] && !jsonValue['id']){
231-
text = `<span class=${jsonValue['classname']}>${text}</span>`
231+
text = `<span class="${jsonValue['classname']}">${text}</span>`
232232
}
233233
else if(jsonValue['id'] && !jsonValue['classname']){
234-
text = `<span id=${jsonValue['id']}>${text}</span>`
234+
text = `<span id="${jsonValue['id']}">${text}</span>`
235235
}
236236
}
237237
if (jsonValue.text.includes('\n') && !jsonValue['break']) {

test/expectedJson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ export default {
17171717
]
17181718
},
17191719
"inline-classname-and-id": {
1720-
"html": '<p><span>This is test for adding inline <span class=class>class</span> and <span id=id>id</span></span></p>',
1720+
"html": '<p><span>This is test for adding inline <span class="class">class</span> and <span id="id">id</span></span></p>',
17211721
"json": [
17221722
{
17231723
"type": "p",

0 commit comments

Comments
 (0)