Skip to content

Commit

Permalink
Merge pull request #987 from ubyssey/htmlCatchBlock
Browse files Browse the repository at this point in the history
Html catch block
  • Loading branch information
davidkao0902 authored Oct 26, 2020
2 parents 932f14e + f422dd1 commit 18c52c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand Down

0 comments on commit 18c52c8

Please sign in to comment.