migrate image editor component

This commit is contained in:
Shawn Erquhart
2018-07-17 10:46:49 -04:00
parent e491f2a085
commit b7b90aaa65
7 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,23 @@
import React from 'react';
const image = {
label: 'Image',
id: 'image',
fromBlock: match => match && {
image: match[2],
alt: match[1],
},
toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`,
toPreview: (data, getAsset) => <img src={getAsset(data.image) || ''} alt={data.alt || ''} />,
pattern: /^!\[(.*)\]\((.*)\)$/,
fields: [{
label: 'Image',
name: 'image',
widget: 'image',
}, {
label: 'Alt Text',
name: 'alt',
}],
};
export default image;