refactor(editor): rename doc to blocks (#9510)

This commit is contained in:
Saul-Mirone
2025-01-03 12:49:33 +00:00
parent 2074bda8ff
commit 4457cb7266
99 changed files with 271 additions and 256 deletions
@@ -1,10 +1,10 @@
import type { Doc } from '@blocksuite/store';
import type { Blocks } from '@blocksuite/store';
import { effect } from '@preact/signals-core';
import { SurfaceBlockModel } from '../gfx/model/surface/surface-model.js';
export function onSurfaceAdded(
doc: Doc,
doc: Blocks,
callback: (model: SurfaceBlockModel | null) => void
) {
let found = false;
@@ -1,5 +1,5 @@
import { nToLast } from '@blocksuite/global/utils';
import type { Doc } from '@blocksuite/store';
import type { Blocks } 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: Doc,
doc: Blocks,
surface: SurfaceBlockModel,
block: GfxBlockElementModel
) {
@@ -1,4 +1,4 @@
import type { Doc } from '@blocksuite/store';
import type { Blocks } from '@blocksuite/store';
import {
type GfxCompatibleInterface,
@@ -124,13 +124,16 @@ export function isLockedImpl(element: GfxCompatibleInterface): boolean {
return isLockedBySelfImpl(element) || isLockedByAncestorImpl(element);
}
export function lockElementImpl(doc: Doc, element: GfxCompatibleInterface) {
export function lockElementImpl(doc: Blocks, element: GfxCompatibleInterface) {
doc.transact(() => {
element.lockedBySelf = true;
});
}
export function unlockElementImpl(doc: Doc, element: GfxCompatibleInterface) {
export function unlockElementImpl(
doc: Blocks,
element: GfxCompatibleInterface
) {
doc.transact(() => {
element.lockedBySelf = false;
});