Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-06-16 12:44:23 +0300
committerJulius Härtl <jus@bitgrid.net>2020-06-22 08:50:53 +0300
commit3ee4f55b80ab33e6a391c867d1c2cbb1637e789b (patch)
tree88d59270654ef9e68c1b97144fa142ad25ecd496 /src
parentc4cf7b0947810c9ca7279ca4b0ea3b69fe16c601 (diff)
Show tooltip on link hover
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r--src/EditorFactory.js3
-rw-r--r--src/marks/index.js31
2 files changed, 31 insertions, 3 deletions
diff --git a/src/EditorFactory.js b/src/EditorFactory.js
index 8e9027257..0b0d1b793 100644
--- a/src/EditorFactory.js
+++ b/src/EditorFactory.js
@@ -24,7 +24,6 @@ import {
HardBreak,
Heading,
Code,
- Link,
BulletList,
OrderedList,
Blockquote,
@@ -34,7 +33,7 @@ import {
History,
Placeholder,
} from 'tiptap-extensions'
-import { Strong, Italic, Strike } from './marks'
+import { Strong, Italic, Strike, Link } from './marks'
import { Image, PlainTextDocument, ListItem } from './nodes'
import MarkdownIt from 'markdown-it'
import taskLists from 'markdown-it-task-lists'
diff --git a/src/marks/index.js b/src/marks/index.js
index d37ffd511..d66da88ca 100644
--- a/src/marks/index.js
+++ b/src/marks/index.js
@@ -20,7 +20,7 @@
*
*/
-import { Bold, Italic as TipTapItalic, Strike as TipTapStrike } from 'tiptap-extensions'
+import { Bold, Italic as TipTapItalic, Strike as TipTapStrike, Link as TipTapLink } from 'tiptap-extensions'
/**
* This file maps prosemirror mark names to tiptap classes,
@@ -74,10 +74,39 @@ class Strike extends TipTapStrike {
}
+class Link extends TipTapLink {
+
+ get schema() {
+ return {
+ attrs: {
+ href: {
+ default: null,
+ },
+ },
+ inclusive: false,
+ parseDOM: [
+ {
+ tag: 'a[href]',
+ getAttrs: dom => ({
+ href: dom.getAttribute('href'),
+ }),
+ },
+ ],
+ toDOM: node => ['a', {
+ ...node.attrs,
+ title: node.attrs.href,
+ rel: 'noopener noreferrer nofollow',
+ }, 0],
+ }
+ }
+
+}
+
/** Strike is currently unsupported by prosemirror-markdown */
export {
Strong,
Italic,
Strike,
+ Link,
}