feat(editor): merge store and blocks (#9591)

This commit is contained in:
Saul-Mirone
2025-01-08 13:01:19 +00:00
parent a0cba55a5b
commit 5842d45ab1
124 changed files with 362 additions and 414 deletions
@@ -1,10 +1,10 @@
import type { Blocks } from '@blocksuite/store';
import type { Store } from '@blocksuite/store';
import { effect } from '@preact/signals-core';
import { SurfaceBlockModel } from '../gfx/model/surface/surface-model.js';
export function onSurfaceAdded(
doc: Blocks,
doc: Store,
callback: (model: SurfaceBlockModel | null) => void
) {
let found = false;
@@ -1,5 +1,5 @@
import { nToLast } from '@blocksuite/global/utils';
import type { Blocks } from '@blocksuite/store';
import type { Store } from '@blocksuite/store';
import type { GfxLocalElementModel } from '../gfx/index.js';
import type { Layer } from '../gfx/layer.js';
@@ -82,7 +82,7 @@ export function isInRange(edges: [GfxModel, GfxModel], target: GfxModel) {
}
export function renderableInEdgeless(
doc: Blocks,
doc: Store,
surface: SurfaceBlockModel,
block: GfxBlockElementModel
) {
@@ -1,4 +1,4 @@
import type { Blocks } from '@blocksuite/store';
import type { Store } from '@blocksuite/store';
import {
type GfxCompatibleInterface,
@@ -124,16 +124,13 @@ export function isLockedImpl(element: GfxCompatibleInterface): boolean {
return isLockedBySelfImpl(element) || isLockedByAncestorImpl(element);
}
export function lockElementImpl(doc: Blocks, element: GfxCompatibleInterface) {
export function lockElementImpl(doc: Store, element: GfxCompatibleInterface) {
doc.transact(() => {
element.lockedBySelf = true;
});
}
export function unlockElementImpl(
doc: Blocks,
element: GfxCompatibleInterface
) {
export function unlockElementImpl(doc: Store, element: GfxCompatibleInterface) {
doc.transact(() => {
element.lockedBySelf = false;
});