File tree Expand file tree Collapse file tree
src/addons/addons/collaboration/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,11 @@ export function deserializeBlockFromYjs(yBlockMap) {
9595 let current = block ;
9696 for ( let i = 0 ; i < pathParts . length - 1 ; i ++ ) {
9797 const part = pathParts [ i ] ;
98- if ( ! current [ part ] ) current [ part ] = { } ;
98+ if ( ! current [ part ] ) {
99+ current [ part ] = ( pathParts [ 0 ] === 'inputs' && i === 1 )
100+ ? { name : part , block : null , shadow : null }
101+ : { } ;
102+ }
99103 current = current [ part ] ;
100104 }
101105 current [ pathParts [ pathParts . length - 1 ] ] = value ;
Original file line number Diff line number Diff line change @@ -86,7 +86,11 @@ export function sharedBlocks(event){
8686 let current = block ;
8787 for ( let i = 0 ; i < pathParts . length - 1 ; i ++ ) {
8888 const part = pathParts [ i ] ;
89- if ( ! current [ part ] ) current [ part ] = { } ;
89+ if ( ! current [ part ] ) {
90+ current [ part ] = ( pathParts [ 0 ] === 'inputs' && i === 1 )
91+ ? { name : part , block : null , shadow : null }
92+ : { } ;
93+ }
9094 current = current [ part ] ;
9195 }
9296 current [ pathParts [ pathParts . length - 1 ] ] = val ;
@@ -331,6 +335,13 @@ export function sharedComments (event){
331335 Object . assign ( target . comments [ commentId ] , commentData ) ;
332336 }
333337 } else if ( change . action === 'delete' ) {
338+ const deletedComment = target . comments [ commentId ] ;
339+ if ( deletedComment && deletedComment . blockId ) {
340+ const owningBlock = target . blocks . getBlock ( deletedComment . blockId ) ;
341+ if ( owningBlock && owningBlock . comment === commentId ) {
342+ delete owningBlock . comment ;
343+ }
344+ }
334345 delete target . comments [ commentId ] ;
335346 }
336347 } ) ;
You can’t perform that action at this time.
0 commit comments