Skip to content

Commit 693fb80

Browse files
Merge branch 'master' into hotfix/img_tag
2 parents a37c8f7 + 4219fd6 commit 693fb80

File tree

6 files changed

+159
-2
lines changed

6 files changed

+159
-2
lines changed

Changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
A brief description of what changes project contains
44

5+
## March 24, 2024
6+
7+
#### v1.2.7
8+
9+
- added support for fragment tag in Json Rte
10+
11+
## Oct 26, 2023
12+
13+
#### v1.2.6
14+
15+
- Fix for line '<br>' tags issue identified in v1.2.5
16+
517
## Oct 5, 2023
618

719
#### v1.2.5

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
2929
<validation-version>2.0.1.Final</validation-version>
3030
<json-version>20231013</json-version>
31-
<spring-web-version>6.0.13</spring-web-version>
31+
<spring-web-version>6.0.18</spring-web-version>
3232
<org.apache.commons-text>1.10.0</org.apache.commons-text>
3333
</properties>
3434

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ public String renderNode(String nodeType, JSONObject nodeObject, NodeCallback ca
158158
return "<code" + strAttrs + ">" + children + "</code>";
159159
case "reference":
160160
return "";
161+
case "fragment":
162+
return "<fragment" + strAttrs + ">" + children + "</fragment>";
161163
default:
162164
return children;
163165
}

src/test/java/com/contentstack/utils/RTEResult.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ public class RTEResult {
1818
public static String kCodeHtml = "<code>Code template.</code>";
1919
public static String kLinkInPHtml = "<p><strong><em><u><sub></sub></u></em></strong><a href=\"LINK.com\">LINK</a></p>";
2020
public static String kEmbedHtml = "<iframe src=\"www.youtube.com/watch?v=AOP0yARiW8U\"></iframe>";
21-
public static String kWFSAffectedHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\"><strong>In this article:<br />\t</strong><a target=\"_self\" href=\"#Overview\">Overview</a><br />\t<a target=\"_self\" href=\"#Fulfillment\">Standard Fulfillment</a><br />\t<a target=\"_self\" href=\"#AdditionalFees\">Additional Fees</a><br />\t<a target=\"_self\" href=\"#BigBulkyFulfillment\">Big & Bulky Fulfillment</a><br />\t<a target=\"_self\" href=\"#Storage\">Storage</a><br />\t<a target=\"_self\" href=\"#ProblemInventory\">Problem Inventory</a><br />\t<a target=\"_self\" href=\"#Return\">Return Shipping & Exceptions</a><br />\t<a target=\"_self\" href=\"#DisposalRemoval\">Disposal & Removal</a><br />\t<a target=\"_self\" href=\"#AdditionalPrograms\">Additional WFS Programs</a></p><h2 redactor-attributes=\"{}\" style=\"\" id=\"Overview\" dir=\"ltr\">Overview</h2><p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">Fulfillment Services is a competitive and cost-effective solution that offers an end-to-end ecommerce fulfillment experience. Our fee structure is simple and straightforward, without signup or monthly subscription fees. You're also free to ship and store any amount of inventory you choose, without minimums or maximums. Use the <a href=\"www.abcd.com/?_gl=1*1t4i6i1*_ga*OTkwMDc3NzQuMTY1MjM3NjY3Nw..*_ga_1LB22TM2MG*MTY1MjcyNDU5My41OS4xLjE2NTI3MjY5NzIuMA..\">WFS Calculator</a> to estimate your fulfillment and storage fees.<br /><br />The following fees are effective as of August 2023 and are subject to change.</p>";
21+
public static String kWFSAffectedHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\"><strong>In this article:<br />\t</strong><a target=\"_self\" href=\"#Overview\">Overview</a><br />\t<a target=\"_self\" href=\"#Fulfillment\">Standard Fulfillment</a><br />\t<a target=\"_self\" href=\"#AdditionalFees\">Additional Fees</a><br />\t<a target=\"_self\" href=\"#BigBulkyFulfillment\">Big & Bulky Fulfillment</a><br />\t<a target=\"_self\" href=\"#Storage\">Storage</a><br />\t<a target=\"_self\" href=\"#ProblemInventory\">Problem Inventory</a><br />\t<a target=\"_self\" href=\"#Return\">Return Shipping & Exceptions</a><br />\t<a target=\"_self\" href=\"#DisposalRemoval\">Disposal & Removal</a><br />\t<a target=\"_self\" href=\"#AdditionalPrograms\">Additional WFS Programs</a></p><h2 redactor-attributes=\"{}\" style=\"\" id=\"Overview\" dir=\"ltr\"><fragment id=\"Overview\">Overview</fragment></h2><p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">Fulfillment Services is a competitive and cost-effective solution that offers an end-to-end ecommerce fulfillment experience. Our fee structure is simple and straightforward, without signup or monthly subscription fees. You're also free to ship and store any amount of inventory you choose, without minimums or maximums. Use the <a href=\"www.abcd.com/?_gl=1*1t4i6i1*_ga*OTkwMDc3NzQuMTY1MjM3NjY3Nw..*_ga_1LB22TM2MG*MTY1MjcyNDU5My41OS4xLjE2NTI3MjY5NzIuMA..\">WFS Calculator</a> to estimate your fulfillment and storage fees.<br /><br />The following fees are effective as of August 2023 and are subject to change.</p>";
2222
public static String kAnchorHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">This is a paragraph with break true and<br />backslash nThis para has just one line break without any break key<br />Third paragraph with multiple line breaks<br /><br /><br />Fourth paragraph with multiple line breaks and break key<br /><br />Fifth paragraph with multiple only tab \t and this is text after tab<br />\tThis paragraph should start with a tab and should have a break before.</p>";
2323
public static String kWFSFeesHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <br /><br /><br />\t\t\t\tUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <br />Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <br />\tExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>";
2424

2525
public static String kONEHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\"><br />A paragraph with break set as trueA paragraph with line break <br /> and \t tab</p>";
26+
27+
public static String kFragment = "<ul redactor-attributes=\"{}\" style=\"\" dir=\"ltr\"><li redactor-attributes=\"{}\" style=\"\" dir=\"ltr\"><fragment><strong>One</strong></fragment><ul style=\"\"><li redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">nested one </li><li redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">nested two </li></ul></li><li redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">Two</li></ul>";
2628
}

