mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 06:03:22 +08:00
annotations: refactoring
This commit is contained in:
parent
39365c77cb
commit
0697efef30
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user