mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 13:57:02 +08:00
refactor(editor): remove block models global type (#10086)
This commit is contained in:
@@ -12,7 +12,7 @@ import type {
|
||||
TransformerSlots,
|
||||
} from '@blocksuite/store';
|
||||
|
||||
import { matchFlavours } from '../../utils';
|
||||
import { matchModels } from '../../utils';
|
||||
|
||||
const handlePoint = (
|
||||
point: TextRangePoint,
|
||||
@@ -20,7 +20,7 @@ const handlePoint = (
|
||||
model: DraftModel
|
||||
) => {
|
||||
const { index, length } = point;
|
||||
if (matchFlavours(model, [RootBlockModel])) {
|
||||
if (matchModels(model, [RootBlockModel])) {
|
||||
if (length === 0) return;
|
||||
(snapshot.props.title as Record<string, unknown>).delta =
|
||||
model.title.sliceToDelta(index, length + index);
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
TelemetryProvider,
|
||||
} from '../../services';
|
||||
import type { AffineTextAttributes } from '../../types';
|
||||
import { matchFlavours, referenceToNode } from '../../utils';
|
||||
import { matchModels, referenceToNode } from '../../utils';
|
||||
|
||||
function findLastMatchingNode(
|
||||
root: BlockSnapshot[],
|
||||
@@ -293,7 +293,7 @@ class PasteTr {
|
||||
return;
|
||||
}
|
||||
if (!cursorModel.text) {
|
||||
if (matchFlavours(cursorModel, [ImageBlockModel])) {
|
||||
if (matchModels(cursorModel, [ImageBlockModel])) {
|
||||
const selection = this.std.selection.create(ImageSelection, {
|
||||
blockId: target.blockId,
|
||||
});
|
||||
@@ -358,7 +358,7 @@ class PasteTr {
|
||||
if (
|
||||
this.firstSnapshot !== this.lastSnapshot &&
|
||||
this.lastSnapshot.props.text &&
|
||||
!matchFlavours(this.pointState.model, [CodeBlockModel])
|
||||
!matchModels(this.pointState.model, [CodeBlockModel])
|
||||
) {
|
||||
const text = fromJSON(this.lastSnapshot.props.text) as Text;
|
||||
const doc = new Y.Doc();
|
||||
|
||||
Reference in New Issue
Block a user