src/test/java/com/contentstack/utils/TestRte.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,14 @@ public void testIssueOct() throws IOException {
152152
// Assert.assertEquals(kONEHtml, result);
153153
}
154154

155+
@Test
156+
public void testFragment() throws IOException {
157+
final String rte = "src/test/resources/reports/fragment.json";
158+
JSONObject rteFragment = new ReadResource().readJson(rte);
159+
String[] keyPath = {"json_rte"};
160+
Utils.jsonToHTML(rteFragment, keyPath, new DefaultOption());
161+
Assert.assertEquals(kFragment, rteFragment.get("json_rte"));
162+
}
163+
155164

156165
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"title": "",
3+
"json_rte":
4+
{
5+
"type": "doc",
6+
"attrs":
7+
{},
8+
"uid": "71ff5918b9434999b97c97629aecc32e",
9+
"children":
10+
[
11+
{
12+
"uid": "6b80a5ead10445bf939d39c1f033bed9",
13+
"type": "ul",
14+
"children":
15+
[
16+
{
17+
"uid": "bf242d94ca4847b6a7144c57c03d0c84",
18+
"type": "li",
19+
"attrs":
20+
{
21+
"style":
22+
{},
23+
"redactor-attributes":
24+
{},
25+
"dir": "ltr"
26+
},
27+
"children":
28+
[
29+
{
30+
"type": "fragment",
31+
"children":
32+
[
33+
{
34+
"text": "One",
35+
"bold": true
36+
}
37+
],
38+
"uid": "cc6c5b25a77f443ba7b7cc1c1a92e7cb"
39+
},
40+
{
41+
"uid": "388cdd29331e46859cb78806c30aab52",
42+
"type": "ul",
43+
"attrs":
44+
{
45+
"style":
46+
{}
47+
},
48+
"children":
49+
[
50+
{
51+
"type": "li",
52+
"attrs":
53+
{
54+
"style":
55+
{},
56+
"redactor-attributes":
57+
{},
58+
"dir": "ltr"
59+
},
60+
"uid": "5e35c7de876e463a80d5b7e7bb3dbb46",
61+
"children":
62+
[
63+
{
64+
"text": "nested one "
65+
}
66+
]
67+
},
68+
{
69+
"type": "li",
70+
"attrs":
71+
{
72+
"style":
73+
{},
74+
"redactor-attributes":
75+
{},
76+
"dir": "ltr"
77+
},
78+
"uid": "23015f6106ad47db9142a01fa6e5465c",
79+
"children":
80+
[
81+
{
82+
"text": "nested two "
83+
}
84+
]
85+
}
86+
]
87+
}
88+
]
89+
},
90+
{
91+
"type": "li",
92+
"attrs":
93+
{
94+
"style":
95+
{},
96+
"redactor-attributes":
97+
{},
98+
"dir": "ltr"
99+
},
100+
"uid": "6c3fe490f18347b896d3ac2ec982d389",
101+
"children":
102+
[
103+
{
104+
"text": "Two"
105+
}
106+
]
107+
}
108+
],
109+
"id": "10b11adfd2be427bb20f9e24122a6b48",
110+
"attrs":
111+
{
112+
"style":
113+
{},
114+
"redactor-attributes":
115+
{},
116+
"dir": "ltr"
117+
}
118+
}
119+
],
120+
"_version": 1
121+
},
122+
"tags":
123+
[],
124+
"locale": "en-us",
125+
"uid": "blt9a8011fa3669348b",
126+
"created_by": "blta7bacfb988d2bf5c",
127+
"updated_by": "blt734e8a0a85290dd1",
128+
"created_at": "2024-02-08T10:58:07.835Z",
129+
"updated_at": "2024-02-13T10:59:49.357Z",
130+
"_version": 9,
131+
"_in_progress": true
132+
}

0 commit comments

Comments
 (0)