chore: update blocksuite to 0.0.0-20230512192655-e61e272b-nightly (#2352)

This commit is contained in:
Himself65
2023-05-13 04:39:05 +08:00
committed by LongYinan
parent 1aef8862ad
commit b15eae11cf
12 changed files with 172 additions and 131 deletions

View File

@@ -6,7 +6,7 @@ import { WorkspaceFlavour } from '@affine/workspace/type';
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
import { nanoid } from '@blocksuite/store';
import { useAtomValue, useSetAtom } from 'jotai';
import { useCallback, useEffect } from 'react';
import { useCallback } from 'react';
import { workspacesAtom } from '../atoms';
import { WorkspaceAdapters } from '../plugins';
@@ -97,25 +97,3 @@ export function useAppHelper() {
),
};
}
export const useElementResizeEffect = (
element: Element | null,
fn: () => void | (() => () => void),
// TODO: add throttle
_throttle = 0
) => {
useEffect(() => {
if (!element) {
return;
}
let dispose: void | (() => void);
const resizeObserver = new ResizeObserver(() => {
dispose = fn();
});
resizeObserver.observe(element);
return () => {
dispose?.();
resizeObserver.disconnect();
};
}, [element, fn]);
};