diff options
author | Max <max@nextcloud.com> | 2022-04-11 10:35:30 +0300 |
---|---|---|
committer | Max <max@nextcloud.com> | 2022-06-07 20:41:56 +0300 |
commit | ef7b0fdfd6d130a073d089c24ac4b7297842417b (patch) | |
tree | 08148b9a76e5e7c986cc26f1dec265ca3fb79b7d /src/extensions/RichText.js | |
parent | c3d4c53a8316a7e3b8f3fe6046463cd928f12611 (diff) |
refactor: use Editor.new directly in ReadOnlyEditor
Introduce a `Plaintext` tiptap extension
that bundles all the extensions used for plain text editing.
This allows calling `Editor.new` directly with just a few extensions.
No need to rely on `createEditor` from the editor factory anymore.
Also prevent error messages about undefined callbacks
because no callbacks were handed to `createEditor` in `ReadOnlyEditor`.
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'src/extensions/RichText.js')
-rw-r--r-- | src/extensions/RichText.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/extensions/RichText.js b/src/extensions/RichText.js index b7fd5d030..0356aeec8 100644 --- a/src/extensions/RichText.js +++ b/src/extensions/RichText.js @@ -60,7 +60,7 @@ export default Extension.create({ }, addExtensions() { - return [ + const extensions = [ Document, Text, Paragraph, @@ -69,7 +69,6 @@ export default Extension.create({ Strong, Italic, Strike, - Link.configure({ openOnClick: true }), Blockquote, CodeBlock, BulletList, @@ -91,6 +90,10 @@ export default Extension.create({ }), Dropcursor, ] + if (this.options.link !== false) { + extensions.push(Link.configure({ openOnClick: true })) + } + return extensions }, }) |