@@ -94,10 +94,10 @@ function flattenListCompletely(listNode, editor, baseLevel = 0, sharedNumId = nu
9494 const currentListType = listNode . type . name ;
9595
9696 const needsMigration = shouldMigrateList ( listNode ) ;
97- const needsDefinition = checkValidDefinition ( listNode , editor ) ;
97+ const hasValidDefinition = checkValidDefinition ( listNode , editor ) ;
9898 log ( 'Needs migration?' , needsMigration ) ;
9999 if ( ! needsMigration ) {
100- if ( needsDefinition ) {
100+ if ( ! hasValidDefinition ) {
101101 return generateMissingListDefinition ( listNode , editor ) ;
102102 } else {
103103 return result ;
@@ -106,6 +106,7 @@ function flattenListCompletely(listNode, editor, baseLevel = 0, sharedNumId = nu
106106
107107 let numId = parseInt ( listNode . attrs ?. listId ) ;
108108 log ( 'LIST ID' , numId , 'SHARED NUM ID' , sharedNumId ) ;
109+ if ( ! numId || Number . isNaN ( numId ) ) numId = ListHelpers . getNewListId ( editor ) ;
109110 const listHasDef = ListHelpers . getListDefinitionDetails ( { numId, level : baseLevel , editor } ) ;
110111 if ( ! listHasDef || ( ! sharedNumId && ! numId ) ) {
111112 // In some legacy cases, we might not find any list ID at all but we can infer
@@ -245,7 +246,7 @@ const checkValidDefinition = (listNode, editor) => {
245246 const listDef = ListHelpers . getListDefinitionDetails ( { numId, level, listType, editor } ) ;
246247 const { abstract } = listDef || { } ;
247248
248- if ( ! abstract ) return true ;
249+ if ( abstract ) return true ;
249250 return false ;
250251} ;
251252
0 commit comments