mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
refactor(editor): replace debounce and throttle with lodash (#10639)
This commit is contained in:
@@ -5,8 +5,9 @@ import {
|
||||
type IVec,
|
||||
Vec,
|
||||
} from '@blocksuite/global/gfx';
|
||||
import { debounce, Slot } from '@blocksuite/global/utils';
|
||||
import { Slot } from '@blocksuite/global/utils';
|
||||
import { signal } from '@preact/signals-core';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
|
||||
import type { GfxViewportElement } from '.';
|
||||
|
||||
@@ -73,21 +74,13 @@ export class Viewport {
|
||||
|
||||
ZOOM_MIN = ZOOM_MIN;
|
||||
|
||||
private readonly _resetZooming = debounce(
|
||||
() => {
|
||||
this.zooming$.value = false;
|
||||
},
|
||||
200,
|
||||
{ leading: false, trailing: true }
|
||||
);
|
||||
private readonly _resetZooming = debounce(() => {
|
||||
this.zooming$.value = false;
|
||||
}, 200);
|
||||
|
||||
private readonly _resetPanning = debounce(
|
||||
() => {
|
||||
this.panning$.value = false;
|
||||
},
|
||||
200,
|
||||
{ leading: false, trailing: true }
|
||||
);
|
||||
private readonly _resetPanning = debounce(() => {
|
||||
this.panning$.value = false;
|
||||
}, 200);
|
||||
|
||||
constructor() {
|
||||
this.elementReady.once(el => (this._element = el));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { throttle } from '@blocksuite/global/utils';
|
||||
import type { BaseSelection, BlockModel } from '@blocksuite/store';
|
||||
import throttle from 'lodash-es/throttle';
|
||||
|
||||
import { TextSelection } from '../selection/index.js';
|
||||
import type { BlockComponent } from '../view/element/block-component.js';
|
||||
@@ -7,7 +7,6 @@ import { BLOCK_ID_ATTR } from '../view/index.js';
|
||||
import { isActiveInEditor } from './active.js';
|
||||
import { RANGE_SYNC_EXCLUDE_ATTR } from './consts.js';
|
||||
import type { RangeManager } from './range-manager.js';
|
||||
|
||||
/**
|
||||
* Two-way binding between native range and text selection
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user