diff --git a/.talismanrc b/.talismanrc index a2bfebf..22826d6 100644 --- a/.talismanrc +++ b/.talismanrc @@ -2,5 +2,7 @@ threshold: medium fileignoreconfig: -- filename: .dccache - checksum: 140eb49c2bad3edadf62c926625f3bb304e904c38f2a9a5a57e9f6dc7163f61e +- filename: src/test/resources/issue/jsonfile.json + checksum: d67cd6db0795f8c5a5f5edf34a457720191e8894889e9f9bb4b8106c23b40799 + + diff --git a/CODEOWNERS b/CODEOWNERS index d81d223..0773923 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @contentstack/security-admin @contentstack/sdk-admin +* @contentstack/security-admin \ No newline at end of file diff --git a/pom.xml b/pom.xml index c37edbf..a2966df 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.contentstack.sdk utils - 1.2.1 + 1.2.2 jar Contentstack-utils Java Utils SDK for Contentstack Content Delivery API, Contentstack is a headless CMS @@ -22,7 +22,7 @@ 2.2.1 3.1.1 4.13.2 - 1.15.4 + 1.16.1 1.1.1 3.3 1.5 @@ -30,7 +30,7 @@ 2.5.3 2.0.1.Final 20230227 - 6.0.4 + 6.0.7 diff --git a/src/main/java/com/contentstack/utils/AutomateCommon.java b/src/main/java/com/contentstack/utils/AutomateCommon.java index 8524a6e..6b45391 100644 --- a/src/main/java/com/contentstack/utils/AutomateCommon.java +++ b/src/main/java/com/contentstack/utils/AutomateCommon.java @@ -175,6 +175,10 @@ private static String extractKeys(@NotNull JSONObject jsonNode, Option renderObj if (filteredContent.isPresent()) { JSONObject contentToPass = filteredContent.get(); return getStringOption(renderObject, metadata, contentToPass); + } else { + if (attrType.equalsIgnoreCase(ASSET)) { + return renderObject.renderNode("img", jsonNode, nodeJsonArray -> doRawProcessing(nodeJsonArray, renderObject, embedItem)); + } } } else { diff --git a/src/main/java/com/contentstack/utils/render/DefaultOption.java b/src/main/java/com/contentstack/utils/render/DefaultOption.java index b0ce832..47cbf32 100644 --- a/src/main/java/com/contentstack/utils/render/DefaultOption.java +++ b/src/main/java/com/contentstack/utils/render/DefaultOption.java @@ -67,6 +67,10 @@ public String renderNode(String nodeType, JSONObject nodeObject, NodeCallback ca case "a": return "" + children + ""; case "img": + String assetLink = getNodeStr(nodeObject, "asset-link"); + if (!assetLink.isEmpty()) { + return "" + children; + } return "" + children; case "embed": return ""; @@ -124,6 +128,7 @@ private String getNodeStr(JSONObject nodeObject, String key) { return herf; } + /** * Returns Title From The Embedded Object of type entry * diff --git a/src/test/java/com/contentstack/utils/AssetLinkTest.java b/src/test/java/com/contentstack/utils/AssetLinkTest.java new file mode 100644 index 0000000..6a33e60 --- /dev/null +++ b/src/test/java/com/contentstack/utils/AssetLinkTest.java @@ -0,0 +1,31 @@ +package com.contentstack.utils; + +import com.contentstack.utils.render.DefaultOption; +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; + +public class AssetLinkTest { + + + private static JSONObject assetLink = null; + + + @BeforeClass + public static void startUtilTests() throws IOException { + final String ASSERT_LINK = "src/test/resources/issue/jsonfile.json"; + assetLink = new ReadResource().readJson(ASSERT_LINK); + } + + @Test + public void testRenderFunction() { + String[] keys = new String[1]; + keys[0] = "assetlink"; + Utils.jsonToHTML(assetLink, keys, new DefaultOption()); + System.out.println(assetLink); + Assert.assertEquals("", assetLink.opt("assetlink").toString()); + } +} diff --git a/src/test/resources/issue/jsonfile.json b/src/test/resources/issue/jsonfile.json new file mode 100644 index 0000000..891940a --- /dev/null +++ b/src/test/resources/issue/jsonfile.json @@ -0,0 +1,832 @@ +{ + "_version": 10, + "locale": "en-us", + "uid": "cb70aa8425b4676c", + "ACL": {}, + "assetlink": { + "uid": "node_uid_12", + "_version": 1, + "attrs": {}, + "children": [ + { + "uid": "node_uid_1", + "type": "reference", + "attrs": { + "display-type": "display", + "asset-uid": "asset_uid_1", + "content-type-uid": "sys_assets", + "asset-link": "https://image.url/11.jpg", + "asset-name": "11.jpg", + "asset-type": "image/jpeg", + "type": "asset", + "class-name": "embedded-asset", + "width": 25.16914749661705, + "className": "dsd", + "id": "sdf" + }, + "children": [ + { + "text": "" + } + ] + } + ], + "type": "doc" + }, + "_embedded_items": { + "global_rich.modular_blocks.rich_in_modular.rich_text_editor": [ + { + "uid": "7324a68403ee7281", + "created_at": "2020-10-12T06:18:43.815Z", + "updated_at": "2020-10-20T13:31:48.635Z", + "created_by": "theCreatedby", + "updated_by": "cd8cc4e3db7b72f1", + "content_type": "image/jpeg", + "file_size": "11773", + "_content_type_uid": "asset", + "filename": "11.jpg", + "url": "https://dev16-images.contentstack.com/v3/assets/77263d300aee3e6b/7324a68403ee7281/5f83f543d418e407f919e0e4/11.jpg", + "_version": 2, + "title": "11.jpg", + "description": "dddd", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-28T12:11:09.538Z", + "user": "userId" + } + } + ], + "global_rich_multiple.group.rich_text_editor": [ + { + "uid": "7324a68403ee7281", + "created_at": "2020-10-12T06:18:43.815Z", + "updated_at": "2020-10-20T13:31:48.635Z", + "created_by": "theCreatedby", + "updated_by": "cd8cc4e3db7b72f1", + "content_type": "image/jpeg", + "file_size": "11773", + "_content_type_uid": "0_solve", + "filename": "11.jpg", + "url": "https://dev16-images.contentstack.com/v3/assets/77263d300aee3e6b/7324a68403ee7281/5f83f543d418e407f919e0e4/11.jpg", + "_version": 2, + "title": "11.jpg", + "description": "dddd", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-28T12:11:09.538Z", + "user": "theUserId" + } + } + ], + "global_rich_multiple.group.rich_text_editor_multiple": [ + { + "uid": "7324a68403ee7281", + "created_at": "2020-10-12T06:18:43.815Z", + "updated_at": "2020-10-20T13:31:48.635Z", + "created_by": "theCreatedby", + "updated_by": "cd8cc4e3db7b72f1", + "content_type": "image/jpeg", + "file_size": "11773", + "_content_type_uid": "0_solve", + "filename": "11.jpg", + "url": "https://dev16-images.contentstack.com/v3/assets/77263d300aee3e6b/7324a68403ee7281/5f83f543d418e407f919e0e4/11.jpg", + "_version": 2, + "title": "11.jpg", + "description": "dddd", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-28T12:11:09.538Z", + "user": "theUserId" + } + } + ], + "modular_blocks.rich_text_inmodular.rich_text_editor_multiple": [ + { + "uid": "7324a68403ee7281", + "created_at": "2020-10-12T06:18:43.815Z", + "updated_at": "2020-10-20T13:31:48.635Z", + "created_by": "theCreatedby", + "updated_by": "cd8cc4e3db7b72f1", + "content_type": "image/jpeg", + "file_size": "11773", + "_content_type_uid": "0_solve", + "filename": "11.jpg", + "url": "https://dev16-images.contentstack.com/v3/assets/77263d300aee3e6b/7324a68403ee7281/5f83f543d418e407f919e0e4/11.jpg", + "_version": 2, + "title": "11.jpg", + "description": "dddd", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-28T12:11:09.538Z", + "user": "theUserId" + } + } + ], + "rich_text_editor": [ + { + "title": "Manish New entry", + "url": "/suraj-123-entry", + "single_line": "Single line textbox", + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "markdown": "fsdfsdfsdfasf", + "modular_blocks": [ + { + "block_1": { + "multi_line": "sdfsadfsdafsadfSFDSADVASMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "TWETWETWET", + "_metadata": { + "uid": "cscf1ee8f242fc62ad" + } + } + } + ], + "suraj_123": [ + { + "single_line": "FSDGSDGSDGDF", + "rich_text_editor": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "markdown": "", + "number": 4553453453, + "_metadata": { + "uid": "csf7d76dfe7f2ff55b" + } + }, + { + "single_line": "222222222222", + "rich_text_editor": "33333333333333333333333333333", + "markdown": "44444444444444444444444444", + "number": 56789021, + "_metadata": { + "uid": "cs51d4d964e262fccd" + } + } + ], + "locale": "en-us", + "uid": "41a3bf40728446c3", + "created_by": "theCreatedby", + "updated_by": "theUserId", + "created_at": "2020-01-08T05:58:32.735Z", + "updated_at": "2020-09-30T06:15:31.196Z", + "_content_type_uid": "00_suraj", + "_version": 5, + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T06:27:30.470Z", + "user": "theUserId" + } + }, + { + "uid": "120a5a04d91c9466", + "created_at": "2020-05-13T05:33:10.496Z", + "updated_at": "2020-05-13T05:33:10.496Z", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "content_type": "image/png", + "file_size": "59014", + "_content_type_uid": "0_solve", + "filename": "iphone-mockup.png", + "url": "https://dev16-images.contentstack.com/v3/assets/iphone-mockup.png", + "ACL": {}, + "_version": 1, + "title": "iphone-mockup.png", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-07T12:51:11.012Z", + "user": "theCreatedby" + } + } + ], + "global_rich_multiple.modular_blocks.rich_in_modular.rich_text_editor_multiple": [ + { + "uid": "7324a68403ee7281", + "created_at": "2020-10-12T06:18:43.815Z", + "updated_at": "2020-10-20T13:31:48.635Z", + "created_by": "theCreatedby", + "updated_by": "cd8cc4e3db7b72f1", + "content_type": "image/jpeg", + "file_size": "11773", + "_content_type_uid": "0_solve", + "filename": "11.jpg", + "url": "https://dev16-images.contentstack.com/v3/assets/77263d300aee3e6b/7324a68403ee7281/5f83f543d418e407f919e0e4/11.jpg", + "_version": 2, + "title": "11.jpg", + "description": "dddd", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-28T12:11:09.538Z", + "user": "theUserId" + } + } + ], + "global_rich.rich_text_editor": [ + { + "title": "Manish New entry", + "url": "/suraj-123-entry", + "single_line": "Single line textbox", + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "markdown": "fsdfsdfsdfasf", + "modular_blocks": [ + { + "block_1": { + "multi_line": "sdfsadfsdafsadfSFDSADVASMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "TWETWETWET", + "_metadata": { + "uid": "cscf1ee8f242fc62ad" + } + } + } + ], + "suraj_123": [ + { + "single_line": "FSDGSDGSDGDF", + "rich_text_editor": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "markdown": "", + "number": 4553453453, + "_metadata": { + "uid": "csf7d76dfe7f2ff55b" + } + }, + { + "single_line": "222222222222", + "rich_text_editor": "33333333333333333333333333333", + "markdown": "44444444444444444444444444", + "number": 56789021, + "_metadata": { + "uid": "cs51d4d964e262fccd" + } + } + ], + "locale": "en-us", + "uid": "41a3bf40728446c3", + "created_by": "theCreatedby", + "updated_by": "theUserId", + "created_at": "2020-01-08T05:58:32.735Z", + "updated_at": "2020-09-30T06:15:31.196Z", + "_content_type_uid": "00_suraj", + "_version": 5, + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T06:27:30.470Z", + "user": "user_id" + } + } + ], + "global_rich.group.rich_text_editor": [ + { + "title": "Entry 001 123", + "url": "/untitled", + "single_line": "", + "multi_line": "", + "rich_text_editor": "", + "locale": "en-us", + "uid": "1c9e75e3608f8c6b", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-09-30T14:34:30.401Z", + "updated_at": "2020-09-30T14:35:57.483Z", + "_content_type_uid": "0_solve", + "_version": 4, + "_embedded_items": [ + { + "uid": "1c9e75e3608f8c6b", + "_content_type_uid": "0_solve" + } + ], + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T14:36:11.282Z", + "user": "theCreatedby" + } + } + ], + "modular_blocks.global_modular.modular_blocks.rich_in_modular.rich_text_editor_multiple": [ + { + "uid": "49af3673cdd268a5", + "_content_type_uid": "0_solve" + } + ], + "group.rich_text_editor_multiple": [ + { + "locale": "en-us", + "ACL": {}, + "_in_progress": false, + "_version": 1, + "created_at": "2020-01-08T07:05:09.667Z", + "created_by": "theCreatedby", + "markdown": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "modular_blocks": [ + { + "block_1": { + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "Single line textbox in block master 1" + } + } + ], + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "single_line": "Single line textbox", + "suraj_123": [ + { + "single_line": "Multi line textbox", + "rich_text_editor": "", + "markdown": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "number": 45346346 + } + ], + "title": "Copy of Entry final 01", + "uid": "f2fb45e5fc46f8d4", + "updated_at": "2020-01-08T07:05:09.667Z", + "updated_by": "theCreatedby", + "url": "/copy-of-entry-final-01", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-14T15:41:23.760Z", + "user": "theUserId" + }, + "_content_type_uid": "00_suraj_final" + } + ], + "modular_blocks.global_modular.rich_text_editor_multiple": [ + { + "title": "Entry 001 123", + "url": "/untitled", + "single_line": "", + "multi_line": "", + "rich_text_editor": "", + "locale": "en-us", + "uid": "1c9e75e3608f8c6b", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-09-30T14:34:30.401Z", + "updated_at": "2020-09-30T14:35:57.483Z", + "_content_type_uid": "0_solve", + "_version": 4, + "_embedded_items": [ + { + "uid": "1c9e75e3608f8c6b", + "_content_type_uid": "0_solve" + } + ], + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T14:36:11.282Z", + "user": "theCreatedby" + } + } + ], + "modular_blocks.global_modular.group.rich_text_editor_multiple": [ + { + "uid": "92875864eb2678c6", + "_content_type_uid": "0_bug_1" + } + ], + "modular_blocks.global_modular.modular_blocks.rich_in_modular.rich_text_editor": [ + { + "title": "Entry 11 00 Suraj", + "url": "/entry-11-00-suraj", + "single_line": "Single line textbox", + "multi_line": "wsdqweqweqweqwe", + "rich_text_editor": "qweqweqwe", + "markdown": "> eqweqweqweqwe", + "modular_blocks": [ + { + "block_1": { + "multi_line": "FSDGSDGSDGDFFSDGSDGSDGDFFSDGSDGSDGDFFSDGSDGSDGDF", + "single_line": "Single line textbox in block master 1" + } + } + ], + "locale": "en-us", + "uid": "b9e1cfc94315f8eb", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-01-08T06:18:21.759Z", + "updated_at": "2020-01-08T06:18:21.759Z", + "_content_type_uid": "00_copy_of_00_suraj", + "_version": 1, + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-05-04T08:43:36.476Z", + "user": "theCreatedby" + } + } + ], + "global_rich.rich_text_editor_multiple": [ + { + "uid": "49af3673cdd268a5", + "_content_type_uid": "0_solve" + } + ], + "group.rich_text_editor": [ + { + "title": "Manish New entry", + "url": "/suraj-123-entry", + "single_line": "Single line textbox", + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "markdown": "fsdfsdfsdfasf", + "modular_blocks": [ + { + "block_1": { + "multi_line": "sdfsadfsdafsadfSFDSADVASMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "TWETWETWET", + "_metadata": { + "uid": "cscf1ee8f242fc62ad" + } + } + } + ], + "suraj_123": [ + { + "single_line": "FSDGSDGSDGDF", + "rich_text_editor": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "markdown": "", + "number": 4553453453, + "_metadata": { + "uid": "csf7d76dfe7f2ff55b" + } + }, + { + "single_line": "222222222222", + "rich_text_editor": "33333333333333333333333333333", + "markdown": "44444444444444444444444444", + "number": 56789021, + "_metadata": { + "uid": "cs51d4d964e262fccd" + } + } + ], + "locale": "en-us", + "uid": "41a3bf40728446c3", + "created_by": "theCreatedby", + "updated_by": "theUserId", + "created_at": "2020-01-08T05:58:32.735Z", + "updated_at": "2020-09-30T06:15:31.196Z", + "_content_type_uid": "00_suraj", + "_version": 5, + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T06:27:30.470Z", + "user": "theUserId" + } + } + ], + "global_rich.group.rich_text_editor_multiple": [ + { + "title": "Entry 001 123", + "url": "/untitled", + "single_line": "", + "multi_line": "", + "rich_text_editor": "", + "locale": "en-us", + "uid": "1c9e75e3608f8c6b", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-09-30T14:34:30.401Z", + "updated_at": "2020-09-30T14:35:57.483Z", + "_content_type_uid": "0_solve", + "_version": 4, + "_embedded_items": [ + { + "uid": "1c9e75e3608f8c6b", + "_content_type_uid": "0_solve" + } + ], + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T14:36:11.282Z", + "user": "theCreatedby" + } + } + ], + "modular_blocks.global_modular.group.rich_text_editor": [ + { + "uid": "92875864eb2678c6", + "_content_type_uid": "0_bug_1" + } + ], + "global_rich_multiple.rich_text_editor": [ + { + "locale": "en-us", + "ACL": {}, + "_in_progress": false, + "_version": 1, + "created_at": "2020-01-08T06:16:52.122Z", + "created_by": "theCreatedby", + "markdown": "fsdfsdfsdfasf", + "modular_blocks": [ + { + "block_1": { + "multi_line": "sdfsadfsdafsadfSFDSADVASMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "TWETWETWET" + } + } + ], + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "single_line": "Single line textbox", + "suraj_123": [ + { + "single_line": "FSDGSDGSDGDF", + "rich_text_editor": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "markdown": "", + "number": 4553453453 + }, + { + "single_line": "222222222222", + "rich_text_editor": "33333333333333333333333333333", + "markdown": "44444444444444444444444444", + "number": 56789021 + } + ], + "title": "Copy of Suraj 123 Entry", + "uid": "3e080541e130736b", + "updated_at": "2020-01-08T06:16:52.122Z", + "updated_by": "theCreatedby", + "url": "/copy-of-suraj-123-entry", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-04-01T08:14:35.247Z", + "user": "theCreatedby" + }, + "_content_type_uid": "00_suraj" + } + ], + "modular_blocks.global_modular.rich_text_editor": [ + { + "title": "Entry 1", + "url": "/entry-1", + "single_line": "Single line textbox", + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "Rich text editorRich text editorRich text editorRich text editorRich text editor", + "select": "123", + "glob": [ + { + "single_line": "11111111111111", + "multi_line": "222222222222", + "markdown": "333333333333333", + "number": 444444444444444, + "boolean": false + }, + { + "single_line": "555555555555555", + "multi_line": "66666666666", + "markdown": "777777777777", + "number": 888888888888888, + "boolean": true + } + ], + "locale": "en-us", + "uid": "4d27c2875ffcaefc", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-01-03T06:55:42.057Z", + "updated_at": "2020-01-03T06:55:42.057Z", + "_content_type_uid": "0_solve", + "_version": 1, + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-05-04T08:43:36.476Z", + "user": "theCreatedby" + } + } + ], + "global_rich_multiple.modular_blocks.rich_in_modular.rich_text_editor": [ + { + "title": "Entry 001 123", + "url": "/untitled", + "single_line": "", + "multi_line": "", + "rich_text_editor": "", + "locale": "en-us", + "uid": "1c9e75e3608f8c6b", + "created_by": "theCreatedby", + "updated_by": "theCreatedby", + "created_at": "2020-09-30T14:34:30.401Z", + "updated_at": "2020-09-30T14:35:57.483Z", + "_content_type_uid": "0_solve", + "_version": 4, + "_embedded_items": [ + { + "uid": "1c9e75e3608f8c6b", + "_content_type_uid": "0_solve" + } + ], + "_in_progress": false, + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-09-30T14:36:11.282Z", + "user": "theCreatedby" + } + } + ], + "global_rich_multiple.rich_text_editor_multiple": [ + { + "uid": "49af3673cdd268a5", + "_content_type_uid": "0_solve" + } + ], + "modular_blocks.rich_text_inmodular.rich_text_editor": [ + { + "locale": "en-us", + "ACL": {}, + "_in_progress": false, + "_version": 1, + "created_at": "2020-01-08T07:05:09.667Z", + "created_by": "theCreatedby", + "markdown": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "modular_blocks": [ + { + "block_1": { + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "single_line": "Single line textbox in block master 1" + } + } + ], + "multi_line": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "rich_text_editor": "", + "single_line": "Single line textbox", + "suraj_123": [ + { + "single_line": "Multi line textbox", + "rich_text_editor": "", + "markdown": "Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox", + "number": 45346346 + } + ], + "title": "Copy of Entry final 01", + "uid": "f2fb45e5fc46f8d4", + "updated_at": "2020-01-08T07:05:09.667Z", + "updated_by": "theCreatedby", + "url": "/copy-of-entry-final-01", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-10-14T15:41:23.760Z", + "user": "theUserId" + }, + "_content_type_uid": "00_suraj_final" + } + ], + "global_rich.modular_blocks.rich_in_modular.rich_text_editor_multiple": [ + { + "uid": "2fcbb159a2a4c216", + "_content_type_uid": "0_bug_1" + } + ] + }, + "_in_progress": false, + "created_at": "2020-10-06T08:17:56.955Z", + "created_by": "theCreatedBy", + "global_rich": { + "rich_text_editor": "Global", + "rich_text_editor_multiple": [ + "global 2Global" + ], + "group": { + "rich_text_editor": "\nGlobal group 1", + "rich_text_editor_multiple": [ + "" + ] + }, + "modular_blocks": [ + { + "rich_in_modular": { + "rich_text_editor": "global \n modular 1", + "rich_text_editor_multiple": [ + "global modular 2" + ], + "_metadata": { + "uid": "csa79c950db2d52503" + } + } + } + ] + }, + "global_rich_multiple": [ + { + "rich_text_editor": "Global multiple 1", + "rich_text_editor_multiple": [ + "Global multiple 2" + ], + "group": { + "rich_text_editor": "Global multiple group 1", + "rich_text_editor_multiple": [ + "Global multiple group 2" + ] + }, + "modular_blocks": [ + { + "rich_in_modular": { + "rich_text_editor": "Global multiple modular 1", + "rich_text_editor_multiple": [ + "Global multiple modular\n 2" + ], + "_metadata": { + "uid": "cs6d492f34be84aa04" + } + } + } + ], + "_metadata": { + "uid": "csed3e41fc79756950" + } + } + ], + "group": { + "rich_text_editor": "Group 1", + "rich_text_editor_multiple": [ + "Gro /copy-of-entry-final-01up 2" + ] + }, + "modular_blocks": [ + { + "rich_text_inmodular": { + "rich_text_editor": "\nModul 1", + "rich_text_editor_multiple": [ + "module 2 " + ], + "_metadata": { + "uid": "csb005424df53ebe6d" + } + } + }, + { + "global_modular": { + "rich_text_editor": "Global 1", + "rich_text_editor_multiple": [ + "Global 2" + ], + "group": { + "rich_text_editor": "Global group 1", + "rich_text_editor_multiple": [ + "Global Global 2" + ] + }, + "modular_blocks": [ + { + "rich_in_modular": { + "rich_text_editor": "Global 1", + "rich_text_editor_multiple": [ + "Module 2" + ], + "_metadata": { + "uid": "cs3a04936ad071c1f6" + } + } + } + ], + "_metadata": { + "uid": "csee93977f7b5e442d" + } + } + } + ], + "reference": [ + { + "uid": "9c95983f8f327537", + "_content_type_uid": "embed_entry" + } + ], + "rich_text_editor": "\none\n", + "rich_text_editor_multiple": [ + "Two" + ], + "title": "Test Rich Text", + "updated_at": "2020-11-05T08:26:14.590Z", + "updated_by": "theCreatedBy", + "url": "/test-rich-text", + "publish_details": { + "environment": "be240fa93baafa15", + "locale": "en-us", + "time": "2020-11-05T08:26:24.826Z", + "user": "theCreatedBy" + } +} + diff --git a/src/test/resources/issue/newline.json b/src/test/resources/issue/newline.json new file mode 100644 index 0000000..994916c --- /dev/null +++ b/src/test/resources/issue/newline.json @@ -0,0 +1,182 @@ +{ + "uid": "4e52e62e39844184b139c812a94b275f", + "children": [ + { + "uid": "5c3cc441f6394f019a33632feff4c5b5", + "children": [ + { + "text": "First Heading" + } + ], + "type": "p", + "attrs": {} + }, + { + "uid": "3c5625fac71c42a7b22b82f7d2370b77", + "children": [ + { + "text": "This is the article text" + } + ], + "type": "p", + "attrs": {} + }, + { + "uid": "8e9ad7b9df3c48329e8d4b06aa49ccf0", + "children": [ + { + "break": true, + "text": "n" + }, + { + "text": "Heading one" + } + ], + "type": "p", + "attrs": {} + }, + { + "uid": "033c2b49fe834457aa2bd0dc96d2b350", + "children": [ + { + "uid": "4d919c74603245c68493bd017ae9c608", + "children": [ + { + "text": "New line of text" + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "4d04733ae9994ec28f675a487970f62e", + "children": [ + { + "uid": "a4baf76597ff48c2a76e4c66e62bc900", + "children": [ + { + "text": "subheading a" + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "8cead2c9a4b8456298e46983d960ef9a", + "children": [ + { + "text": "subheading b" + } + ], + "type": "li", + "attrs": {} + } + ], + "type": "ol", + "attrs": {} + }, + { + "uid": "0a8c5cfd07c24f67b9a96425da5bb4cb", + "children": [ + { + "text": "Another new line of text" + }, + { + "break": true, + "text": "nn" + }, + { + "text": "Bold line for other lines of text", + "bold": true + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "0f7c312e0ef6480ba9407d94b3ab8106", + "children": [ + { + "text": "The third line of text" + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "7c31fbbedc1b454ab245f8613de65591", + "children": [ + { + "text": "Fourth text line" + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "27b3973cd1004edf8d65f25e9d693ba8", + "children": [ + { + "uid": "75466bd357054aa1a6487ce45d65cecc", + "children": [ + { + "text": "subheading a for 4" + } + ], + "type": "li", + "attrs": {} + }, + { + "uid": "0a9e7c91000d42419e9e31371c358cc3", + "children": [ + { + "text": "subheading b for 4" + } + ], + "type": "li", + "attrs": {} + } + ], + "type": "ol", + "attrs": {} + }, + { + "uid": "9717d376b39a4c899e620e32c6b61322", + "children": [ + { + "text": "The fifth and last line" + } + ], + "type": "li", + "attrs": {} + } + ], + "id": "f85064d50c1b40a7a2f04d6f8b927736", + "type": "ol", + "attrs": {} + }, + { + "uid": "53f4b8157193426d8830d77c2205f46d", + "children": [ + { + "text": "" + } + ], + "type": "p", + "attrs": {} + }, + { + "uid": "3bb399aff2da4e649c8330965a70b034", + "children": [ + { + "text": "" + } + ], + "type": "p", + "attrs": {} + } + ], + "type": "doc", + "_version": 2, + "attrs": {} +} \ No newline at end of file
Multi line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textboxMulti line textbox
33333333333333333333333333333
qweqweqwe
Rich text editorRich text editorRich text editorRich text editorRich text editor
Global
global 2Global
Global group 1
global
modular 1
global modular 2
Global multiple 1
Global multiple 2
Global multiple group 1
Global multiple group 2
Global multiple modular 1
Global multiple modular
2
Group 1
Gro /copy-of-entry-final-01up 2
Modul 1
module 2
Global 1
Global 2
Global Global 2
Module 2
one
Two