1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 02:49:56 +02:00

update examples for terse raw

This commit is contained in:
Ian Storm Taylor
2016-07-25 14:45:37 -07:00
parent 98c78e4d96
commit d78ddeabad
14 changed files with 31 additions and 79 deletions

View File

@@ -1,5 +1,5 @@
import { Editor, Draggable, Raw, Void } from '../..'
import { Editor, Raw, wrap } from '../..'
import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json'
@@ -13,17 +13,11 @@ import isUrl from 'is-url'
*/
const NODES = {
image: (props) => {
image: wrap()((props) => {
const { node, state } = props
const src = node.data.get('src')
return (
<Draggable {...props}>
<Void {...props} className="image-block">
<img {...props.attributes} src={src} />
</Void>
</Draggable>
)
}
return <img draggable src={src} />
})
}
/**
@@ -41,7 +35,7 @@ class Images extends React.Component {
*/
state = {
state: Raw.deserialize(initialState)
state: Raw.deserialize(initialState, { terse: true })
};
/**

View File

@@ -16,13 +16,7 @@
"isVoid": true,
"data": {
"src": "https://img.washingtonpost.com/wp-apps/imrs.php?src=https://img.washingtonpost.com/news/speaking-of-science/wp-content/uploads/sites/36/2015/10/as12-49-7278-1024x1024.jpg&w=1484"
},
"nodes": [
{
"kind": "text",
"text": ""
}
]
}
},
{
"kind": "block",