1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-19 14:27:07 +01:00

Fix paste example: nested formatting (#3264)

This commit is contained in:
Dylan Markow 2019-12-06 16:14:35 -06:00 committed by Ian Storm Taylor
parent 56d798a943
commit b629be3398

View File

@ -59,7 +59,9 @@ export const deserialize = el => {
parent = el.childNodes[0] parent = el.childNodes[0]
} }
const children = Array.from(parent.childNodes).map(deserialize) const children = Array.from(parent.childNodes)
.map(deserialize)
.flat()
if (el.nodeName === 'BODY') { if (el.nodeName === 'BODY') {
return jsx('fragment', {}, children) return jsx('fragment', {}, children)
@ -72,7 +74,7 @@ export const deserialize = el => {
if (TEXT_TAGS[nodeName]) { if (TEXT_TAGS[nodeName]) {
const attrs = TEXT_TAGS[nodeName](el) const attrs = TEXT_TAGS[nodeName](el)
return jsx('text', attrs, children) return children.map(child => jsx('text', attrs, child))
} }
return children return children