From 93c8fd540f7e6759039ceaf680c22e75b33631cd Mon Sep 17 00:00:00 2001 From: Vitor Carvalho Date: Thu, 14 Jan 2021 15:25:19 +0000 Subject: [PATCH 1/5] Added coverage to render HTML in paragraph --- src/renderers/paragraph/__snapshots__/index.test.tsx.snap | 6 +++++- src/renderers/paragraph/index.test.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderers/paragraph/__snapshots__/index.test.tsx.snap b/src/renderers/paragraph/__snapshots__/index.test.tsx.snap index 5e4d00e..01527ba 100644 --- a/src/renderers/paragraph/__snapshots__/index.test.tsx.snap +++ b/src/renderers/paragraph/__snapshots__/index.test.tsx.snap @@ -2,6 +2,10 @@ exports[` when receives a paragraph block renders a

tag 1`] = `

- Hey. Meet the new Editor. On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration. + Hey. Meet the new + + Editor + + . On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration.

`; diff --git a/src/renderers/paragraph/index.test.tsx b/src/renderers/paragraph/index.test.tsx index e56284e..ffc1ab9 100644 --- a/src/renderers/paragraph/index.test.tsx +++ b/src/renderers/paragraph/index.test.tsx @@ -6,7 +6,7 @@ describe('', () => { describe('when receives a paragraph block', () => { const data: ParagraphBlockData = { text: - 'Hey. Meet the new Editor. On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration.', + 'Hey. Meet the new Editor. On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration.', }; it('renders a

tag', () => { From 199c7b11bcac9988afb983efdbcaac14aec8fe16 Mon Sep 17 00:00:00 2001 From: Vitor Carvalho Date: Thu, 14 Jan 2021 15:43:50 +0000 Subject: [PATCH 2/5] Added coverage to render HTML in list --- src/renderers/list/__snapshots__/index.test.tsx.snap | 6 +++++- src/renderers/list/index.test.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderers/list/__snapshots__/index.test.tsx.snap b/src/renderers/list/__snapshots__/index.test.tsx.snap index 5243ea2..471c593 100644 --- a/src/renderers/list/__snapshots__/index.test.tsx.snap +++ b/src/renderers/list/__snapshots__/index.test.tsx.snap @@ -20,7 +20,11 @@ exports[` when receives a list unordered block renders a

    block 1`] It is a block-styled editor
  • - It returns clean data output in JSON + It returns clean + + data output + + in JSON
  • Designed to be extendable and pluggable with a simple API diff --git a/src/renderers/list/index.test.tsx b/src/renderers/list/index.test.tsx index a20afcd..7c9240b 100644 --- a/src/renderers/list/index.test.tsx +++ b/src/renderers/list/index.test.tsx @@ -8,7 +8,7 @@ describe('', () => { style: 'unordered', items: [ 'It is a block-styled editor', - 'It returns clean data output in JSON', + 'It returns clean data output in JSON', 'Designed to be extendable and pluggable with a simple API', ], }; From 836c76bb88df630b6a0f37887140c57c75856ea2 Mon Sep 17 00:00:00 2001 From: Vitor Carvalho Date: Thu, 14 Jan 2021 15:44:29 +0000 Subject: [PATCH 3/5] Fix render HTML issue in quote block This commit adds rendering capabilities to the Quote block that has HTML inside. Closes #5 --- .../quote/__snapshots__/index.test.tsx.snap | 17 +++++++++++++---- src/renderers/quote/index.test.tsx | 2 +- src/renderers/quote/index.tsx | 5 ++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/renderers/quote/__snapshots__/index.test.tsx.snap b/src/renderers/quote/__snapshots__/index.test.tsx.snap index 991b980..984889c 100644 --- a/src/renderers/quote/__snapshots__/index.test.tsx.snap +++ b/src/renderers/quote/__snapshots__/index.test.tsx.snap @@ -5,12 +5,21 @@ exports[` when receives a Quote block renders a
    block with className="text-align-center special-quote" >

    - Esse ea consectetur est fugiat ut dolor pariatur ex voluptate ad Lorem Lorem sit sunt. -

    -

    - Eiusmod voluptate ullamco laborum minim elit. + + Esse ea consectetur est fugiat ut dolor pariatur ex voluptate ad Lorem Lorem sit sunt. +

    + + Eiusmod voluptate + + ullamco + + laborum minim elit. + + +
    +
    Cillum ullamco fugiat tempor dolore enim.
    Excepteur exercitation amet aliqua proident labore qui sint do dolore sint nulla aute. diff --git a/src/renderers/quote/index.test.tsx b/src/renderers/quote/index.test.tsx index 32c1041..0ca273c 100644 --- a/src/renderers/quote/index.test.tsx +++ b/src/renderers/quote/index.test.tsx @@ -6,7 +6,7 @@ describe('', () => { describe('when receives a Quote block', () => { const data: QuoteBlockData = { text: - 'Esse ea consectetur est fugiat ut dolor pariatur ex voluptate ad Lorem Lorem sit sunt.\n\nEiusmod voluptate ullamco laborum minim elit.\n\nCillum ullamco fugiat tempor dolore enim.\nExcepteur exercitation amet aliqua proident labore qui sint do dolore sint nulla aute.', + 'Esse ea consectetur est fugiat ut dolor pariatur ex voluptate ad Lorem Lorem sit sunt.\n\nEiusmod voluptate ullamco laborum minim elit.
    Cillum ullamco fugiat tempor dolore enim.\nExcepteur exercitation amet aliqua proident labore qui sint do dolore sint nulla aute.', caption: 'Carpe Diem, Lorem ipusm dolor.', alignment: 'center', }; diff --git a/src/renderers/quote/index.tsx b/src/renderers/quote/index.tsx index 8da8d0f..186765e 100644 --- a/src/renderers/quote/index.tsx +++ b/src/renderers/quote/index.tsx @@ -41,10 +41,9 @@ const Quote = ({ {data.text && data.text.split('\n\n').map((paragraph, i) => (

    - {paragraph + {ReactHtmlParser(paragraph .split('\n') - // @ts-ignore - .reduce((total, line, j) => [total,
    , line])} + .reduce((total, line) => [total, '
    ', line].join('')))}

    ))} {data.caption &&
    {ReactHtmlParser(data.caption)}
    } From ee4d1c6681b6dda33326c0b9ecbbcc872fbc1940 Mon Sep 17 00:00:00 2001 From: Vitor Carvalho Date: Thu, 14 Jan 2021 15:50:14 +0000 Subject: [PATCH 4/5] Fix prettier issue --- src/renderers/quote/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderers/quote/index.tsx b/src/renderers/quote/index.tsx index 186765e..1bacf0c 100644 --- a/src/renderers/quote/index.tsx +++ b/src/renderers/quote/index.tsx @@ -39,13 +39,13 @@ const Quote = ({ return (
    {data.text && - data.text.split('\n\n').map((paragraph, i) => ( -

    - {ReactHtmlParser(paragraph - .split('\n') - .reduce((total, line) => [total, '
    ', line].join('')))} -

    - ))} + data.text + .split('\n\n') + .map((paragraph, i) => ( +

    + {ReactHtmlParser(paragraph.split('\n').reduce((total, line) => [total, '
    ', line].join('')))} +

    + ))} {data.caption &&
    {ReactHtmlParser(data.caption)}
    }
    ); From 1897e998910f4a4afa4645164e987b9f3e9bc94b Mon Sep 17 00:00:00 2001 From: Vitor Carvalho Date: Thu, 14 Jan 2021 15:54:34 +0000 Subject: [PATCH 5/5] 1.1.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa8c52c..7477fa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "editorjs-blocks-react-renderer", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f429f79..eb3e5f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "editorjs-blocks-react-renderer", - "version": "1.0.0", + "version": "1.1.0", "description": "EditorJS blocks renderer to semanticly beautiful html5 tags via React.", "keywords": [ "editorjs",