diff --git a/src/model/TextBlock.ts b/src/model/TextBlock.ts index a6a26184..8700dcf3 100644 --- a/src/model/TextBlock.ts +++ b/src/model/TextBlock.ts @@ -1,9 +1,10 @@ import Block from './Block' -import { TextAttributesMap, BlockAttributesMap } from '@delta/attributes' +import Document from './Document' +import { TextAttributesMap } from '@delta/attributes' import { boundMethod } from 'autobind-decorator' import { Selection } from '@delta/selection' import TextTransformsRegistry from '@core/TextTransformsRegistry' -import { DeltaChangeContext } from '@delta/DocumentDelta'; +import { DeltaChangeContext } from '@delta/DocumentDelta' export default class TextBlock extends Block { @@ -14,6 +15,12 @@ export default class TextBlock extends Block { } private length: number = 0 + constructor( + blockInterface: Document.BlockInterface + ) { + super(blockInterface) + } + getSelection(): Selection { // TODO inspect dependencies and refactor return this.selection @@ -43,7 +50,6 @@ export default class TextBlock extends Block { @boundMethod handleOnTextChange(newText: string, context: DeltaChangeContext): void { - // Sanitize newText here const updatedDelta = this.getDelta().applyTextDiff(newText, context) this.updateDelta(updatedDelta) this.length = newText.length