mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 01:42:55 +08:00
feat(editor): merge store and blocks (#9591)
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
getBoundWithRotation,
|
||||
intersects,
|
||||
} from '@blocksuite/global/utils';
|
||||
import type { BlockModel, Blocks } from '@blocksuite/store';
|
||||
import type { BlockModel, Store } from '@blocksuite/store';
|
||||
|
||||
import { compare } from '../utils/layer.js';
|
||||
import { GfxBlockElementModel } from './model/gfx-block-model.js';
|
||||
@@ -361,7 +361,7 @@ export class GridManager {
|
||||
this.add(element);
|
||||
}
|
||||
|
||||
watch(blocks: { doc?: Blocks; surface?: SurfaceBlockModel | null }) {
|
||||
watch(blocks: { doc?: Store; surface?: SurfaceBlockModel | null }) {
|
||||
const disposables: { dispose: () => void }[] = [];
|
||||
const { doc, surface } = blocks;
|
||||
const isRenderableBlock = (
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
last,
|
||||
Slot,
|
||||
} from '@blocksuite/global/utils';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
import type { Store } from '@blocksuite/store';
|
||||
import { generateKeyBetween } from 'fractional-indexing';
|
||||
|
||||
import {
|
||||
@@ -100,7 +100,7 @@ export class LayerManager {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private readonly _doc: Blocks,
|
||||
private readonly _doc: Store,
|
||||
private _surface: SurfaceBlockModel | null,
|
||||
options: {
|
||||
watch: boolean;
|
||||
@@ -476,7 +476,7 @@ export class LayerManager {
|
||||
private _reset() {
|
||||
const elements = (
|
||||
this._doc
|
||||
.getBlocks()
|
||||
.getStore()
|
||||
.filter(
|
||||
model =>
|
||||
model instanceof GfxBlockElementModel &&
|
||||
@@ -775,7 +775,7 @@ export class LayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
watch(blocks: { doc?: Blocks; surface: SurfaceBlockModel | null }) {
|
||||
watch(blocks: { doc?: Store; surface: SurfaceBlockModel | null }) {
|
||||
const { doc, surface } = blocks;
|
||||
|
||||
if (doc) {
|
||||
|
||||
Reference in New Issue
Block a user