File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/json-crdt-extensions/peritext/transfer Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,10 @@ class ViewRangeBuilder {
4242 const start = this . text . length ;
4343 const length = node . length ;
4444 const inline = ! ! attr ?. inline ;
45- const hasType = ! ! type || type === 0 ;
46- if ( hasType && ! inline ) {
45+ const hasType = type === 0 || ! ! type ;
46+ const firstChild = node [ 2 ] as PeritextMlNode ;
47+ const isFirstChildInline = firstChild && ( typeof firstChild === 'string' || firstChild [ 1 ] ?. inline ) ;
48+ if ( hasType && ! inline && isFirstChildInline ) {
4749 this . text += '\n' ;
4850 const header =
4951 ( SliceBehavior . Marker << SliceHeaderShift . Behavior ) +
@@ -54,7 +56,7 @@ class ViewRangeBuilder {
5456 if ( data ) slice . push ( data ) ;
5557 this . slices . push ( slice ) ;
5658 }
57- for ( let i = 2 ; i < length ; i ++ ) this . build0 ( node [ i ] as PeritextMlNode , [ ...path , type ] ) ;
59+ for ( let i = 2 ; i < length ; i ++ ) this . build0 ( node [ i ] as PeritextMlNode , type === '' ? path : [ ...path , type ] ) ;
5860 if ( hasType && inline ) {
5961 let end : number = 0 ,
6062 header : number = 0 ;
You can’t perform that action at this time.
0 commit comments