@tiptap/extension-link 2.0.0-beta.4 → 2.0.0-beta.41
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/LICENSE.md +1 -1
- package/README.md +2 -2
- package/dist/packages/extension-link/src/helpers/autolink.d.ts +8 -0
- package/dist/packages/extension-link/src/helpers/clickHandler.d.ts +7 -0
- package/dist/packages/extension-link/src/helpers/pasteHandler.d.ts +9 -0
- package/dist/packages/extension-link/src/link.d.ts +31 -11
- package/dist/tiptap-extension-link.cjs.js +211 -41
- package/dist/tiptap-extension-link.cjs.js.map +1 -1
- package/dist/tiptap-extension-link.esm.js +212 -41
- package/dist/tiptap-extension-link.esm.js.map +1 -1
- package/dist/tiptap-extension-link.umd.js +215 -46
- package/dist/tiptap-extension-link.umd.js.map +1 -1
- package/package.json +9 -3
- package/src/helpers/autolink.ts +110 -0
- package/src/helpers/clickHandler.ts +27 -0
- package/src/helpers/pasteHandler.ts +44 -0
- package/src/link.ts +122 -53
- package/CHANGELOG.md +0 -145
- package/dist/tiptap-extension-link.bundle.umd.min.js +0 -2
- package/dist/tiptap-extension-link.bundle.umd.min.js.map +0 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MarkType } from 'prosemirror-model';
|
|
2
|
+
import { Plugin } from 'prosemirror-state';
|
|
3
|
+
declare type AutolinkOptions = {
|
|
4
|
+
type: MarkType;
|
|
5
|
+
validate?: (url: string) => boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function autolink(options: AutolinkOptions): Plugin;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { MarkType } from 'prosemirror-model';
|
|
3
|
+
import { Plugin } from 'prosemirror-state';
|
|
4
|
+
declare type PasteHandlerOptions = {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
type: MarkType;
|
|
7
|
+
};
|
|
8
|
+
export declare function pasteHandler(options: PasteHandlerOptions): Plugin;
|
|
9
|
+
export {};
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
2
|
export interface LinkOptions {
|
|
3
|
+
/**
|
|
4
|
+
* If enabled, it adds links as you type.
|
|
5
|
+
*/
|
|
6
|
+
autolink: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* An array of custom protocols to be registered with linkifyjs.
|
|
9
|
+
*/
|
|
10
|
+
protocols: Array<string>;
|
|
11
|
+
/**
|
|
12
|
+
* If enabled, links will be opened on click.
|
|
13
|
+
*/
|
|
3
14
|
openOnClick: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Adds a link to the current selection if the pasted content only contains an url.
|
|
17
|
+
*/
|
|
18
|
+
linkOnPaste: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A list of HTML attributes to be rendered.
|
|
21
|
+
*/
|
|
22
|
+
HTMLAttributes: Record<string, any>;
|
|
23
|
+
/**
|
|
24
|
+
* A validation function that modifies link verification for the auto linker.
|
|
25
|
+
* @param url - The url to be validated.
|
|
26
|
+
* @returns - True if the url is valid, false otherwise.
|
|
27
|
+
*/
|
|
28
|
+
validate?: (url: string) => boolean;
|
|
7
29
|
}
|
|
8
30
|
declare module '@tiptap/core' {
|
|
9
|
-
interface Commands {
|
|
31
|
+
interface Commands<ReturnType> {
|
|
10
32
|
link: {
|
|
11
33
|
/**
|
|
12
34
|
* Set a link mark
|
|
@@ -14,21 +36,19 @@ declare module '@tiptap/core' {
|
|
|
14
36
|
setLink: (attributes: {
|
|
15
37
|
href: string;
|
|
16
38
|
target?: string;
|
|
17
|
-
}) =>
|
|
39
|
+
}) => ReturnType;
|
|
18
40
|
/**
|
|
19
41
|
* Toggle a link mark
|
|
20
42
|
*/
|
|
21
43
|
toggleLink: (attributes: {
|
|
22
44
|
href: string;
|
|
23
45
|
target?: string;
|
|
24
|
-
}) =>
|
|
46
|
+
}) => ReturnType;
|
|
25
47
|
/**
|
|
26
48
|
* Unset a link mark
|
|
27
49
|
*/
|
|
28
|
-
unsetLink: () =>
|
|
50
|
+
unsetLink: () => ReturnType;
|
|
29
51
|
};
|
|
30
52
|
}
|
|
31
53
|
}
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const pasteRegexWithBrackets: RegExp;
|
|
34
|
-
export declare const Link: Mark<LinkOptions>;
|
|
54
|
+
export declare const Link: Mark<LinkOptions, any>;
|
|
@@ -3,20 +3,157 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@tiptap/core');
|
|
6
|
+
var linkifyjs = require('linkifyjs');
|
|
6
7
|
var prosemirrorState = require('prosemirror-state');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
function autolink(options) {
|
|
10
|
+
return new prosemirrorState.Plugin({
|
|
11
|
+
key: new prosemirrorState.PluginKey('autolink'),
|
|
12
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
13
|
+
const docChanges = transactions.some(transaction => transaction.docChanged)
|
|
14
|
+
&& !oldState.doc.eq(newState.doc);
|
|
15
|
+
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink'));
|
|
16
|
+
if (!docChanges || preventAutolink) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { tr } = newState;
|
|
20
|
+
const transform = core.combineTransactionSteps(oldState.doc, transactions);
|
|
21
|
+
const { mapping } = transform;
|
|
22
|
+
const changes = core.getChangedRanges(transform);
|
|
23
|
+
changes.forEach(({ oldRange, newRange }) => {
|
|
24
|
+
// at first we check if we have to remove links
|
|
25
|
+
core.getMarksBetween(oldRange.from, oldRange.to, oldState.doc)
|
|
26
|
+
.filter(item => item.mark.type === options.type)
|
|
27
|
+
.forEach(oldMark => {
|
|
28
|
+
const newFrom = mapping.map(oldMark.from);
|
|
29
|
+
const newTo = mapping.map(oldMark.to);
|
|
30
|
+
const newMarks = core.getMarksBetween(newFrom, newTo, newState.doc)
|
|
31
|
+
.filter(item => item.mark.type === options.type);
|
|
32
|
+
if (!newMarks.length) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const newMark = newMarks[0];
|
|
36
|
+
const oldLinkText = oldState.doc.textBetween(oldMark.from, oldMark.to, undefined, ' ');
|
|
37
|
+
const newLinkText = newState.doc.textBetween(newMark.from, newMark.to, undefined, ' ');
|
|
38
|
+
const wasLink = linkifyjs.test(oldLinkText);
|
|
39
|
+
const isLink = linkifyjs.test(newLinkText);
|
|
40
|
+
// remove only the link, if it was a link before too
|
|
41
|
+
// because we don’t want to remove links that were set manually
|
|
42
|
+
if (wasLink && !isLink) {
|
|
43
|
+
tr.removeMark(newMark.from, newMark.to, options.type);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// now let’s see if we can add new links
|
|
47
|
+
core.findChildrenInRange(newState.doc, newRange, node => node.isTextblock)
|
|
48
|
+
.forEach(textBlock => {
|
|
49
|
+
// we need to define a placeholder for leaf nodes
|
|
50
|
+
// so that the link position can be calculated correctly
|
|
51
|
+
const text = newState.doc.textBetween(textBlock.pos, textBlock.pos + textBlock.node.nodeSize, undefined, ' ');
|
|
52
|
+
linkifyjs.find(text)
|
|
53
|
+
.filter(link => link.isLink)
|
|
54
|
+
.filter(link => {
|
|
55
|
+
if (options.validate) {
|
|
56
|
+
return options.validate(link.value);
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
})
|
|
60
|
+
// calculate link position
|
|
61
|
+
.map(link => ({
|
|
62
|
+
...link,
|
|
63
|
+
from: textBlock.pos + link.start + 1,
|
|
64
|
+
to: textBlock.pos + link.end + 1,
|
|
65
|
+
}))
|
|
66
|
+
// check if link is within the changed range
|
|
67
|
+
.filter(link => {
|
|
68
|
+
const fromIsInRange = newRange.from >= link.from && newRange.from <= link.to;
|
|
69
|
+
const toIsInRange = newRange.to >= link.from && newRange.to <= link.to;
|
|
70
|
+
return fromIsInRange || toIsInRange;
|
|
71
|
+
})
|
|
72
|
+
// add link mark
|
|
73
|
+
.forEach(link => {
|
|
74
|
+
tr.addMark(link.from, link.to, options.type.create({
|
|
75
|
+
href: link.href,
|
|
76
|
+
}));
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
if (!tr.steps.length) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
return tr;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function clickHandler(options) {
|
|
89
|
+
return new prosemirrorState.Plugin({
|
|
90
|
+
key: new prosemirrorState.PluginKey('handleClickLink'),
|
|
91
|
+
props: {
|
|
92
|
+
handleClick: (view, pos, event) => {
|
|
93
|
+
var _a;
|
|
94
|
+
const attrs = core.getAttributes(view.state, options.type.name);
|
|
95
|
+
const link = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('a');
|
|
96
|
+
if (link && attrs.href) {
|
|
97
|
+
window.open(attrs.href, attrs.target);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function pasteHandler(options) {
|
|
107
|
+
return new prosemirrorState.Plugin({
|
|
108
|
+
key: new prosemirrorState.PluginKey('handlePasteLink'),
|
|
109
|
+
props: {
|
|
110
|
+
handlePaste: (view, event, slice) => {
|
|
111
|
+
const { state } = view;
|
|
112
|
+
const { selection } = state;
|
|
113
|
+
const { empty } = selection;
|
|
114
|
+
if (empty) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
let textContent = '';
|
|
118
|
+
slice.content.forEach(node => {
|
|
119
|
+
textContent += node.textContent;
|
|
120
|
+
});
|
|
121
|
+
const link = linkifyjs.find(textContent).find(item => item.isLink && item.value === textContent);
|
|
122
|
+
if (!textContent || !link) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
options.editor.commands.setMark(options.type, {
|
|
126
|
+
href: link.href,
|
|
127
|
+
});
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
10
134
|
const Link = core.Mark.create({
|
|
11
135
|
name: 'link',
|
|
12
136
|
priority: 1000,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
137
|
+
keepOnSplit: false,
|
|
138
|
+
onCreate() {
|
|
139
|
+
this.options.protocols.forEach(linkifyjs.registerCustomProtocol);
|
|
140
|
+
},
|
|
141
|
+
inclusive() {
|
|
142
|
+
return this.options.autolink;
|
|
143
|
+
},
|
|
144
|
+
addOptions() {
|
|
145
|
+
return {
|
|
146
|
+
openOnClick: true,
|
|
147
|
+
linkOnPaste: true,
|
|
148
|
+
autolink: true,
|
|
149
|
+
protocols: [],
|
|
150
|
+
HTMLAttributes: {
|
|
151
|
+
target: '_blank',
|
|
152
|
+
rel: 'noopener noreferrer nofollow',
|
|
153
|
+
class: null,
|
|
154
|
+
},
|
|
155
|
+
validate: undefined,
|
|
156
|
+
};
|
|
20
157
|
},
|
|
21
158
|
addAttributes() {
|
|
22
159
|
return {
|
|
@@ -26,61 +163,94 @@ const Link = core.Mark.create({
|
|
|
26
163
|
target: {
|
|
27
164
|
default: this.options.HTMLAttributes.target,
|
|
28
165
|
},
|
|
166
|
+
class: {
|
|
167
|
+
default: this.options.HTMLAttributes.class,
|
|
168
|
+
},
|
|
29
169
|
};
|
|
30
170
|
},
|
|
31
171
|
parseHTML() {
|
|
32
172
|
return [
|
|
33
|
-
{ tag: 'a[href]' },
|
|
173
|
+
{ tag: 'a[href]:not([href *= "javascript:" i])' },
|
|
34
174
|
];
|
|
35
175
|
},
|
|
36
176
|
renderHTML({ HTMLAttributes }) {
|
|
37
|
-
return [
|
|
177
|
+
return [
|
|
178
|
+
'a',
|
|
179
|
+
core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
180
|
+
0,
|
|
181
|
+
];
|
|
38
182
|
},
|
|
39
183
|
addCommands() {
|
|
40
184
|
return {
|
|
41
|
-
setLink: attributes => ({
|
|
42
|
-
return
|
|
185
|
+
setLink: attributes => ({ chain }) => {
|
|
186
|
+
return chain()
|
|
187
|
+
.setMark(this.name, attributes)
|
|
188
|
+
.setMeta('preventAutolink', true)
|
|
189
|
+
.run();
|
|
43
190
|
},
|
|
44
|
-
toggleLink: attributes => ({
|
|
45
|
-
return
|
|
191
|
+
toggleLink: attributes => ({ chain }) => {
|
|
192
|
+
return chain()
|
|
193
|
+
.toggleMark(this.name, attributes, { extendEmptyMarkRange: true })
|
|
194
|
+
.setMeta('preventAutolink', true)
|
|
195
|
+
.run();
|
|
46
196
|
},
|
|
47
|
-
unsetLink: () => ({
|
|
48
|
-
return
|
|
197
|
+
unsetLink: () => ({ chain }) => {
|
|
198
|
+
return chain()
|
|
199
|
+
.unsetMark(this.name, { extendEmptyMarkRange: true })
|
|
200
|
+
.setMeta('preventAutolink', true)
|
|
201
|
+
.run();
|
|
49
202
|
},
|
|
50
203
|
};
|
|
51
204
|
},
|
|
52
205
|
addPasteRules() {
|
|
53
206
|
return [
|
|
54
|
-
core.markPasteRule(
|
|
55
|
-
|
|
207
|
+
core.markPasteRule({
|
|
208
|
+
find: text => linkifyjs.find(text)
|
|
209
|
+
.filter(link => {
|
|
210
|
+
if (this.options.validate) {
|
|
211
|
+
return this.options.validate(link.value);
|
|
212
|
+
}
|
|
213
|
+
return true;
|
|
214
|
+
})
|
|
215
|
+
.filter(link => link.isLink)
|
|
216
|
+
.map(link => ({
|
|
217
|
+
text: link.value,
|
|
218
|
+
index: link.start,
|
|
219
|
+
data: link,
|
|
220
|
+
})),
|
|
221
|
+
type: this.type,
|
|
222
|
+
getAttributes: match => {
|
|
223
|
+
var _a;
|
|
224
|
+
return ({
|
|
225
|
+
href: (_a = match.data) === null || _a === void 0 ? void 0 : _a.href,
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
}),
|
|
56
229
|
];
|
|
57
230
|
},
|
|
58
231
|
addProseMirrorPlugins() {
|
|
59
|
-
|
|
60
|
-
|
|
232
|
+
const plugins = [];
|
|
233
|
+
if (this.options.autolink) {
|
|
234
|
+
plugins.push(autolink({
|
|
235
|
+
type: this.type,
|
|
236
|
+
validate: this.options.validate,
|
|
237
|
+
}));
|
|
61
238
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return false;
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
}),
|
|
78
|
-
];
|
|
239
|
+
if (this.options.openOnClick) {
|
|
240
|
+
plugins.push(clickHandler({
|
|
241
|
+
type: this.type,
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
if (this.options.linkOnPaste) {
|
|
245
|
+
plugins.push(pasteHandler({
|
|
246
|
+
editor: this.editor,
|
|
247
|
+
type: this.type,
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
250
|
+
return plugins;
|
|
79
251
|
},
|
|
80
252
|
});
|
|
81
253
|
|
|
82
254
|
exports.Link = Link;
|
|
83
|
-
exports
|
|
84
|
-
exports.pasteRegex = pasteRegex;
|
|
85
|
-
exports.pasteRegexWithBrackets = pasteRegexWithBrackets;
|
|
255
|
+
exports["default"] = Link;
|
|
86
256
|
//# sourceMappingURL=tiptap-extension-link.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-link.cjs.js","sources":["../src/link.ts"],"sourcesContent":["import {\n Command,\n Mark,\n markPasteRule,\n mergeAttributes,\n} from '@tiptap/core'\nimport { Plugin, PluginKey } from 'prosemirror-state'\n\nexport interface LinkOptions {\n openOnClick: boolean,\n HTMLAttributes: {\n [key: string]: any\n },\n}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n link: {\n /**\n * Set a link mark\n */\n setLink: (attributes: { href: string, target?: string }) => Command,\n /**\n * Toggle a link mark\n */\n toggleLink: (attributes: { href: string, target?: string }) => Command,\n /**\n * Unset a link mark\n */\n unsetLink: () => Command,\n }\n }\n}\n\nexport const pasteRegex = /https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi\nexport const pasteRegexWithBrackets = /(?:\\()https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b(?:[-a-zA-Z0-9@:%._+~#=?!&/()]*)(?:\\))/gi\n\nexport const Link = Mark.create<LinkOptions>({\n name: 'link',\n\n priority: 1000,\n\n inclusive: false,\n\n defaultOptions: {\n openOnClick: true,\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer nofollow',\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)\n },\n unsetLink: () => ({ commands }) => {\n return commands.unsetMark('link')\n },\n }\n },\n\n addPasteRules() {\n return [\n markPasteRule(pasteRegex, this.type, (url: string) => ({ href: url })),\n markPasteRule(pasteRegexWithBrackets, this.type, (url: string) => ({ href: url })),\n ]\n },\n\n addProseMirrorPlugins() {\n if (!this.options.openOnClick) {\n return []\n }\n\n return [\n new Plugin({\n key: new PluginKey('handleClick'),\n props: {\n handleClick: (view, pos, event) => {\n const attrs = this.editor.getMarkAttributes('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"],"names":["Mark","mergeAttributes","markPasteRule","Plugin","PluginKey"],"mappings":";;;;;;;MAkCa,UAAU,GAAG,kIAAiI;MAC9I,sBAAsB,GAAG,kHAAiH;MAE1I,IAAI,GAAGA,SAAI,CAAC,MAAM,CAAc;IAC3C,IAAI,EAAE,MAAM;IAEZ,QAAQ,EAAE,IAAI;IAEd,SAAS,EAAE,KAAK;IAEhB,cAAc,EAAE;QACd,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE;YACd,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,8BAA8B;SACpC;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;S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AAK,CAAC,MAAsB,0CAAE,OAAO,CAAC,GAAG,CAAC,CAAA;wBAExD,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE;4BACtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;4BAErC,OAAO,IAAI,CAAA;yBACZ;wBAED,OAAO,KAAK,CAAA;qBACb;iBACF;aACF,CAAC;SACH,CAAA;KACF;CACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-extension-link.cjs.js","sources":["../src/helpers/autolink.ts","../src/helpers/clickHandler.ts","../src/helpers/pasteHandler.ts","../src/link.ts"],"sourcesContent":["import {\n combineTransactionSteps,\n findChildrenInRange,\n getChangedRanges,\n getMarksBetween,\n} from '@tiptap/core'\nimport { find, test } from 'linkifyjs'\nimport { MarkType } from 'prosemirror-model'\nimport { Plugin, PluginKey } from 'prosemirror-state'\n\ntype AutolinkOptions = {\n type: MarkType,\n validate?: (url: string) => boolean,\n}\n\nexport function autolink(options: AutolinkOptions): Plugin {\n return new Plugin({\n key: new PluginKey('autolink'),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges = transactions.some(transaction => transaction.docChanged)\n && !oldState.doc.eq(newState.doc)\n const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink'))\n\n if (!docChanges || preventAutolink) {\n return\n }\n\n const { tr } = newState\n const transform = combineTransactionSteps(oldState.doc, transactions)\n const { mapping } = transform\n const changes = getChangedRanges(transform)\n\n changes.forEach(({ oldRange, newRange }) => {\n // at first we check if we have to remove links\n getMarksBetween(oldRange.from, oldRange.to, oldState.doc)\n .filter(item => item.mark.type === options.type)\n .forEach(oldMark => {\n const newFrom = mapping.map(oldMark.from)\n const newTo = mapping.map(oldMark.to)\n const newMarks = getMarksBetween(newFrom, newTo, newState.doc)\n .filter(item => item.mark.type === options.type)\n\n if (!newMarks.length) {\n return\n }\n\n const newMark = newMarks[0]\n const oldLinkText = oldState.doc.textBetween(oldMark.from, oldMark.to, undefined, ' ')\n const newLinkText = newState.doc.textBetween(newMark.from, newMark.to, undefined, ' ')\n const wasLink = test(oldLinkText)\n const isLink = test(newLinkText)\n\n // remove only the link, if it was a link before too\n // because we don’t want to remove links that were set manually\n if (wasLink && !isLink) {\n tr.removeMark(newMark.from, newMark.to, options.type)\n }\n })\n\n // now let’s see if we can add new links\n findChildrenInRange(newState.doc, newRange, node => node.isTextblock)\n .forEach(textBlock => {\n // we need to define a placeholder for leaf nodes\n // so that the link position can be calculated correctly\n const text = newState.doc.textBetween(\n textBlock.pos,\n textBlock.pos + textBlock.node.nodeSize,\n undefined,\n ' ',\n )\n\n find(text)\n .filter(link => link.isLink)\n .filter(link => {\n if (options.validate) {\n return options.validate(link.value)\n }\n\n return true\n })\n // calculate link position\n .map(link => ({\n ...link,\n from: textBlock.pos + link.start + 1,\n to: textBlock.pos + link.end + 1,\n }))\n // check if link is within the changed range\n .filter(link => {\n const fromIsInRange = newRange.from >= link.from && newRange.from <= link.to\n const toIsInRange = newRange.to >= link.from && newRange.to <= link.to\n\n return fromIsInRange || toIsInRange\n })\n // add link mark\n .forEach(link => {\n tr.addMark(link.from, link.to, options.type.create({\n href: link.href,\n }))\n })\n })\n })\n\n if (!tr.steps.length) {\n return\n }\n\n return tr\n },\n })\n}\n","import { getAttributes } from '@tiptap/core'\nimport { MarkType } from 'prosemirror-model'\nimport { Plugin, PluginKey } from 'prosemirror-state'\n\ntype ClickHandlerOptions = {\n type: MarkType,\n}\n\nexport function clickHandler(options: ClickHandlerOptions): Plugin {\n return new Plugin({\n key: new PluginKey('handleClickLink'),\n props: {\n handleClick: (view, pos, event) => {\n const attrs = getAttributes(view.state, options.type.name)\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","import { Editor } from '@tiptap/core'\nimport { find } from 'linkifyjs'\nimport { MarkType } from 'prosemirror-model'\nimport { Plugin, PluginKey } from 'prosemirror-state'\n\ntype PasteHandlerOptions = {\n editor: Editor,\n type: MarkType,\n}\n\nexport function pasteHandler(options: PasteHandlerOptions): Plugin {\n return 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).find(item => item.isLink && item.value === textContent)\n\n if (!textContent || !link) {\n return false\n }\n\n options.editor.commands.setMark(options.type, {\n href: link.href,\n })\n\n return true\n },\n },\n })\n}\n","import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core'\nimport { find, registerCustomProtocol } from 'linkifyjs'\n\nimport { autolink } from './helpers/autolink'\nimport { clickHandler } from './helpers/clickHandler'\nimport { pasteHandler } from './helpers/pasteHandler'\n\nexport interface LinkOptions {\n /**\n * If enabled, it adds links as you type.\n */\n autolink: boolean,\n /**\n * An array of custom protocols to be registered with linkifyjs.\n */\n protocols: Array<string>,\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 * A validation function that modifies link verification for the auto linker.\n * @param url - The url to be validated.\n * @returns - True if the url is valid, false otherwise.\n */\n validate?: (url: string) => boolean,\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 keepOnSplit: false,\n\n onCreate() {\n this.options.protocols.forEach(registerCustomProtocol)\n },\n\n inclusive() {\n return this.options.autolink\n },\n\n addOptions() {\n return {\n openOnClick: true,\n linkOnPaste: true,\n autolink: true,\n protocols: [],\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer nofollow',\n class: null,\n },\n validate: undefined,\n }\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n class: {\n default: this.options.HTMLAttributes.class,\n },\n }\n },\n\n parseHTML() {\n return [\n { tag: 'a[href]:not([href *= \"javascript:\" i])' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ]\n },\n\n addCommands() {\n return {\n setLink: attributes => ({ chain }) => {\n return chain()\n .setMark(this.name, attributes)\n .setMeta('preventAutolink', true)\n .run()\n },\n\n toggleLink: attributes => ({ chain }) => {\n return chain()\n .toggleMark(this.name, attributes, { extendEmptyMarkRange: true })\n .setMeta('preventAutolink', true)\n .run()\n },\n\n unsetLink: () => ({ chain }) => {\n return chain()\n .unsetMark(this.name, { extendEmptyMarkRange: true })\n .setMeta('preventAutolink', true)\n .run()\n },\n }\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: text => find(text)\n .filter(link => {\n if (this.options.validate) {\n return this.options.validate(link.value)\n }\n\n return true\n })\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.autolink) {\n plugins.push(autolink({\n type: this.type,\n validate: this.options.validate,\n }))\n }\n\n if (this.options.openOnClick) {\n plugins.push(clickHandler({\n type: this.type,\n }))\n }\n\n if (this.options.linkOnPaste) {\n plugins.push(pasteHandler({\n editor: this.editor,\n type: this.type,\n }))\n }\n\n return plugins\n },\n})\n"],"names":["Plugin","PluginKey","combineTransactionSteps","getChangedRanges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