Skip to content

Commit 17eebe1

Browse files
bug:(CS-37173)-unexpected-new-lines
Fixed Node type: Added break in the the node
1 parent a108c2d commit 17eebe1

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/main/java/com/contentstack/utils/node/MarkType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
* The enum Mark type.
55
*/
66
public enum MarkType {
7-
BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, INLINECODE, SUBSCRIPT, SUPERSCRIPT,
7+
BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, INLINECODE, SUBSCRIPT, SUPERSCRIPT, BREAK,
88
}

src/main/java/com/contentstack/utils/node/NodeToHTML.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public static String textNodeToHTML(JSONObject nodeText, Option renderOption) {
4747
if (nodeText.has("bold")) {
4848
text = renderOption.renderMark(MarkType.BOLD, text);
4949
}
50+
if (nodeText.has("break")) {
51+
text = renderOption.renderMark(MarkType.BREAK, text);
52+
}
5053
return text;
5154
}
5255

src/main/java/com/contentstack/utils/render/DefaultOption.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
public class DefaultOption implements Option {
1111

1212
/**
13-
* Accepts below params to provides defaults options
13+
* Accepts below params to provide defaults options
1414
*
1515
* @param embeddedObject
1616
* entry embedded object
1717
* @param metadata
1818
* for of the entry object
19-
* @return String as result
19+
* @return String as a result
2020
*/
2121
@Override
2222
public String renderOptions(JSONObject embeddedObject, Metadata metadata) {
@@ -51,6 +51,8 @@ public String renderMark(MarkType markType, String text) {
5151
return "<em>" + text + "</em>";
5252
case BOLD:
5353
return "<strong>" + text + "</strong>";
54+
case BREAK:
55+
return "<br />" + text;
5456
default:
5557
return text;
5658
}

0 commit comments

Comments
 (0)