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:
@@ -1,6 +1,6 @@
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||
import { type BlockModel, BlockViewType, Doc } from '@blocksuite/store';
|
||||
import { type BlockModel, Blocks, BlockViewType } from '@blocksuite/store';
|
||||
import { consume, provide } from '@lit/context';
|
||||
import { computed } from '@preact/signals-core';
|
||||
import { nothing, type TemplateResult } from 'lit';
|
||||
@@ -23,7 +23,7 @@ import { ShadowlessElement } from './shadowless-element.js';
|
||||
import type { WidgetComponent } from './widget-component.js';
|
||||
|
||||
@requiredProperties({
|
||||
doc: PropTypes.instanceOf(Doc),
|
||||
doc: PropTypes.instanceOf(Blocks),
|
||||
std: PropTypes.object,
|
||||
widgets: PropTypes.recordOf(PropTypes.object),
|
||||
})
|
||||
@@ -307,7 +307,7 @@ export class BlockComponent<
|
||||
private accessor _service: Service | null = null;
|
||||
|
||||
@consume({ context: docContext })
|
||||
accessor doc!: Doc;
|
||||
accessor doc!: Blocks;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor viewType: BlockViewType = BlockViewType.Display;
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
handleError,
|
||||
} from '@blocksuite/global/exceptions';
|
||||
import { SignalWatcher, Slot, WithDisposable } from '@blocksuite/global/utils';
|
||||
import { type BlockModel, BlockViewType, Doc } from '@blocksuite/store';
|
||||
import { type BlockModel, Blocks, BlockViewType } from '@blocksuite/store';
|
||||
import { createContext, provide } from '@lit/context';
|
||||
import { css, LitElement, nothing, type TemplateResult } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
@@ -22,11 +22,11 @@ import type { ViewStore } from '../view-store.js';
|
||||
import { BLOCK_ID_ATTR, WIDGET_ID_ATTR } from './consts.js';
|
||||
import { ShadowlessElement } from './shadowless-element.js';
|
||||
|
||||
export const docContext = createContext<Doc>('doc');
|
||||
export const docContext = createContext<Blocks>('doc');
|
||||
export const stdContext = createContext<BlockStdScope>('std');
|
||||
|
||||
@requiredProperties({
|
||||
doc: PropTypes.instanceOf(Doc),
|
||||
doc: PropTypes.instanceOf(Blocks),
|
||||
std: PropTypes.object,
|
||||
})
|
||||
export class EditorHost extends SignalWatcher(
|
||||
@@ -189,7 +189,7 @@ export class EditorHost extends SignalWatcher(
|
||||
|
||||
@provide({ context: docContext })
|
||||
@property({ attribute: false })
|
||||
accessor doc!: Doc;
|
||||
accessor doc!: Blocks;
|
||||
|
||||
@provide({ context: stdContext })
|
||||
@property({ attribute: false })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||
import type { BlockModel, Doc } from '@blocksuite/store';
|
||||
import type { BlockModel, Blocks } from '@blocksuite/store';
|
||||
import { consume } from '@lit/context';
|
||||
import { LitElement } from 'lit';
|
||||
|
||||
@@ -94,7 +94,7 @@ export class WidgetComponent<
|
||||
}
|
||||
|
||||
@consume({ context: docContext })
|
||||
private accessor _doc!: Doc;
|
||||
private accessor _doc!: Blocks;
|
||||
|
||||
@consume({ context: modelContext })
|
||||
private accessor _model!: Model;
|
||||
|
||||
Reference in New Issue
Block a user