mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
refactor(editor): rename doc to blocks (#9510)
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
} from '@blocksuite/affine-shared/adapters';
|
||||
import type { BlockComponent, UIEventHandler } from '@blocksuite/block-std';
|
||||
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||
import type { BlockSnapshot, Doc } from '@blocksuite/store';
|
||||
import type { Blocks, BlockSnapshot } from '@blocksuite/store';
|
||||
|
||||
import { MixTextAdapter } from '../../_common/adapters/index.js';
|
||||
import {
|
||||
@@ -99,7 +99,7 @@ export class PageClipboard {
|
||||
|
||||
onBlockSnapshotPaste = async (
|
||||
snapshot: BlockSnapshot,
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
parent?: string,
|
||||
index?: number
|
||||
) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from '@blocksuite/block-std';
|
||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||
import { DisposableGroup, Vec, WithDisposable } from '@blocksuite/global/utils';
|
||||
import type { Doc } from '@blocksuite/store';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
import { consume } from '@lit/context';
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
@@ -150,7 +150,7 @@ export class EdgelessConnectorHandle extends WithDisposable(LitElement) {
|
||||
@consume({
|
||||
context: docContext,
|
||||
})
|
||||
accessor doc!: Doc;
|
||||
accessor doc!: Blocks;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor edgeless!: EdgelessRootBlockComponent;
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
DisposableGroup,
|
||||
WithDisposable,
|
||||
} from '@blocksuite/global/utils';
|
||||
import { BlockViewType, type Doc, type Query } from '@blocksuite/store';
|
||||
import { type Blocks, BlockViewType, type Query } from '@blocksuite/store';
|
||||
import { css, html, nothing, type PropertyValues } from 'lit';
|
||||
import { property, query, state } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
@@ -78,7 +78,7 @@ export class FramePreview extends WithDisposable(ShadowlessElement) {
|
||||
|
||||
private _frameDisposables: DisposableGroup | null = null;
|
||||
|
||||
private _previewDoc: Doc | null = null;
|
||||
private _previewDoc: Blocks | null = null;
|
||||
|
||||
private readonly _previewSpec =
|
||||
SpecProvider.getInstance().getSpec('edgeless:preview');
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
type IVec,
|
||||
type SerializedXYWH,
|
||||
} from '@blocksuite/global/utils';
|
||||
import type { Doc } from '@blocksuite/store';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
import { Text } from '@blocksuite/store';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
@@ -463,7 +463,7 @@ export class EdgelessFrameManager extends GfxExtension {
|
||||
}
|
||||
|
||||
export function getNotesInFrameBound(
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
frame: FrameBlockModel,
|
||||
fullyContained: boolean = true
|
||||
) {
|
||||
@@ -481,7 +481,7 @@ export function getNotesInFrameBound(
|
||||
}
|
||||
|
||||
export function getBlocksInFrameBound(
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
model: FrameBlockModel,
|
||||
fullyContained: boolean = true
|
||||
) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DocModeProvider } from '@blocksuite/affine-shared/services';
|
||||
import { getBlockProps } from '@blocksuite/affine-shared/utils';
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
import { GfxBlockElementModel } from '@blocksuite/block-std/gfx';
|
||||
import { type BlockModel, type Doc } from '@blocksuite/store';
|
||||
import { type BlockModel, type Blocks } from '@blocksuite/store';
|
||||
|
||||
import {
|
||||
getElementProps,
|
||||
@@ -14,7 +14,11 @@ import {
|
||||
} from '../../../edgeless/utils/clone-utils.js';
|
||||
import { isFrameBlock, isNoteBlock } from '../../../edgeless/utils/query.js';
|
||||
|
||||
function addBlocksToDoc(targetDoc: Doc, model: BlockModel, parentId: string) {
|
||||
function addBlocksToDoc(
|
||||
targetDoc: Blocks,
|
||||
model: BlockModel,
|
||||
parentId: string
|
||||
) {
|
||||
// Add current block to linked doc
|
||||
const blockProps = getBlockProps(model);
|
||||
const newModelId = targetDoc.addBlock(
|
||||
@@ -32,7 +36,7 @@ function addBlocksToDoc(targetDoc: Doc, model: BlockModel, parentId: string) {
|
||||
}
|
||||
|
||||
export function createLinkedDocFromNote(
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
note: NoteBlockModel,
|
||||
docTitle?: string
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user