diff --git a/editors/editoria/src/Editoria.js b/editors/editoria/src/Editoria.js index 9d8e47e33847266372b6f151280b0d9631e5ca19..8b25d68d6f5f44871e159e373d373c38769d5b4f 100644 --- a/editors/editoria/src/Editoria.js +++ b/editors/editoria/src/Editoria.js @@ -101,6 +101,16 @@ const StyledWax = styled(Wax)` } `; +const renderImage = file => { + const reader = new FileReader(); + return new Promise((accept, fail) => { + reader.onload = () => accept(reader.result); + reader.onerror = () => fail(reader.error); + // Some extra delay to make the asynchronicity visible + setTimeout(() => reader.readAsDataURL(file), 150); + }); +}; + class Editoria extends Component { render() { return ( @@ -112,22 +122,8 @@ class Editoria extends Component { placeholder="Type Something..." theme="editoria" layout="editoria" - fileUpload={file => { - let reader = new FileReader(); - return new Promise((accept, fail) => { - reader.onload = () => accept(reader.result); - reader.onerror = () => fail(reader.error); - // Some extra delay to make the asynchronicity visible - setTimeout(() => reader.readAsDataURL(file), 1500); - }); - }} - value="<p>hello</p> - <ul><li>listItem 1</li><li>listItem 2</li><li>listItem 3</li></ul> - <table> - <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th></tr> - <tr><td>Jill</td><td>Smith</td><td>50</td></tr> - <tr><td>Eve</td><td>Jackson</td><td>94</td></tr> - </table>" + fileUpload={file => renderImage(file)} + value="" > {({ editor, view, ...props }) => ( <React.Fragment>