draftjs-md-converter
Advanced tools
Comparing version
@@ -282,3 +282,8 @@ 'use strict'; | ||
return children.reduce(function (prev, current) { | ||
return prev + (current.value ? current.value.length : 0); | ||
if (current.value) { | ||
return prev + current.value.length; | ||
} else if (current.children && current.children.length) { | ||
return prev + getRawLength(current.children); | ||
} | ||
return prev; | ||
}, 0); | ||
@@ -285,0 +290,0 @@ }; |
{ | ||
"name": "draftjs-md-converter", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Converter for converting Draft.js state into Markdown and vice versa", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -93,3 +93,10 @@ 'use strict'; | ||
const getRawLength = children => | ||
children.reduce((prev, current) => prev + (current.value ? current.value.length : 0), 0); | ||
children.reduce((prev, current) => { | ||
if (current.value) { | ||
return prev + current.value.length; | ||
} else if (current.children && current.children.length) { | ||
return prev + getRawLength(current.children); | ||
} | ||
return prev; | ||
}, 0); | ||
@@ -96,0 +103,0 @@ const addLink = child => { |
Sorry, the diff of this file is not supported yet
196328
0.1%761
1.6%