Merge pull request #368 from jorilallo/issue-367

Quick fix for #367
This commit is contained in:
Tom Moor 2017-10-24 07:59:50 -07:00 committed by GitHub
commit df3d73a2a2
1 changed files with 3 additions and 2 deletions

View File

@ -15,6 +15,7 @@ export default async function insertImageFile(
try { try {
// load the file as a data URL // load the file as a data URL
const id = uuid.v4(); const id = uuid.v4();
const alt = '';
const reader = new FileReader(); const reader = new FileReader();
reader.addEventListener('load', () => { reader.addEventListener('load', () => {
const src = reader.result; const src = reader.result;
@ -24,7 +25,7 @@ export default async function insertImageFile(
.insertBlock({ .insertBlock({
type: 'image', type: 'image',
isVoid: true, isVoid: true,
data: { src, id, loading: true }, data: { src, id, alt, loading: true },
}) })
.apply(); .apply();
editor.onChange(state); editor.onChange(state);
@ -45,7 +46,7 @@ export default async function insertImageFile(
); );
return finalTransform.setNodeByKey(placeholder.key, { return finalTransform.setNodeByKey(placeholder.key, {
data: { src, loading: false }, data: { src, alt, loading: false },
}); });
} catch (err) { } catch (err) {
throw err; throw err;