mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 07:36:42 +08:00
refactor(editor): rename doc to blocks (#9510)
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user