Add options to enable / disable dropCursor and gapCursor

This commit is contained in:
Christos Christou 2020-05-21 11:22:35 +01:00
parent 92eb2c61cc
commit 721160ea1f
2 changed files with 6 additions and 2 deletions

View File

@ -72,6 +72,8 @@ export default {
| `extensions` | `Array` | `[]` | A list of extensions used, by the editor. This can be `Nodes`, `Marks` or `Plugins`. | | `extensions` | `Array` | `[]` | A list of extensions used, by the editor. This can be `Nodes`, `Marks` or `Plugins`. |
| `useBuiltInExtensions` | `Boolean` | `true` | By default tiptap adds a `Doc`, `Paragraph` and `Text` node to the Prosemirror schema. | | `useBuiltInExtensions` | `Boolean` | `true` | By default tiptap adds a `Doc`, `Paragraph` and `Text` node to the Prosemirror schema. |
| `dropCursor` | `Object` | `{}` | Config for `prosemirror-dropcursor`. | | `dropCursor` | `Object` | `{}` | Config for `prosemirror-dropcursor`. |
| `enableDropCursor` | `Boolean` | `true` | Option to enable / disable the dropCursor plugin`. |
| `enableGapCursor` | `Boolean` | `true` | Option to enable / disable the gapCursor plugin`. |
| `parseOptions` | `Object` | `{}` | A list of [Prosemirror parseOptions](https://prosemirror.net/docs/ref/#model.ParseOptions). | | `parseOptions` | `Object` | `{}` | A list of [Prosemirror parseOptions](https://prosemirror.net/docs/ref/#model.ParseOptions). |
| `onInit` | `Function` | `undefined` | This will return an Object with the current `state` and `view` of Prosemirror on init. | | `onInit` | `Function` | `undefined` | This will return an Object with the current `state` and `view` of Prosemirror on init. |
| `onFocus` | `Function` | `undefined` | This will return an Object with the `event` and current `state` and `view` of Prosemirror on focus. | | `onFocus` | `Function` | `undefined` | This will return an Object with the `event` and current `state` and `view` of Prosemirror on focus. |

View File

@ -50,6 +50,8 @@ export default class Editor extends Emitter {
disableInputRules: false, disableInputRules: false,
disablePasteRules: false, disablePasteRules: false,
dropCursor: {}, dropCursor: {},
enableDropCursor: true,
enableGapCursor: true,
parseOptions: {}, parseOptions: {},
injectCSS: true, injectCSS: true,
onInit: () => {}, onInit: () => {},
@ -211,8 +213,8 @@ export default class Editor extends Emitter {
Backspace: undoInputRule, Backspace: undoInputRule,
}), }),
keymap(baseKeymap), keymap(baseKeymap),
dropCursor(this.options.dropCursor), ...(enableDropCursor ? [dropCursor(this.options.dropCursor)] : []),
gapCursor(), ...(enableGapCursor ? [gapCursor()] : []),
new Plugin({ new Plugin({
key: new PluginKey('editable'), key: new PluginKey('editable'),
props: { props: {