Skip to content
Snippets Groups Projects
Commit 5f1ac978 authored by Tim's avatar Tim
Browse files

add img.alt attrib to de/serialize

parent c1558f7e
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,7 @@ export const HtmlRules = [ ...@@ -115,7 +115,7 @@ export const HtmlRules = [
kind: 'block', kind: 'block',
type: 'image', type: 'image',
isVoid: true, isVoid: true,
data: {src: el.attribs.src}, data: {src: el.attribs.src, alt: el.attribs.al},
nodes: next(el.children) nodes: next(el.children)
} }
case 'a': case 'a':
...@@ -157,8 +157,9 @@ export const HtmlRules = [ ...@@ -157,8 +157,9 @@ export const HtmlRules = [
} }
if(object.kind == 'block' && object.type == 'image') { if(object.kind == 'block' && object.type == 'image') {
const src = object.data.get('src') const src = object.data.get('src')
const alt = object.data.get('alt')
if(!src) console.log("** ERR: serializing image with no src...", JSON.stringify(object)) if(!src) console.log("** ERR: serializing image with no src...", JSON.stringify(object))
return <img src={src} /> return <img src={src} alt={alt} />
} }
console.log("No serializer for: ", object.kind, JSON.stringify(object, null, 2), children) console.log("No serializer for: ", object.kind, JSON.stringify(object, null, 2), children)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment