annotations: refactoring

This commit is contained in:
Hans Pagel 2021-02-12 10:50:21 +01:00
parent 39365c77cb
commit 0697efef30
2 changed files with 7 additions and 7 deletions

View File

@ -1,10 +1,10 @@
export class AnnotationItem {
public id!: string
public text!: string
public content!: string
constructor(id: string, text: string) {
constructor(id: string, content: string) {
this.id = id
this.text = text
this.content = content
}
}

View File

@ -69,7 +69,7 @@ export class AnnotationState {
}
annotationsAt(position: number) {
return this.decorations?.find(position, position)
return this.decorations.find(position, position)
}
updateDecorations(state: EditorState) {
@ -89,9 +89,9 @@ export class AnnotationState {
return
}
const decoration = Decoration.inline(from, to, HTMLAttributes, { data: dec.data })
return decorations.push(decoration)
return decorations.push(
Decoration.inline(from, to, HTMLAttributes, { data: dec.data }),
)
})
this.decorations = DecorationSet.create(state.doc, decorations)