@@ -123,30 +123,34 @@ export const onDropNode = (
123123
124124 const { dragPath, to } = result ;
125125
126- // Check if we're dragging multiple nodes
127- const draggedIds = Array . isArray ( dragItem . id ) ? dragItem . id : [ dragItem . id ] ;
128-
129- if ( draggedIds . length > 1 ) {
130- // Handle multi-node drop - get elements by their IDs and sort them
131- const elements : TElement [ ] = [ ] ;
132-
133- draggedIds . forEach ( ( id ) => {
134- const entry = editor . api . node < TElement > ( { id, at : [ ] } ) ;
135- if ( entry ) {
136- elements . push ( entry [ 0 ] ) ;
137- }
138- } ) ;
139-
140- editor . tf . moveNodes ( {
141- at : [ ] ,
142- to,
143- match : ( n ) => elements . some ( ( element ) => element . id === n . id ) ,
144- } ) ;
126+ if ( dragItem . editorId === editor . id ) {
127+ // Check if we're dragging multiple nodes
128+ const draggedIds = Array . isArray ( dragItem . id ) ? dragItem . id : [ dragItem . id ] ;
129+
130+ if ( draggedIds . length > 1 ) {
131+ // Handle multi-node drop - get elements by their IDs and sort them
132+ const elements : TElement [ ] = [ ] ;
133+
134+ draggedIds . forEach ( ( id ) => {
135+ const entry = editor . api . node < TElement > ( { id, at : [ ] } ) ;
136+ if ( entry ) {
137+ elements . push ( entry [ 0 ] ) ;
138+ }
139+ } ) ;
140+
141+ editor . tf . moveNodes ( {
142+ at : [ ] ,
143+ to,
144+ match : ( n ) => elements . some ( ( element ) => element . id === n . id ) ,
145+ } ) ;
146+ } else {
147+ // Single node drop
148+ editor . tf . moveNodes ( {
149+ at : dragPath ,
150+ to,
151+ } ) ;
152+ }
145153 } else {
146- // Single node drop
147- editor . tf . moveNodes ( {
148- at : dragPath ,
149- to,
150- } ) ;
154+ editor . tf . insertNodes ( dragItem . element , { at : to } ) ;
151155 }
152156} ;
0 commit comments