From 721160ea1fc0be187e7afaadc5616f9842739f22 Mon Sep 17 00:00:00 2001 From: Christos Christou Date: Thu, 21 May 2020 11:22:35 +0100 Subject: [PATCH] Add options to enable / disable dropCursor and gapCursor --- README.md | 2 ++ packages/tiptap/src/Editor.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6ac5ba037..7c159dfe3 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ export default { | `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. | | `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). | | `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. | diff --git a/packages/tiptap/src/Editor.js b/packages/tiptap/src/Editor.js index 6e80fae64..f0de73631 100644 --- a/packages/tiptap/src/Editor.js +++ b/packages/tiptap/src/Editor.js @@ -50,6 +50,8 @@ export default class Editor extends Emitter { disableInputRules: false, disablePasteRules: false, dropCursor: {}, + enableDropCursor: true, + enableGapCursor: true, parseOptions: {}, injectCSS: true, onInit: () => {}, @@ -211,8 +213,8 @@ export default class Editor extends Emitter { Backspace: undoInputRule, }), keymap(baseKeymap), - dropCursor(this.options.dropCursor), - gapCursor(), + ...(enableDropCursor ? [dropCursor(this.options.dropCursor)] : []), + ...(enableGapCursor ? [gapCursor()] : []), new Plugin({ key: new PluginKey('editable'), props: {