File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -184,22 +184,25 @@ function collectAllBlocks<
184
184
{
185
185
block : Block < BSchema , ISchema , SSchema > ;
186
186
parentId : string | undefined ;
187
+ index : number ;
187
188
}
188
189
> {
189
190
const blocks : Record <
190
191
string ,
191
192
{
192
193
block : Block < BSchema , ISchema , SSchema > ;
193
194
parentId : string | undefined ;
195
+ index : number ;
194
196
}
195
197
> = { } ;
196
198
const pmSchema = getPmSchema ( doc ) ;
197
- doc . descendants ( ( node , pos ) => {
199
+ doc . descendants ( ( node , pos , _ , index ) => {
198
200
if ( isNodeBlock ( node ) ) {
199
201
const parentId = getParentBlockId ( doc , pos ) ;
200
202
blocks [ node . attrs . id ] = {
201
203
block : nodeToBlock ( node , pmSchema ) ,
202
204
parentId,
205
+ index,
203
206
} ;
204
207
}
205
208
return true ;
@@ -264,8 +267,9 @@ export function getBlocksChangedByTransaction<
264
267
const prev = prevBlocks [ id ] ;
265
268
const next = nextBlocks [ id ] ;
266
269
const isParentDifferent = prev . parentId !== next . parentId ;
270
+ const isIndexDifferent = prev . index !== next . index ;
267
271
268
- if ( isParentDifferent ) {
272
+ if ( isParentDifferent || isIndexDifferent ) {
269
273
changes . push ( {
270
274
type : "move" ,
271
275
block : next . block ,
You can’t perform that action at this time.
0 commit comments