Commit 8e7d4581 authored by chris's avatar chris
Browse files

import/export

parent 6075b4e8
......@@ -66,7 +66,7 @@ class ImageComponent extends BlockNodeComponent {
$$('img')
.on('click', this.click)
.attr({
src: this.props.node.actualFile.source,
src: this.props.node.actualFile,
})
.ref('image'),
)
......
......@@ -5,6 +5,7 @@ export default {
import: function(el, node, converter) {
const image = el.firstChild
console.log(image.attr('src'))
let imageFile = converter.getDocument().create({
id: 'file-' + node.id,
type: 'file',
......@@ -14,6 +15,7 @@ export default {
node.imageFile = imageFile.id
node.caption = el.attr('figcaption')
node.id = el.attr('data-id')
node.actualFile = image.attr('src')
},
export: function(node, el, exporter) {
......@@ -28,7 +30,7 @@ export default {
let imageFile = node.document.get(node.imageFile)
el.attr('data-id', node.id)
el.append($$('img').attr('src', imageFile.getUrl()))
el.append($$('img').attr('src', node.actualFile))
el.append($$('figcaption').html(string))
},
}
......@@ -18,7 +18,7 @@ class ImageNode extends DocumentNode {
ImageNode.schema = {
type: 'image',
imageFile: { type: 'file' },
actualFile: { type: 'object' },
actualFile: { type: 'string', default: '' },
caption: {
type: 'string',
default: '',
......
......@@ -58,7 +58,7 @@ class ImageCommand extends Command {
tx.insertBlockNode({
type: 'image',
imageFile: imageFile.id,
actualFile: file,
actualFile: file.source,
})
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment