File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11import { convertFromRaw } from 'draft-js'
2- import _ from 'lodash'
32const Remarkable = require ( 'remarkable' )
43
54// Block level items, key is Remarkable's key for them, value returned is
@@ -285,7 +284,12 @@ function markdownToState(markdown, options = {}) {
285284 // but right now this code doesn't support that.
286285 if ( item . level === 0 || item . type === 'list_item_open' ) {
287286 const block = Object . assign ( {
288- depth : 0
287+ depth : 0 ,
288+ // set default values when creating a block, usually the block would have some inline items and
289+ // so these default values would be overwritten because of inline items by `blockToModify` object above
290+ text : '' ,
291+ inlineStyleRanges : [ ] ,
292+ entityRanges : [ ] ,
289293 } , BlockTypes [ itemType ] ( item ) )
290294
291295 blocks . push ( block )
@@ -295,7 +299,7 @@ function markdownToState(markdown, options = {}) {
295299
296300 return convertFromRaw ( {
297301 entityMap,
298- blocks : _ . filter ( blocks , b => b . text )
302+ blocks,
299303 } )
300304}
301305
You can’t perform that action at this time.
0 commit comments