Skip to content

Commit

Permalink
fix: repair logic judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
文瑀 authored and BroKun committed Oct 20, 2023
1 parent 1963a61 commit fac4b24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/libro-shared-model/src/ymodels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ export class YNotebook extends YDocument<NotebookChange> implements ISharedNoteb
// this reflects the event.changes.delta, but replaces the content of delta.insert with ycells
const cellsChange: Delta<ISharedCell[]> = [];
event.changes.delta.forEach((d: any) => {
if (d.insert !== null) {
if (d.insert) {
const insertedCells = d.insert.map((ycell: Y.Map<any>) =>
this._ycellMapping.get(ycell),
);
Expand All @@ -1567,7 +1567,7 @@ export class YNotebook extends YDocument<NotebookChange> implements ISharedNoteb
});

index += d.insert.length;
} else if (d.delete !== null) {
} else if (d.delete) {
cellsChange.push(d);
const oldValues = this.cells.splice(index, d.delete);

Expand All @@ -1578,7 +1578,7 @@ export class YNotebook extends YDocument<NotebookChange> implements ISharedNoteb
oldIndex: index,
oldValues,
});
} else if (d.retain !== null) {
} else if (d.retain) {
cellsChange.push(d);
index += d.retain;
}
Expand Down

0 comments on commit fac4b24

Please sign in to comment.