Skip to content

Commit

Permalink
fix: Image links converted with new image block format (Fixes #29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Jun 6, 2023
1 parent bc6a215 commit 407a411
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/converters/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ const imageBlock = (elem, href) => {
};

if (href) {
block.href = { url: href };
const title = href.split('://')[1];
block.href = [
{
'@id': href,
title: title,
},
];
}

if (elem.dataset.href != null) {
Expand Down
7 changes: 6 additions & 1 deletion src/converters/fromHtml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,12 @@ describe('convertFromHTML parsing image', () => {
'@type': 'image',
align: 'center',
alt: '',
href: { url: 'https://plone.org' },
href: [
{
'@id': 'https://plone.org',
title: 'plone.org',
},
],
size: 'l',
title: '',
url: 'image.jpeg',
Expand Down

0 comments on commit 407a411

Please sign in to comment.