From 3ea2c39792be893ebbbb2064486f447002e6a2fc Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Mon, 26 Oct 2020 21:03:48 +0000 Subject: [PATCH 1/2] added try catch block for convertFromHTML --- .../dispatch-editor/helpers/convertJSON.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dispatch/static/manager/src/js/vendor/dispatch-editor/helpers/convertJSON.js b/dispatch/static/manager/src/js/vendor/dispatch-editor/helpers/convertJSON.js index f6d70a389..fd459ee52 100644 --- a/dispatch/static/manager/src/js/vendor/dispatch-editor/helpers/convertJSON.js +++ b/dispatch/static/manager/src/js/vendor/dispatch-editor/helpers/convertJSON.js @@ -112,12 +112,20 @@ function embedToBlock(block) { } function paragraphToBlock(block) { - return convertFromHTML(block.data) + try{ + return convertFromHTML(block.data); + } catch(err) { + console.log("paragraphToBlock error"); + } } function headerToBlock(block) { - const contentBlocks = convertFromHTML(block.data.content).contentBlocks - .map(contentBlock => contentBlock.set('type', DRAFT_TYPES.HEADER)) + try{ + const contentBlocks = convertFromHTML(block.data.content).contentBlocks + .map(contentBlock => contentBlock.set('type', DRAFT_TYPES.HEADER)); + } catch(err) { + console.log("headerToBlock error"); + } return { contentBlocks: contentBlocks, @@ -126,9 +134,13 @@ function headerToBlock(block) { } function listToBlock(block) { + try{ const contentBlocks = block.data .map(text => convertFromHTML(text).contentBlocks[0]) .map(contentBlock => contentBlock.set('type', DRAFT_TYPES.LIST)) + } catch(err){ + console.log("listToBlock error"); + } return { contentBlocks: contentBlocks, From f422dd1764376a7c139778123800b27a1d0a35db Mon Sep 17 00:00:00 2001 From: davidkao0902 Date: Mon, 26 Oct 2020 21:05:45 +0000 Subject: [PATCH 2/2] change version number to 1.3.11 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a65c289d5..1edd2dd8a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup(name='dispatch', description='A publishing platform for modern newspapers', - version='1.3.10', + version='1.3.11', url='https://github.com/ubyssey/dispatch', author='Peter Siemens', author_email='peterjsiemens@gmail.com',