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:
@@ -11,7 +11,7 @@ import {
|
||||
LinkedPageIcon,
|
||||
PageIcon,
|
||||
} from '@blocksuite/icons/lit';
|
||||
import type { Doc } from '@blocksuite/store';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
import { computed, type Signal, signal } from '@preact/signals-core';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
@@ -70,9 +70,9 @@ export class DocDisplayMetaService
|
||||
|
||||
readonly disposables: Disposable[] = [];
|
||||
|
||||
readonly iconMap = new WeakMap<Doc, Signal<TemplateResult>>();
|
||||
readonly iconMap = new WeakMap<Blocks, Signal<TemplateResult>>();
|
||||
|
||||
readonly titleMap = new WeakMap<Doc, Signal<string>>();
|
||||
readonly titleMap = new WeakMap<Blocks, Signal<string>>();
|
||||
|
||||
static override setup(di: Container) {
|
||||
di.addImpl(DocDisplayMetaProvider, this, [StdIdentifier]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BlockModel, Doc, DraftModel } from '@blocksuite/store';
|
||||
import type { BlockModel, Blocks, DraftModel } from '@blocksuite/store';
|
||||
import { minimatch } from 'minimatch';
|
||||
|
||||
export function matchFlavours<Key extends (keyof BlockSuite.BlockModels)[]>(
|
||||
@@ -14,7 +14,7 @@ export function matchFlavours<Key extends (keyof BlockSuite.BlockModels)[]>(
|
||||
}
|
||||
|
||||
export function isInsideBlockByFlavour(
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
block: BlockModel | string,
|
||||
flavour: string
|
||||
): boolean {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type NoteBlockModel, NoteDisplayMode } from '@blocksuite/affine-model';
|
||||
import type { BlockComponent, EditorHost } from '@blocksuite/block-std';
|
||||
import type { BlockModel, Doc } from '@blocksuite/store';
|
||||
import type { BlockModel, Blocks } from '@blocksuite/store';
|
||||
|
||||
import { matchFlavours } from './checker.js';
|
||||
|
||||
@@ -41,7 +41,7 @@ export function findNoteBlockModel(model: BlockModel) {
|
||||
) as NoteBlockModel | null;
|
||||
}
|
||||
|
||||
export function getLastNoteBlock(doc: Doc) {
|
||||
export function getLastNoteBlock(doc: Blocks) {
|
||||
let note: NoteBlockModel | null = null;
|
||||
if (!doc.root) return null;
|
||||
const { children } = doc.root;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ListBlockModel } from '@blocksuite/affine-model';
|
||||
import type { BlockStdScope } from '@blocksuite/block-std';
|
||||
import type { BlockModel, Doc } from '@blocksuite/store';
|
||||
import type { BlockModel, Blocks } from '@blocksuite/store';
|
||||
|
||||
import { matchFlavours } from './checker.js';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { matchFlavours } from './checker.js';
|
||||
* typically used for updating list numbers. The result not contains the list passed in.
|
||||
*/
|
||||
export function getNextContinuousNumberedLists(
|
||||
doc: Doc,
|
||||
doc: Blocks,
|
||||
modelOrId: BlockModel | string
|
||||
): ListBlockModel[] {
|
||||
const model =
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { BlockModel, Doc, Text } from '@blocksuite/store';
|
||||
import type { BlockModel, Blocks, Text } from '@blocksuite/store';
|
||||
|
||||
export function transformModel(
|
||||
model: BlockModel,
|
||||
flavour: BlockSuite.Flavour,
|
||||
props?: Parameters<Doc['addBlock']>[1]
|
||||
props?: Parameters<Blocks['addBlock']>[1]
|
||||
) {
|
||||
const doc = model.doc;
|
||||
const parent = doc.getParent(model);
|
||||
|
||||
Reference in New Issue
Block a user