refactor(editor): add schema on block model (#9815)
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,8 +38,6 @@ export const ParagraphBlockSchema = defineBlockSchema({
|
||||
});
|
||||
|
||||
export class ParagraphBlockModel extends BlockModel<ParagraphProps> {
|
||||
override flavour!: 'affine:paragraph';
|
||||
|
||||
override text!: Text;
|
||||
|
||||
override isEmpty(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user