Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pm): update all prosemirror package dependencies #4714

Merged
merged 5 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Plugin, PluginKey } from '@tiptap/pm/state'
import { DecorationSet } from 'prosemirror-view'
import * as Y from 'yjs'

import { AnnotationItem } from './AnnotationItem.js'
import { AnnotationState } from './AnnotationState.js'

export const AnnotationPluginKey = new PluginKey('annotation')
Expand All @@ -9,7 +11,7 @@ export interface AnnotationPluginOptions {
HTMLAttributes: {
[key: string]: any
}
onUpdate: (items: [any?]) => {}
onUpdate: (items: AnnotationItem[]) => {}
map: Y.Map<any>
instance: string
}
Expand All @@ -32,16 +34,18 @@ export const AnnotationPlugin = (options: AnnotationPluginOptions) => new Plugin

props: {
decorations(state) {
const { decorations } = this.getState(state)
const decorations = this.getState(state)?.decorations || new DecorationSet()
const { selection } = state

if (!selection.empty) {
return decorations
}

const annotations = this.getState(state).annotationsAt(selection.from)
const annotations = this.getState(state)?.annotationsAt(selection.from)

options.onUpdate(annotations)
if (annotations) {
options.onUpdate(annotations)
}

return decorations
},
Expand Down
8 changes: 8 additions & 0 deletions docs/api/commands/join-textblock-backward.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# joinTextblockBackward
A more limited form of joinBackward that only tries to join the current textblock to the one before it, if the cursor is at the start of a textblock. [See also](https://prosemirror.net/docs/ref/#commands.joinTextblockBackward)

## Usage
```js
editor.commands.joinTextblockBackward()
```

8 changes: 8 additions & 0 deletions docs/api/commands/join-textblock-forward.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# joinTextblockForward
A more limited form of joinForward that only tries to join the current textblock to the one after it, if the cursor is at the end of a textblock. [See also](https://prosemirror.net/docs/ref/#commands.joinTextblockForward)

## Usage
```js
editor.commands.joinTextblockForward()
```

Loading
Loading