migrate text nodes to use ranges

This commit is contained in:
Shawn Erquhart
2017-09-28 11:52:08 -04:00
parent 7a219bb833
commit bbf165d3b0
2 changed files with 392 additions and 82 deletions

View File

@ -84,10 +84,8 @@ function createInline(type, props = {}, nodes) {
*/ */
function createText(value, data) { function createText(value, data) {
const node = { kind: 'text', data }; const node = { kind: 'text', data };
if (isArray(value)) { const ranges = isArray(value) ? value : [{ text: value }];
return { ...node, ranges: value }; return { ...node, ranges };
}
return {...node, text: value };
} }
function processMarkNode(node, parentMarks = []) { function processMarkNode(node, parentMarks = []) {