1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 14:41:23 +02:00

Merge pull request #481 from aunsuwijak/bug/base64-serialize-node

Add options to Base64 serializeNode
This commit is contained in:
Ian Storm Taylor
2016-12-02 10:12:52 -08:00
committed by GitHub
2 changed files with 9 additions and 9 deletions

View File

@@ -215,7 +215,7 @@ class Node extends React.Component {
onDragStart = (e) => { onDragStart = (e) => {
const { node } = this.props const { node } = this.props
const encoded = Base64.serializeNode(node) const encoded = Base64.serializeNode(node, { preserveKeys: true })
const data = e.nativeEvent.dataTransfer const data = e.nativeEvent.dataTransfer
data.setData(TYPES.NODE, encoded) data.setData(TYPES.NODE, encoded)

View File

@@ -34,9 +34,9 @@ function decode(string) {
* @return {State} * @return {State}
*/ */
function deserialize(string) { function deserialize(string, options) {
const raw = decode(string) const raw = decode(string)
const state = Raw.deserialize(raw) const state = Raw.deserialize(raw, options)
return state return state
} }
@@ -47,9 +47,9 @@ function deserialize(string) {
* @return {Node} * @return {Node}
*/ */
function deserializeNode(string) { function deserializeNode(string, options) {
const raw = decode(string) const raw = decode(string)
const node = Raw.deserializeNode(raw) const node = Raw.deserializeNode(raw, options)
return node return node
} }
@@ -60,8 +60,8 @@ function deserializeNode(string) {
* @return {String} * @return {String}
*/ */
function serialize(state) { function serialize(state, options) {
const raw = Raw.serialize(state) const raw = Raw.serialize(state, options)
const encoded = encode(raw) const encoded = encode(raw)
return encoded return encoded
} }
@@ -73,8 +73,8 @@ function serialize(state) {
* @return {String} * @return {String}
*/ */
function serializeNode(node) { function serializeNode(node, options) {
const raw = Raw.serializeNode(node) const raw = Raw.serializeNode(node, options)
const encoded = encode(raw) const encoded = encode(raw)
return encoded return encoded
} }