diff --git a/lib/models/transforms.js b/lib/models/transforms.js index a7c72904f..59c66a7ee 100644 --- a/lib/models/transforms.js +++ b/lib/models/transforms.js @@ -612,7 +612,8 @@ const Transforms = { secondChild = Block.create({ nodes: secondChildren, type: parent.type, - data: parent.data + data: parent.data, + isVoid: parent.isVoid }) // Add the new children. diff --git a/test/transforms/fixtures/split-block/with-void/index.js b/test/transforms/fixtures/split-block/with-void/index.js new file mode 100644 index 000000000..ea5a66fc1 --- /dev/null +++ b/test/transforms/fixtures/split-block/with-void/index.js @@ -0,0 +1,24 @@ + +import assert from 'assert' + +export default function (state) { + const { document, selection } = state + const texts = document.getTexts() + const first = texts.first() + const range = selection.merge({ + anchorKey: first.key, + anchorOffset: 0, + focusKey: first.key, + focusOffset: 0 + }) + + const next = state + .transform() + .moveTo(range) + .splitBlock() + .apply() + + console.dir(next.document.getBlocks().toJS()); + + return next +} diff --git a/test/transforms/fixtures/split-block/with-void/input.yaml b/test/transforms/fixtures/split-block/with-void/input.yaml new file mode 100644 index 000000000..5c4272312 --- /dev/null +++ b/test/transforms/fixtures/split-block/with-void/input.yaml @@ -0,0 +1,5 @@ + +nodes: + - kind: block + type: video + isVoid: true diff --git a/test/transforms/fixtures/split-block/with-void/output.yaml b/test/transforms/fixtures/split-block/with-void/output.yaml new file mode 100644 index 000000000..3cd48848e --- /dev/null +++ b/test/transforms/fixtures/split-block/with-void/output.yaml @@ -0,0 +1,8 @@ + +nodes: + - kind: block + type: video + isVoid: true + - kind: block + type: video + isVoid: true