@tiptap/extension-link 2.0.0-beta.26 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/packages/extension-link/src/index.d.ts +0 -3
- package/dist/packages/extension-link/src/link.d.ts +0 -40
- package/dist/tiptap-extension-link.cjs.js +0 -127
- package/dist/tiptap-extension-link.cjs.js.map +0 -1
- package/dist/tiptap-extension-link.esm.js +0 -122
- package/dist/tiptap-extension-link.esm.js.map +0 -1
- package/dist/tiptap-extension-link.umd.js +0 -129
- package/dist/tiptap-extension-link.umd.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-link",
|
|
3
3
|
"description": "link extension for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.27",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
33
33
|
"directory": "packages/extension-link"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "fce16e805824972834d5a8ce8d60e3ff41d63c7e"
|
|
36
36
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Mark } from '@tiptap/core';
|
|
2
|
-
export interface LinkOptions {
|
|
3
|
-
/**
|
|
4
|
-
* If enabled, links will be opened on click.
|
|
5
|
-
*/
|
|
6
|
-
openOnClick: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Adds a link to the current selection if the pasted content only contains an url.
|
|
9
|
-
*/
|
|
10
|
-
linkOnPaste: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* A list of HTML attributes to be rendered.
|
|
13
|
-
*/
|
|
14
|
-
HTMLAttributes: Record<string, any>;
|
|
15
|
-
}
|
|
16
|
-
declare module '@tiptap/core' {
|
|
17
|
-
interface Commands<ReturnType> {
|
|
18
|
-
link: {
|
|
19
|
-
/**
|
|
20
|
-
* Set a link mark
|
|
21
|
-
*/
|
|
22
|
-
setLink: (attributes: {
|
|
23
|
-
href: string;
|
|
24
|
-
target?: string;
|
|
25
|
-
}) => ReturnType;
|
|
26
|
-
/**
|
|
27
|
-
* Toggle a link mark
|
|
28
|
-
*/
|
|
29
|
-
toggleLink: (attributes: {
|
|
30
|
-
href: string;
|
|
31
|
-
target?: string;
|
|
32
|
-
}) => ReturnType;
|
|
33
|
-
/**
|
|
34
|
-
* Unset a link mark
|
|
35
|
-
*/
|
|
36
|
-
unsetLink: () => ReturnType;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export declare const Link: Mark<LinkOptions, any>;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@tiptap/core');
|
|
6
|
-
var prosemirrorState = require('prosemirror-state');
|
|
7
|
-
var linkifyjs = require('linkifyjs');
|
|
8
|
-
|
|
9
|
-
const Link = core.Mark.create({
|
|
10
|
-
name: 'link',
|
|
11
|
-
priority: 1000,
|
|
12
|
-
inclusive: false,
|
|
13
|
-
addOptions() {
|
|
14
|
-
return {
|
|
15
|
-
openOnClick: true,
|
|
16
|
-
linkOnPaste: true,
|
|
17
|
-
HTMLAttributes: {
|
|
18
|
-
target: '_blank',
|
|
19
|
-
rel: 'noopener noreferrer nofollow',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
addAttributes() {
|
|
24
|
-
return {
|
|
25
|
-
href: {
|
|
26
|
-
default: null,
|
|
27
|
-
},
|
|
28
|
-
target: {
|
|
29
|
-
default: this.options.HTMLAttributes.target,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
parseHTML() {
|
|
34
|
-
return [
|
|
35
|
-
{ tag: 'a[href]' },
|
|
36
|
-
];
|
|
37
|
-
},
|
|
38
|
-
renderHTML({ HTMLAttributes }) {
|
|
39
|
-
return ['a', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
40
|
-
},
|
|
41
|
-
addCommands() {
|
|
42
|
-
return {
|
|
43
|
-
setLink: attributes => ({ commands }) => {
|
|
44
|
-
return commands.setMark('link', attributes);
|
|
45
|
-
},
|
|
46
|
-
toggleLink: attributes => ({ commands }) => {
|
|
47
|
-
return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true });
|
|
48
|
-
},
|
|
49
|
-
unsetLink: () => ({ commands }) => {
|
|
50
|
-
return commands.unsetMark('link', { extendEmptyMarkRange: true });
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
addPasteRules() {
|
|
55
|
-
return [
|
|
56
|
-
core.markPasteRule({
|
|
57
|
-
find: text => linkifyjs.find(text)
|
|
58
|
-
.filter(link => link.isLink)
|
|
59
|
-
.map(link => ({
|
|
60
|
-
text: link.value,
|
|
61
|
-
index: link.start,
|
|
62
|
-
data: link,
|
|
63
|
-
})),
|
|
64
|
-
type: this.type,
|
|
65
|
-
getAttributes: match => {
|
|
66
|
-
var _a;
|
|
67
|
-
return ({
|
|
68
|
-
href: (_a = match.data) === null || _a === void 0 ? void 0 : _a.href,
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
];
|
|
73
|
-
},
|
|
74
|
-
addProseMirrorPlugins() {
|
|
75
|
-
const plugins = [];
|
|
76
|
-
if (this.options.openOnClick) {
|
|
77
|
-
plugins.push(new prosemirrorState.Plugin({
|
|
78
|
-
key: new prosemirrorState.PluginKey('handleClickLink'),
|
|
79
|
-
props: {
|
|
80
|
-
handleClick: (view, pos, event) => {
|
|
81
|
-
var _a;
|
|
82
|
-
const attrs = this.editor.getAttributes('link');
|
|
83
|
-
const link = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('a');
|
|
84
|
-
if (link && attrs.href) {
|
|
85
|
-
window.open(attrs.href, attrs.target);
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
return false;
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
if (this.options.linkOnPaste) {
|
|
94
|
-
plugins.push(new prosemirrorState.Plugin({
|
|
95
|
-
key: new prosemirrorState.PluginKey('handlePasteLink'),
|
|
96
|
-
props: {
|
|
97
|
-
handlePaste: (view, event, slice) => {
|
|
98
|
-
const { state } = view;
|
|
99
|
-
const { selection } = state;
|
|
100
|
-
const { empty } = selection;
|
|
101
|
-
if (empty) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
let textContent = '';
|
|
105
|
-
slice.content.forEach(node => {
|
|
106
|
-
textContent += node.textContent;
|
|
107
|
-
});
|
|
108
|
-
const link = linkifyjs.find(textContent)
|
|
109
|
-
.find(item => item.isLink && item.value === textContent);
|
|
110
|
-
if (!textContent || !link) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
this.editor.commands.setMark(this.type, {
|
|
114
|
-
href: link.href,
|
|
115
|
-
});
|
|
116
|
-
return true;
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
return plugins;
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
exports.Link = Link;
|
|
126
|
-
exports["default"] = Link;
|
|
127
|
-
//# sourceMappingURL=tiptap-extension-link.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-link.cjs.js","sources":["../src/link.ts"],"sourcesContent":["import {\n Mark,\n markPasteRule,\n mergeAttributes,\n} from '@tiptap/core'\nimport { Plugin, PluginKey } from 'prosemirror-state'\nimport { find } from 'linkifyjs'\n\nexport interface LinkOptions {\n /**\n * If enabled, links will be opened on click.\n */\n openOnClick: boolean,\n /**\n * Adds a link to the current selection if the pasted content only contains an url.\n */\n linkOnPaste: boolean,\n /**\n * A list of HTML attributes to be rendered.\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n link: {\n /**\n * Set a link mark\n */\n setLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Toggle a link mark\n */\n toggleLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Unset a link mark\n */\n unsetLink: () => ReturnType,\n }\n }\n}\n\nexport const Link = Mark.create<LinkOptions>({\n name: 'link',\n\n priority: 1000,\n\n inclusive: false,\n\n addOptions() {\n return {\n openOnClick: true,\n linkOnPaste: true,\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer nofollow',\n },\n }\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n }\n },\n\n parseHTML() {\n return [\n { tag: 'a[href]' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setLink: attributes => ({ commands }) => {\n return commands.setMark('link', attributes)\n },\n toggleLink: attributes => ({ commands }) => {\n return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true })\n },\n unsetLink: () => ({ commands }) => {\n return commands.unsetMark('link', { extendEmptyMarkRange: true })\n },\n }\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: text => find(text)\n .filter(link => link.isLink)\n .map(link => ({\n text: link.value,\n index: link.start,\n data: link,\n })),\n type: this.type,\n getAttributes: match => ({\n href: match.data?.href,\n }),\n }),\n ]\n },\n\n addProseMirrorPlugins() {\n const plugins = []\n\n if (this.options.openOnClick) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handleClickLink'),\n props: {\n handleClick: (view, pos, event) => {\n const attrs = this.editor.getAttributes('link')\n const link = (event.target as HTMLElement)?.closest('a')\n\n if (link && attrs.href) {\n window.open(attrs.href, attrs.target)\n\n return true\n }\n\n return false\n },\n },\n }),\n )\n }\n\n if (this.options.linkOnPaste) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handlePasteLink'),\n props: {\n handlePaste: (view, event, slice) => {\n const { state } = view\n const { selection } = state\n const { empty } = selection\n\n if (empty) {\n return false\n }\n\n let textContent = ''\n\n slice.content.forEach(node => {\n textContent += node.textContent\n })\n\n const link = find(textContent)\n .find(item => item.isLink && item.value === textContent)\n\n if (!textContent || !link) {\n return false\n }\n\n this.editor.commands.setMark(this.type, {\n href: link.href,\n })\n\n return true\n },\n },\n }),\n )\n }\n\n return plugins\n },\n})\n"],"names":["Mark","mergeAttributes","markPasteRule","find","Plugin","PluginKey"],"mappings":";;;;;;;;MA0Ca,IAAI,GAAGA,SAAI,CAAC,MAAM,CAAc;IAC3C,IAAI,EAAE,MAAM;IAEZ,QAAQ,EAAE,IAAI;IAEd,SAAS,EAAE,KAAK;IAEhB,UAAU;QACR,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,cAAc,EAAE;gBACd,MAAM,EAAE,QAAQ;gBAChB,GAAG,EAAE,8BAA8B;aACpC;SACF,CAAA;KACF;IAED,aAAa;QACX,OAAO;YACL,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI;aACd;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM;aAC5C;SACF,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL,EAAE,GAAG,EAAE,SAAS,EAAE;SACnB,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;IAED,WAAW;QACT,OAAO;YACL,OAAO,EAAE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CAAC,IAAI,CAAC,IAAI,EAAE;4BACtC,IAAI,EAAE,IAAI,CAAC,IAAI;yBAChB,CAAC,CAAA;wBAEF,OAAO,IAAI,CAAA;qBACZ;iBACF;aACF,CAAC,CACH,CAAA;SACF;QAED,OAAO,OAAO,CAAA;KACf;CACF;;;;;"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Mark, mergeAttributes, markPasteRule } from '@tiptap/core';
|
|
2
|
-
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { find } from 'linkifyjs';
|
|
4
|
-
|
|
5
|
-
const Link = Mark.create({
|
|
6
|
-
name: 'link',
|
|
7
|
-
priority: 1000,
|
|
8
|
-
inclusive: false,
|
|
9
|
-
addOptions() {
|
|
10
|
-
return {
|
|
11
|
-
openOnClick: true,
|
|
12
|
-
linkOnPaste: true,
|
|
13
|
-
HTMLAttributes: {
|
|
14
|
-
target: '_blank',
|
|
15
|
-
rel: 'noopener noreferrer nofollow',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
addAttributes() {
|
|
20
|
-
return {
|
|
21
|
-
href: {
|
|
22
|
-
default: null,
|
|
23
|
-
},
|
|
24
|
-
target: {
|
|
25
|
-
default: this.options.HTMLAttributes.target,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
parseHTML() {
|
|
30
|
-
return [
|
|
31
|
-
{ tag: 'a[href]' },
|
|
32
|
-
];
|
|
33
|
-
},
|
|
34
|
-
renderHTML({ HTMLAttributes }) {
|
|
35
|
-
return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
36
|
-
},
|
|
37
|
-
addCommands() {
|
|
38
|
-
return {
|
|
39
|
-
setLink: attributes => ({ commands }) => {
|
|
40
|
-
return commands.setMark('link', attributes);
|
|
41
|
-
},
|
|
42
|
-
toggleLink: attributes => ({ commands }) => {
|
|
43
|
-
return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true });
|
|
44
|
-
},
|
|
45
|
-
unsetLink: () => ({ commands }) => {
|
|
46
|
-
return commands.unsetMark('link', { extendEmptyMarkRange: true });
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
addPasteRules() {
|
|
51
|
-
return [
|
|
52
|
-
markPasteRule({
|
|
53
|
-
find: text => find(text)
|
|
54
|
-
.filter(link => link.isLink)
|
|
55
|
-
.map(link => ({
|
|
56
|
-
text: link.value,
|
|
57
|
-
index: link.start,
|
|
58
|
-
data: link,
|
|
59
|
-
})),
|
|
60
|
-
type: this.type,
|
|
61
|
-
getAttributes: match => {
|
|
62
|
-
var _a;
|
|
63
|
-
return ({
|
|
64
|
-
href: (_a = match.data) === null || _a === void 0 ? void 0 : _a.href,
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
];
|
|
69
|
-
},
|
|
70
|
-
addProseMirrorPlugins() {
|
|
71
|
-
const plugins = [];
|
|
72
|
-
if (this.options.openOnClick) {
|
|
73
|
-
plugins.push(new Plugin({
|
|
74
|
-
key: new PluginKey('handleClickLink'),
|
|
75
|
-
props: {
|
|
76
|
-
handleClick: (view, pos, event) => {
|
|
77
|
-
var _a;
|
|
78
|
-
const attrs = this.editor.getAttributes('link');
|
|
79
|
-
const link = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('a');
|
|
80
|
-
if (link && attrs.href) {
|
|
81
|
-
window.open(attrs.href, attrs.target);
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
if (this.options.linkOnPaste) {
|
|
90
|
-
plugins.push(new Plugin({
|
|
91
|
-
key: new PluginKey('handlePasteLink'),
|
|
92
|
-
props: {
|
|
93
|
-
handlePaste: (view, event, slice) => {
|
|
94
|
-
const { state } = view;
|
|
95
|
-
const { selection } = state;
|
|
96
|
-
const { empty } = selection;
|
|
97
|
-
if (empty) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
let textContent = '';
|
|
101
|
-
slice.content.forEach(node => {
|
|
102
|
-
textContent += node.textContent;
|
|
103
|
-
});
|
|
104
|
-
const link = find(textContent)
|
|
105
|
-
.find(item => item.isLink && item.value === textContent);
|
|
106
|
-
if (!textContent || !link) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
this.editor.commands.setMark(this.type, {
|
|
110
|
-
href: link.href,
|
|
111
|
-
});
|
|
112
|
-
return true;
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
return plugins;
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
export { Link, Link as default };
|
|
122
|
-
//# sourceMappingURL=tiptap-extension-link.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-link.esm.js","sources":["../src/link.ts"],"sourcesContent":["import {\n Mark,\n markPasteRule,\n mergeAttributes,\n} from '@tiptap/core'\nimport { Plugin, PluginKey } from 'prosemirror-state'\nimport { find } from 'linkifyjs'\n\nexport interface LinkOptions {\n /**\n * If enabled, links will be opened on click.\n */\n openOnClick: boolean,\n /**\n * Adds a link to the current selection if the pasted content only contains an url.\n */\n linkOnPaste: boolean,\n /**\n * A list of HTML attributes to be rendered.\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n link: {\n /**\n * Set a link mark\n */\n setLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Toggle a link mark\n */\n toggleLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Unset a link mark\n */\n unsetLink: () => ReturnType,\n }\n }\n}\n\nexport const Link = Mark.create<LinkOptions>({\n name: 'link',\n\n priority: 1000,\n\n inclusive: false,\n\n addOptions() {\n return {\n openOnClick: true,\n linkOnPaste: true,\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer nofollow',\n },\n }\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n }\n },\n\n parseHTML() {\n return [\n { tag: 'a[href]' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setLink: attributes => ({ commands }) => {\n return commands.setMark('link', attributes)\n },\n toggleLink: attributes => ({ commands }) => {\n return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true })\n },\n unsetLink: () => ({ commands }) => {\n return commands.unsetMark('link', { extendEmptyMarkRange: true })\n },\n }\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: text => find(text)\n .filter(link => link.isLink)\n .map(link => ({\n text: link.value,\n index: link.start,\n data: link,\n })),\n type: this.type,\n getAttributes: match => ({\n href: match.data?.href,\n }),\n }),\n ]\n },\n\n addProseMirrorPlugins() {\n const plugins = []\n\n if (this.options.openOnClick) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handleClickLink'),\n props: {\n handleClick: (view, pos, event) => {\n const attrs = this.editor.getAttributes('link')\n const link = (event.target as HTMLElement)?.closest('a')\n\n if (link && attrs.href) {\n window.open(attrs.href, attrs.target)\n\n return true\n }\n\n return false\n },\n },\n }),\n )\n }\n\n if (this.options.linkOnPaste) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handlePasteLink'),\n props: {\n handlePaste: (view, event, slice) => {\n const { state } = view\n const { selection } = state\n const { empty } = selection\n\n if (empty) {\n return false\n }\n\n let textContent = ''\n\n slice.content.forEach(node => {\n textContent += node.textContent\n })\n\n const link = find(textContent)\n .find(item => item.isLink && item.value === textContent)\n\n if (!textContent || !link) {\n return false\n }\n\n this.editor.commands.setMark(this.type, {\n href: link.href,\n })\n\n return true\n },\n },\n }),\n )\n }\n\n return plugins\n },\n})\n"],"names":[],"mappings":";;;;MA0Ca,IAAI,GAAG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BACL,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK;wBAC9B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;wBACtB,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;wBAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;wBAE3B,IAAI,KAAK,EAAE;4BACT,OAAO,KAAK,CAAA;yBACb;wBAED,IAAI,WAAW,GAAG,EAAE,CAAA;wBAEpB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI;4BACxB,WAAW,IAAI,IAAI,CAAC,WAAW,CAAA;yBAChC,CAAC,CAAA;wBAEF,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;6BAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAA;wBAE1D,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,EAAE;4BACzB,OAAO,KAAK,CAAA;yBACb;wBAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;4BACtC,IAAI,EAAE,IAAI,CAAC,IAAI;yBAChB,CAAC,CAAA;wBAEF,OAAO,IAAI,CAAA;qBACZ;iBACF;aACF,CAAC,CACH,CAAA;SACF;QAED,OAAO,OAAO,CAAA;KACf;CACF;;;;"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('prosemirror-state'), require('linkifyjs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', 'prosemirror-state', 'linkifyjs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-link"] = {}, global.core, global.prosemirrorState, global.linkifyjs));
|
|
5
|
-
})(this, (function (exports, core, prosemirrorState, linkifyjs) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const Link = core.Mark.create({
|
|
8
|
-
name: 'link',
|
|
9
|
-
priority: 1000,
|
|
10
|
-
inclusive: false,
|
|
11
|
-
addOptions() {
|
|
12
|
-
return {
|
|
13
|
-
openOnClick: true,
|
|
14
|
-
linkOnPaste: true,
|
|
15
|
-
HTMLAttributes: {
|
|
16
|
-
target: '_blank',
|
|
17
|
-
rel: 'noopener noreferrer nofollow',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
addAttributes() {
|
|
22
|
-
return {
|
|
23
|
-
href: {
|
|
24
|
-
default: null,
|
|
25
|
-
},
|
|
26
|
-
target: {
|
|
27
|
-
default: this.options.HTMLAttributes.target,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
parseHTML() {
|
|
32
|
-
return [
|
|
33
|
-
{ tag: 'a[href]' },
|
|
34
|
-
];
|
|
35
|
-
},
|
|
36
|
-
renderHTML({ HTMLAttributes }) {
|
|
37
|
-
return ['a', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
38
|
-
},
|
|
39
|
-
addCommands() {
|
|
40
|
-
return {
|
|
41
|
-
setLink: attributes => ({ commands }) => {
|
|
42
|
-
return commands.setMark('link', attributes);
|
|
43
|
-
},
|
|
44
|
-
toggleLink: attributes => ({ commands }) => {
|
|
45
|
-
return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true });
|
|
46
|
-
},
|
|
47
|
-
unsetLink: () => ({ commands }) => {
|
|
48
|
-
return commands.unsetMark('link', { extendEmptyMarkRange: true });
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
addPasteRules() {
|
|
53
|
-
return [
|
|
54
|
-
core.markPasteRule({
|
|
55
|
-
find: text => linkifyjs.find(text)
|
|
56
|
-
.filter(link => link.isLink)
|
|
57
|
-
.map(link => ({
|
|
58
|
-
text: link.value,
|
|
59
|
-
index: link.start,
|
|
60
|
-
data: link,
|
|
61
|
-
})),
|
|
62
|
-
type: this.type,
|
|
63
|
-
getAttributes: match => {
|
|
64
|
-
var _a;
|
|
65
|
-
return ({
|
|
66
|
-
href: (_a = match.data) === null || _a === void 0 ? void 0 : _a.href,
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
];
|
|
71
|
-
},
|
|
72
|
-
addProseMirrorPlugins() {
|
|
73
|
-
const plugins = [];
|
|
74
|
-
if (this.options.openOnClick) {
|
|
75
|
-
plugins.push(new prosemirrorState.Plugin({
|
|
76
|
-
key: new prosemirrorState.PluginKey('handleClickLink'),
|
|
77
|
-
props: {
|
|
78
|
-
handleClick: (view, pos, event) => {
|
|
79
|
-
var _a;
|
|
80
|
-
const attrs = this.editor.getAttributes('link');
|
|
81
|
-
const link = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('a');
|
|
82
|
-
if (link && attrs.href) {
|
|
83
|
-
window.open(attrs.href, attrs.target);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
if (this.options.linkOnPaste) {
|
|
92
|
-
plugins.push(new prosemirrorState.Plugin({
|
|
93
|
-
key: new prosemirrorState.PluginKey('handlePasteLink'),
|
|
94
|
-
props: {
|
|
95
|
-
handlePaste: (view, event, slice) => {
|
|
96
|
-
const { state } = view;
|
|
97
|
-
const { selection } = state;
|
|
98
|
-
const { empty } = selection;
|
|
99
|
-
if (empty) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
let textContent = '';
|
|
103
|
-
slice.content.forEach(node => {
|
|
104
|
-
textContent += node.textContent;
|
|
105
|
-
});
|
|
106
|
-
const link = linkifyjs.find(textContent)
|
|
107
|
-
.find(item => item.isLink && item.value === textContent);
|
|
108
|
-
if (!textContent || !link) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
this.editor.commands.setMark(this.type, {
|
|
112
|
-
href: link.href,
|
|
113
|
-
});
|
|
114
|
-
return true;
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
return plugins;
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
exports.Link = Link;
|
|
124
|
-
exports["default"] = Link;
|
|
125
|
-
|
|
126
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
127
|
-
|
|
128
|
-
}));
|
|
129
|
-
//# sourceMappingURL=tiptap-extension-link.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-link.umd.js","sources":["../src/link.ts"],"sourcesContent":["import {\n Mark,\n markPasteRule,\n mergeAttributes,\n} from '@tiptap/core'\nimport { Plugin, PluginKey } from 'prosemirror-state'\nimport { find } from 'linkifyjs'\n\nexport interface LinkOptions {\n /**\n * If enabled, links will be opened on click.\n */\n openOnClick: boolean,\n /**\n * Adds a link to the current selection if the pasted content only contains an url.\n */\n linkOnPaste: boolean,\n /**\n * A list of HTML attributes to be rendered.\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n link: {\n /**\n * Set a link mark\n */\n setLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Toggle a link mark\n */\n toggleLink: (attributes: { href: string, target?: string }) => ReturnType,\n /**\n * Unset a link mark\n */\n unsetLink: () => ReturnType,\n }\n }\n}\n\nexport const Link = Mark.create<LinkOptions>({\n name: 'link',\n\n priority: 1000,\n\n inclusive: false,\n\n addOptions() {\n return {\n openOnClick: true,\n linkOnPaste: true,\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer nofollow',\n },\n }\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n }\n },\n\n parseHTML() {\n return [\n { tag: 'a[href]' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setLink: attributes => ({ commands }) => {\n return commands.setMark('link', attributes)\n },\n toggleLink: attributes => ({ commands }) => {\n return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true })\n },\n unsetLink: () => ({ commands }) => {\n return commands.unsetMark('link', { extendEmptyMarkRange: true })\n },\n }\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: text => find(text)\n .filter(link => link.isLink)\n .map(link => ({\n text: link.value,\n index: link.start,\n data: link,\n })),\n type: this.type,\n getAttributes: match => ({\n href: match.data?.href,\n }),\n }),\n ]\n },\n\n addProseMirrorPlugins() {\n const plugins = []\n\n if (this.options.openOnClick) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handleClickLink'),\n props: {\n handleClick: (view, pos, event) => {\n const attrs = this.editor.getAttributes('link')\n const link = (event.target as HTMLElement)?.closest('a')\n\n if (link && attrs.href) {\n window.open(attrs.href, attrs.target)\n\n return true\n }\n\n return false\n },\n },\n }),\n )\n }\n\n if (this.options.linkOnPaste) {\n plugins.push(\n new Plugin({\n key: new PluginKey('handlePasteLink'),\n props: {\n handlePaste: (view, event, slice) => {\n const { state } = view\n const { selection } = state\n const { empty } = selection\n\n if (empty) {\n return false\n }\n\n let textContent = ''\n\n slice.content.forEach(node => {\n textContent += node.textContent\n })\n\n const link = find(textContent)\n .find(item => item.isLink && item.value === textContent)\n\n if (!textContent || !link) {\n return false\n }\n\n this.editor.commands.setMark(this.type, {\n href: link.href,\n })\n\n return true\n },\n },\n }),\n )\n }\n\n return plugins\n },\n})\n"],"names":["Mark","mergeAttributes","markPasteRule","find","Plugin","PluginKey"],"mappings":";;;;;;QA0Ca,IAAI,GAAGA,SAAI,CAAC,MAAM,CAAc;MAC3C,IAAI,EAAE,MAAM;MAEZ,QAAQ,EAAE,IAAI;MAEd,SAAS,EAAE,KAAK;MAEhB,U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