mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor(editor): replace debounce and throttle with lodash (#10639)
This commit is contained in:
@@ -23,10 +23,12 @@
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"dompurify": "^3.2.4",
|
||||
"fractional-indexing": "^3.2.0",
|
||||
"lib0": "^0.2.97",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"lz-string": "^1.5.0",
|
||||
"rehype-parse": "^9.0.0",
|
||||
"unified": "^11.0.5",
|
||||
|
||||
@@ -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