mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-03 19:19:01 +08:00
chore(pm): update all prosemirror package dependencies (#4714)
* chore(pm): update all prosemirror package dependencies * rchore(core): remove filterTransaction from state * fix(demo): fix typings in vue demo * feat(core): add missing prosemirror commands for joining textblocks * adoc: added documentation for missing commands --------- Co-authored-by: bdbch <dominik@bdbch.com>
This commit is contained in:
parent
fd8d4c0901
commit
894c732d29
@ -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')
|
||||
@ -9,7 +11,7 @@ export interface AnnotationPluginOptions {
|
||||
HTMLAttributes: {
|
||||
[key: string]: any
|
||||
}
|
||||
onUpdate: (items: [any?]) => {}
|
||||
onUpdate: (items: AnnotationItem[]) => {}
|
||||
map: Y.Map<any>
|
||||
instance: string
|
||||
}
|
||||
@ -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
|
||||
},
|
||||
|
8
docs/api/commands/join-textblock-backward.md
Normal file
8
docs/api/commands/join-textblock-backward.md
Normal file
@ -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
docs/api/commands/join-textblock-forward.md
Normal file
8
docs/api/commands/join-textblock-forward.md
Normal file
@ -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()
|
||||
```
|
||||
|
520
package-lock.json
generated
520
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,8 @@ export * from './insertContentAt.js'
|
||||
export * from './join.js'
|
||||
export * from './joinItemBackward.js'
|
||||
export * from './joinItemForward.js'
|
||||
export * from './joinTextblockBackward.js'
|
||||
export * from './joinTextblockForward.js'
|
||||
export * from './keyboardShortcut.js'
|
||||
export * from './lift.js'
|
||||
export * from './liftEmptyBlock.js'
|
||||
|
18
packages/core/src/commands/joinTextblockBackward.ts
Normal file
18
packages/core/src/commands/joinTextblockBackward.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { joinTextblockBackward as originalCommand } from '@tiptap/pm/commands'
|
||||
|
||||
import { RawCommands } from '../types.js'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
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.
|
||||
*/
|
||||
joinTextblockBackward: () => ReturnType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const joinTextblockBackward: RawCommands['joinTextblockBackward'] = () => ({ state, dispatch }) => {
|
||||
return originalCommand(state, dispatch)
|
||||
}
|
18
packages/core/src/commands/joinTextblockForward.ts
Normal file
18
packages/core/src/commands/joinTextblockForward.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { joinTextblockForward as originalCommand } from '@tiptap/pm/commands'
|
||||
|
||||
import { RawCommands } from '../types.js'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
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.
|
||||
*/
|
||||
joinTextblockForward: () => ReturnType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const joinTextblockForward: RawCommands['joinTextblockForward'] = () => ({ state, dispatch }) => {
|
||||
return originalCommand(state, dispatch)
|
||||
}
|
@ -13,7 +13,6 @@ export function createChainableState(config: {
|
||||
...state,
|
||||
apply: state.apply.bind(state),
|
||||
applyTransaction: state.applyTransaction.bind(state),
|
||||
filterTransaction: state.filterTransaction,
|
||||
plugins: state.plugins,
|
||||
schema: state.schema,
|
||||
reconfigure: state.reconfigure.bind(state),
|
||||
|
@ -126,24 +126,24 @@
|
||||
"view/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"prosemirror-changeset": "^2.2.0",
|
||||
"prosemirror-collab": "^1.3.0",
|
||||
"prosemirror-commands": "^1.3.1",
|
||||
"prosemirror-dropcursor": "^1.5.0",
|
||||
"prosemirror-gapcursor": "^1.3.1",
|
||||
"prosemirror-history": "^1.3.0",
|
||||
"prosemirror-inputrules": "^1.2.0",
|
||||
"prosemirror-keymap": "^1.2.0",
|
||||
"prosemirror-markdown": "^1.10.1",
|
||||
"prosemirror-menu": "^1.2.1",
|
||||
"prosemirror-model": "^1.18.1",
|
||||
"prosemirror-schema-basic": "^1.2.0",
|
||||
"prosemirror-schema-list": "^1.2.2",
|
||||
"prosemirror-state": "^1.4.1",
|
||||
"prosemirror-tables": "^1.3.0",
|
||||
"prosemirror-trailing-node": "^2.0.2",
|
||||
"prosemirror-transform": "^1.7.0",
|
||||
"prosemirror-view": "^1.28.2"
|
||||
"prosemirror-changeset": "^2.2.1",
|
||||
"prosemirror-collab": "^1.3.1",
|
||||
"prosemirror-commands": "^1.5.2",
|
||||
"prosemirror-dropcursor": "^1.8.1",
|
||||
"prosemirror-gapcursor": "^1.3.2",
|
||||
"prosemirror-history": "^1.3.2",
|
||||
"prosemirror-inputrules": "^1.3.0",
|
||||
"prosemirror-keymap": "^1.2.2",
|
||||
"prosemirror-markdown": "^1.12.0",
|
||||
"prosemirror-menu": "^1.2.4",
|
||||
"prosemirror-model": "^1.19.4",
|
||||
"prosemirror-schema-basic": "^1.2.2",
|
||||
"prosemirror-schema-list": "^1.3.0",
|
||||
"prosemirror-state": "^1.4.3",
|
||||
"prosemirror-tables": "^1.3.5",
|
||||
"prosemirror-trailing-node": "^2.0.7",
|
||||
"prosemirror-transform": "^1.8.0",
|
||||
"prosemirror-view": "^1.32.7"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user