refactor(editor): add schema on block model (#9815)

This commit is contained in:
Saul-Mirone
2025-01-21 03:56:10 +00:00
parent d2bde09ef6
commit f744002808
7 changed files with 28 additions and 23 deletions

View File

@@ -23,9 +23,9 @@ export class ImageResizeManager {
assertExists(this._imageContainer);
const dragModel = getModelByElement(this._activeComponent);
dragModel?.page.captureSync();
dragModel?.doc.captureSync();
const { width, height } = this._imageContainer.getBoundingClientRect();
dragModel?.page.updateBlock(dragModel, {
dragModel?.doc.updateBlock(dragModel, {
width: width / this._zoom,
height: height / this._zoom,
});

View File

@@ -60,7 +60,7 @@ export const splitParagraphCommand: Command<
store.captureSync();
const right = model.text.split(splitIndex, splitLength);
const id = store.addBlock(
model.flavour,
model.flavour as BlockSuite.Flavour,
{
text: right,
type: model.type,

View File

@@ -134,7 +134,7 @@ export const ParagraphKeymapExtension = KeymapExtension(
const rightText = model.text.split(range.index);
const newId = store.addBlock(
model.flavour,
model.flavour as BlockSuite.Flavour,
{ type: model.type, text: rightText },
parent,
index + collapsedSiblings.length + 1

View File

@@ -38,8 +38,6 @@ export const ParagraphBlockSchema = defineBlockSchema({
});
export class ParagraphBlockModel extends BlockModel<ParagraphProps> {
override flavour!: 'affine:paragraph';
override text!: Text;
override isEmpty(): boolean {