Skip to content

Commit

Permalink
fix(core): remove selectionchange throttle to avoid selection out of …
Browse files Browse the repository at this point in the history
…sync
  • Loading branch information
pubuzhixing8 committed Sep 23, 2021
1 parent 92cbe0c commit 19413fa
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions packages/src/components/editable/editable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export class SlateEditableComponent implements OnInit, OnChanges, OnDestroy, Aft

private destroy$ = new Subject();

private selectionChange$ = new Subject<Event>();

isComposing = false;
isDraggingInternally = false;
isUpdatingSelection = false;
Expand Down Expand Up @@ -223,23 +221,10 @@ export class SlateEditableComponent implements OnInit, OnChanges, OnDestroy, Aft
this.addEventListener(
'selectionchange',
event => {
this.selectionChange$.next(event);
this.toSlateSelection();
},
window.document
);
this.selectionChange$
.pipe(
throttle(
(value: Event) => {
return interval(100);
},
{ trailing: true, leading: true }
),
takeUntil(this.destroy$)
)
.subscribe(event => {
this.toSlateSelection();
});
if (HAS_BEFORE_INPUT_SUPPORT) {
this.addEventListener('beforeinput', this.onDOMBeforeInput.bind(this));
}
Expand Down

0 comments on commit 19413fa

Please sign in to comment.