@burdenoff/microfe-support 2026.1031.2 → 2026.1114.1
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/dist/_virtual/_rolldown/runtime.js +6 -0
- package/dist/dev/main.d.ts +0 -0
- package/dist/generated/global-operations.d.ts +60 -60
- package/dist/node_modules/@tiptap/core/dist/index.js +949 -674
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +14 -3
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +1 -3
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +4 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +76 -51
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +143 -127
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +3 -2
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +21 -11
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +8 -9
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +70 -49
- package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +108 -76
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +127 -113
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +21 -14
- package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +98 -105
- package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +37 -34
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +153 -101
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +742 -693
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +96 -17
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +55 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +53 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +53 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +45 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +11 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +11 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/dist/support/SupportAdminRoot.d.ts +2 -2
- package/dist/support/SupportAdminRoutes.d.ts +1 -1
- package/dist/support/SupportUserRoot.d.ts +2 -2
- package/dist/support/SupportUserRoutes.d.ts +1 -1
- package/dist/support/components/NotificationToast.d.ts +2 -2
- package/dist/support/components/PageLayout.d.ts +4 -4
- package/dist/support/components/RouteHelpers.d.ts +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.d.ts +1 -1
- package/dist/support/components/analytics/MetricCard.d.ts +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.d.ts +1 -1
- package/dist/support/components/analytics/SLAReport.d.ts +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.d.ts +1 -1
- package/dist/support/components/analytics/TopAgents.d.ts +1 -1
- package/dist/support/components/analytics/TrendChart.d.ts +1 -1
- package/dist/support/components/careers/BulkCandidateActionGuidance.d.ts +1 -1
- package/dist/support/components/careers/BulkCandidateDialogs.d.ts +7 -7
- package/dist/support/components/careers/BulkOperationFeedback.d.ts +8 -8
- package/dist/support/components/careers/BulkSelectionSummary.d.ts +2 -2
- package/dist/support/components/careers/RichTextEditor.d.ts +1 -2
- package/dist/support/components/careers/RichTextEditor.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.d.ts +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.d.ts +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.d.ts +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.d.ts +1 -1
- package/dist/support/components/tickets/AttachmentList.d.ts +1 -1
- package/dist/support/components/tickets/MarkdownContent.d.ts +1 -1
- package/dist/support/components/tickets/MessageComposer.d.ts +1 -1
- package/dist/support/components/tickets/MessageThread.d.ts +2 -2
- package/dist/support/components/tickets/TicketDetailHeader.d.ts +2 -2
- package/dist/support/components/tickets/TicketHeader.d.ts +2 -2
- package/dist/support/components/tickets/TicketSidebar.d.ts +2 -2
- package/dist/support/components/tickets/TriagePanel.d.ts +2 -2
- package/dist/support/constants/pipeline.d.ts +0 -6
- package/dist/support/events/rybbit.d.ts +1 -1
- package/dist/support/hooks/useAnalyticsOperations.d.ts +10 -25
- package/dist/support/hooks/useAnalyticsOperations.js +40 -39
- package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
- package/dist/support/hooks/useAttachmentsFailedToast.d.ts +1 -1
- package/dist/support/hooks/useChatOperations.d.ts +2 -2
- package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +7 -13
- package/dist/support/hooks/useKnowledgeBaseOperations.js +84 -83
- package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
- package/dist/support/hooks/useRegisterFooter.d.ts +1 -1
- package/dist/support/hooks/useSettingsOperations.d.ts +7 -16
- package/dist/support/hooks/useSupportAttachments.d.ts +1 -1
- package/dist/support/hooks/useTicketListOperations.d.ts +3 -6
- package/dist/support/hooks/useTicketOperations.d.ts +5 -11
- package/dist/support/hooks/useTicketOperations.js +80 -79
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/pages/AnalyticsPage.d.ts +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.d.ts +1 -1
- package/dist/support/pages/ArticleDetailUserPage.d.ts +1 -1
- package/dist/support/pages/ContactInquiriesPage.d.ts +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -1
- package/dist/support/pages/CreateArticlePage.d.ts +1 -1
- package/dist/support/pages/CreateTicketPage.d.ts +1 -1
- package/dist/support/pages/EditArticlePage.d.ts +1 -1
- package/dist/support/pages/InterviewersPage.d.ts +1 -1
- package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -2
- package/dist/support/pages/JobApplicationsPage.d.ts +1 -1
- package/dist/support/pages/JobPostingDetailPage.d.ts +1 -1
- package/dist/support/pages/JobPostingsPage.d.ts +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.d.ts +1 -1
- package/dist/support/pages/SettingsPage.d.ts +1 -1
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.d.ts +1 -1
- package/dist/support/pages/TicketDetailUserPage.d.ts +1 -1
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.d.ts +1 -1
- package/dist/support/providers/SupportProvider.d.ts +2 -2
- package/dist/support/store/supportStore.d.ts +2 -2
- package/dist/support/utils/bulkCandidateTargetQuery.d.ts +1 -1
- package/dist/support/utils/cn.d.ts +1 -1
- package/dist/support/utils/index.d.ts +1 -1
- package/dist/support/utils/markdown.d.ts +0 -1
- package/dist/support/utils/refetch.d.ts +12 -0
- package/dist/support/utils/refetch.js +7 -0
- package/dist/support/utils/refetch.js.map +1 -0
- package/dist/support/utils/ticketFilters.d.ts +2 -2
- package/dist/support/utils/uiTokens.d.ts +1 -1
- package/dist/test/dom.d.ts +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/package.json +65 -54
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
import { InputRule as e, Mark as t, PasteRule as n, combineTransactionSteps as r, findChildrenInRange as i, getAttributes as a, getChangedRanges as o, getMarksBetween as s, markInputRule as c, markPasteRule as l, mergeAttributes as u } from "../../core/dist/index.js";
|
|
2
2
|
import { find as d, registerCustomProtocol as f, reset as p, tokenize as m } from "../../../linkifyjs/dist/linkify.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isHistoryTransaction as h } from "../../../prosemirror-history/dist/index.js";
|
|
4
|
+
import { Plugin as g, PluginKey as _ } from "../../../prosemirror-state/dist/index.js";
|
|
5
|
+
import { ReplaceStep as v } from "../../../prosemirror-transform/dist/index.js";
|
|
4
6
|
// node_modules/@tiptap/extension-link/dist/index.js
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
+
var y = "[\0- \xA0 -\u2029 ]", b = new RegExp(y), x = RegExp(`${y}$`), S = RegExp(`${y}+$`), C = new RegExp(y, "g");
|
|
8
|
+
function w(e, t, n) {
|
|
9
|
+
let r = e.doc.resolve(t.to);
|
|
10
|
+
if (!r.nodeBefore?.isText) return;
|
|
11
|
+
let i = e.doc.textBetween(t.from, t.to, "", "").match(S)?.[0];
|
|
12
|
+
if (!i) return;
|
|
13
|
+
let a = t.to - i.length, o = s(a, t.to, e.doc).filter((e) => e.mark.type === n);
|
|
14
|
+
if (!o.length) return;
|
|
15
|
+
let { nodeAfter: c } = r;
|
|
16
|
+
if (c && o.some((e) => e.mark.isInSet(c.marks))) return;
|
|
17
|
+
let l = e.storedMarks;
|
|
18
|
+
e.removeMark(a, t.to, n), e.setStoredMarks(l), e.selection.empty && e.selection.from === t.to && e.removeStoredMark(n);
|
|
19
|
+
}
|
|
20
|
+
function T(e) {
|
|
7
21
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
8
22
|
}
|
|
9
|
-
function
|
|
10
|
-
return new
|
|
11
|
-
key: new
|
|
23
|
+
function E(e) {
|
|
24
|
+
return new g({
|
|
25
|
+
key: new _("autolink"),
|
|
12
26
|
appendTransaction: (t, n, a) => {
|
|
13
27
|
let c = t.some((e) => e.docChanged) && !n.doc.eq(a.doc), l = t.some((e) => e.getMeta("preventAutolink"));
|
|
14
28
|
if (!c || l) return;
|
|
15
29
|
let { tr: u } = a, d = r(n.doc, [...t]);
|
|
30
|
+
if (!t.some(h)) {
|
|
31
|
+
let t = [];
|
|
32
|
+
d.steps.forEach((e, n) => {
|
|
33
|
+
if (!(e instanceof v) || !e.slice.size) return;
|
|
34
|
+
let r = d.mapping.slice(n + 1), i = r.map(e.from, 1), a = r.map(e.from + e.slice.size, -1);
|
|
35
|
+
i < a && t.push({
|
|
36
|
+
from: i,
|
|
37
|
+
to: a
|
|
38
|
+
});
|
|
39
|
+
}), t.sort((e, t) => t.to - e.to), t.forEach((t) => w(u, t, e.type));
|
|
40
|
+
}
|
|
16
41
|
if (o(d).forEach(({ newRange: t }) => {
|
|
17
42
|
let n = i(a.doc, t, (e) => e.isTextblock), r, o;
|
|
18
43
|
if (n.length > 1) r = n[0], o = a.doc.textBetween(r.pos, r.pos + r.node.nodeSize, void 0, " ");
|
|
19
44
|
else if (n.length) {
|
|
20
45
|
let e = a.doc.textBetween(t.from, t.to, " ", " ");
|
|
21
|
-
if (!
|
|
46
|
+
if (!x.test(e)) return;
|
|
22
47
|
r = n[0], o = a.doc.textBetween(r.pos, t.to, void 0, " ");
|
|
23
48
|
}
|
|
24
49
|
if (r && o) {
|
|
25
|
-
let t = o.split(
|
|
50
|
+
let t = o.split(b).filter(Boolean);
|
|
26
51
|
if (t.length <= 0) return !1;
|
|
27
52
|
let n = t[t.length - 1], i = r.pos + o.lastIndexOf(n);
|
|
28
53
|
if (!n) return !1;
|
|
29
54
|
let c = m(n).map((t) => t.toObject(e.defaultProtocol));
|
|
30
|
-
if (!
|
|
55
|
+
if (!T(c)) return !1;
|
|
31
56
|
c.filter((e) => e.isLink).map((e) => ({
|
|
32
57
|
...e,
|
|
33
58
|
from: i + e.start + 1,
|
|
@@ -40,9 +65,9 @@ function S(e) {
|
|
|
40
65
|
}
|
|
41
66
|
});
|
|
42
67
|
}
|
|
43
|
-
function
|
|
44
|
-
return new
|
|
45
|
-
key: new
|
|
68
|
+
function D(e) {
|
|
69
|
+
return new g({
|
|
70
|
+
key: new _("handleClickLink"),
|
|
46
71
|
props: { handleClick: (t, n, r) => {
|
|
47
72
|
if (r.button !== 0 || !t.editable) return !1;
|
|
48
73
|
let i = null;
|
|
@@ -63,16 +88,16 @@ function C(e) {
|
|
|
63
88
|
} }
|
|
64
89
|
});
|
|
65
90
|
}
|
|
66
|
-
var
|
|
67
|
-
function
|
|
91
|
+
var O = /\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/, k = /\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;
|
|
92
|
+
function A(e, t) {
|
|
68
93
|
let n = 0;
|
|
69
94
|
for (let r = t - 1; r >= 0 && e[r] === "\\"; --r) n += 1;
|
|
70
95
|
return n % 2 == 1;
|
|
71
96
|
}
|
|
72
|
-
function
|
|
97
|
+
function j(e, t) {
|
|
73
98
|
let n = 0, r = 0;
|
|
74
99
|
for (; r < t;) {
|
|
75
|
-
if (e[r] !== "`" || n === 0 &&
|
|
100
|
+
if (e[r] !== "`" || n === 0 && A(e, r)) {
|
|
76
101
|
r += 1;
|
|
77
102
|
continue;
|
|
78
103
|
}
|
|
@@ -82,11 +107,11 @@ function D(e, t) {
|
|
|
82
107
|
}
|
|
83
108
|
return n > 0;
|
|
84
109
|
}
|
|
85
|
-
function
|
|
110
|
+
function M(e, t, n) {
|
|
86
111
|
let [, r, i] = t;
|
|
87
|
-
return (t.index ? e[t.index - 1] : void 0) === "!" ||
|
|
112
|
+
return (t.index ? e[t.index - 1] : void 0) === "!" || A(e, t.index ?? 0) || j(e, t.index ?? 0) ? !1 : !!r.trim() && n(i);
|
|
88
113
|
}
|
|
89
|
-
function
|
|
114
|
+
function N(e) {
|
|
90
115
|
let [t, n, r, , i, a, o] = e, s = i ?? a ?? o;
|
|
91
116
|
return {
|
|
92
117
|
index: e.index ?? 0,
|
|
@@ -99,23 +124,23 @@ function k(e) {
|
|
|
99
124
|
}
|
|
100
125
|
};
|
|
101
126
|
}
|
|
102
|
-
function
|
|
127
|
+
function P(e, t) {
|
|
103
128
|
return e.index < t.index + t.text.length && t.index < e.index + e.text.length;
|
|
104
129
|
}
|
|
105
|
-
function
|
|
130
|
+
function F(e) {
|
|
106
131
|
return {
|
|
107
132
|
href: e.data?.href,
|
|
108
133
|
title: e.data?.title ?? null
|
|
109
134
|
};
|
|
110
135
|
}
|
|
111
|
-
function
|
|
136
|
+
function I(t) {
|
|
112
137
|
let n = c({
|
|
113
138
|
find: (e) => {
|
|
114
|
-
let n =
|
|
115
|
-
return !n || !
|
|
139
|
+
let n = O.exec(e);
|
|
140
|
+
return !n || !M(e, n, t.isAllowedHref) ? null : N(n);
|
|
116
141
|
},
|
|
117
142
|
type: t.type,
|
|
118
|
-
getAttributes:
|
|
143
|
+
getAttributes: F
|
|
119
144
|
});
|
|
120
145
|
return new e({
|
|
121
146
|
find: n.find,
|
|
@@ -125,16 +150,16 @@ function M(t) {
|
|
|
125
150
|
}
|
|
126
151
|
});
|
|
127
152
|
}
|
|
128
|
-
function
|
|
153
|
+
function L(e) {
|
|
129
154
|
let t = l({
|
|
130
155
|
find: (t) => {
|
|
131
156
|
let n = [];
|
|
132
|
-
for (let r of t.matchAll(
|
|
133
|
-
let r = (e.findPlainUrls?.call(e, t) ?? []).filter((e) => !n.some((t) =>
|
|
157
|
+
for (let r of t.matchAll(k)) M(t, r, e.isAllowedHref) && n.push(N(r));
|
|
158
|
+
let r = (e.findPlainUrls?.call(e, t) ?? []).filter((e) => !n.some((t) => P(t, e)));
|
|
134
159
|
return [...n, ...r];
|
|
135
160
|
},
|
|
136
161
|
type: e.type,
|
|
137
|
-
getAttributes:
|
|
162
|
+
getAttributes: F
|
|
138
163
|
});
|
|
139
164
|
return new n({
|
|
140
165
|
find: t.find,
|
|
@@ -144,9 +169,9 @@ function N(e) {
|
|
|
144
169
|
}
|
|
145
170
|
});
|
|
146
171
|
}
|
|
147
|
-
function
|
|
148
|
-
return new
|
|
149
|
-
key: new
|
|
172
|
+
function R(e) {
|
|
173
|
+
return new g({
|
|
174
|
+
key: new _("handlePasteLink"),
|
|
150
175
|
props: { handlePaste: (t, n, r) => {
|
|
151
176
|
let { shouldAutoLink: i } = e, { state: a } = t, { selection: o } = a, { empty: s } = o;
|
|
152
177
|
if (s) return !1;
|
|
@@ -159,7 +184,7 @@ function P(e) {
|
|
|
159
184
|
} }
|
|
160
185
|
});
|
|
161
186
|
}
|
|
162
|
-
function
|
|
187
|
+
function z(e, t) {
|
|
163
188
|
let n = [
|
|
164
189
|
"http",
|
|
165
190
|
"https",
|
|
@@ -175,9 +200,9 @@ function F(e, t) {
|
|
|
175
200
|
return t && t.forEach((e) => {
|
|
176
201
|
let t = typeof e == "string" ? e : e.scheme;
|
|
177
202
|
t && n.push(t);
|
|
178
|
-
}), !e || e.replace(
|
|
203
|
+
}), !e || e.replace(C, "").match(RegExp(`^(?:(?:${n.map((e) => e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`, "i"));
|
|
179
204
|
}
|
|
180
|
-
var
|
|
205
|
+
var B = t.create({
|
|
181
206
|
name: "link",
|
|
182
207
|
priority: 1e3,
|
|
183
208
|
keepOnSplit: !1,
|
|
@@ -207,7 +232,7 @@ var I = t.create({
|
|
|
207
232
|
rel: "noopener noreferrer nofollow",
|
|
208
233
|
class: null
|
|
209
234
|
},
|
|
210
|
-
isAllowedUri: (e, t) => !!
|
|
235
|
+
isAllowedUri: (e, t) => !!z(e, t.protocols),
|
|
211
236
|
validate: (e) => !!e,
|
|
212
237
|
shouldAutoLink: (e) => {
|
|
213
238
|
let t = /^[a-z][a-z0-9+.-]*:\/\//i.test(e), n = /^[a-z][a-z0-9+.-]*:/i.test(e);
|
|
@@ -237,7 +262,7 @@ var I = t.create({
|
|
|
237
262
|
getAttrs: (e) => {
|
|
238
263
|
let t = e.getAttribute("href");
|
|
239
264
|
return !t || !this.options.isAllowedUri(t, {
|
|
240
|
-
defaultValidate: (e) => !!
|
|
265
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
241
266
|
protocols: this.options.protocols,
|
|
242
267
|
defaultProtocol: this.options.defaultProtocol
|
|
243
268
|
}) ? !1 : null;
|
|
@@ -246,7 +271,7 @@ var I = t.create({
|
|
|
246
271
|
},
|
|
247
272
|
renderHTML({ HTMLAttributes: e }) {
|
|
248
273
|
return this.options.isAllowedUri(e.href, {
|
|
249
|
-
defaultValidate: (e) => !!
|
|
274
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
250
275
|
protocols: this.options.protocols,
|
|
251
276
|
defaultProtocol: this.options.defaultProtocol
|
|
252
277
|
}) ? [
|
|
@@ -276,7 +301,7 @@ var I = t.create({
|
|
|
276
301
|
setLink: (e) => ({ chain: t }) => {
|
|
277
302
|
let { href: n } = e;
|
|
278
303
|
return this.options.isAllowedUri(n, {
|
|
279
|
-
defaultValidate: (e) => !!
|
|
304
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
280
305
|
protocols: this.options.protocols,
|
|
281
306
|
defaultProtocol: this.options.defaultProtocol
|
|
282
307
|
}) ? t().setMark(this.name, e).setMeta("preventAutolink", !0).run() : !1;
|
|
@@ -284,7 +309,7 @@ var I = t.create({
|
|
|
284
309
|
toggleLink: (e) => ({ chain: t }) => {
|
|
285
310
|
let { href: n } = e || {};
|
|
286
311
|
return n && !this.options.isAllowedUri(n, {
|
|
287
|
-
defaultValidate: (e) => !!
|
|
312
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
288
313
|
protocols: this.options.protocols,
|
|
289
314
|
defaultProtocol: this.options.defaultProtocol
|
|
290
315
|
}) ? !1 : t().toggleMark(this.name, e, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run();
|
|
@@ -293,10 +318,10 @@ var I = t.create({
|
|
|
293
318
|
};
|
|
294
319
|
},
|
|
295
320
|
addInputRules() {
|
|
296
|
-
return this.options.markdownLinks ? [
|
|
321
|
+
return this.options.markdownLinks ? [I({
|
|
297
322
|
type: this.type,
|
|
298
323
|
isAllowedHref: (e) => this.options.isAllowedUri(e, {
|
|
299
|
-
defaultValidate: (e) => !!
|
|
324
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
300
325
|
protocols: this.options.protocols,
|
|
301
326
|
defaultProtocol: this.options.defaultProtocol
|
|
302
327
|
})
|
|
@@ -307,8 +332,8 @@ var I = t.create({
|
|
|
307
332
|
let t = [];
|
|
308
333
|
if (e) {
|
|
309
334
|
let { protocols: n, defaultProtocol: r } = this.options;
|
|
310
|
-
d(e).filter((e) => e.isLink && this.options.isAllowedUri(e.value, {
|
|
311
|
-
defaultValidate: (e) => !!
|
|
335
|
+
d(e, { defaultProtocol: r }).filter((e) => e.isLink && this.options.isAllowedUri(e.value, {
|
|
336
|
+
defaultValidate: (e) => !!z(e, n),
|
|
312
337
|
protocols: n,
|
|
313
338
|
defaultProtocol: r
|
|
314
339
|
})).forEach((e) => {
|
|
@@ -321,10 +346,10 @@ var I = t.create({
|
|
|
321
346
|
}
|
|
322
347
|
return t;
|
|
323
348
|
};
|
|
324
|
-
return this.options.markdownLinks ? [
|
|
349
|
+
return this.options.markdownLinks ? [L({
|
|
325
350
|
type: this.type,
|
|
326
351
|
isAllowedHref: (e) => this.options.isAllowedUri(e, {
|
|
327
|
-
defaultValidate: (e) => !!
|
|
352
|
+
defaultValidate: (e) => !!z(e, this.options.protocols),
|
|
328
353
|
protocols: this.options.protocols,
|
|
329
354
|
defaultProtocol: this.options.defaultProtocol
|
|
330
355
|
}),
|
|
@@ -337,21 +362,21 @@ var I = t.create({
|
|
|
337
362
|
},
|
|
338
363
|
addProseMirrorPlugins() {
|
|
339
364
|
let e = [], { protocols: t, defaultProtocol: n } = this.options;
|
|
340
|
-
return this.options.autolink && e.push(
|
|
365
|
+
return this.options.autolink && e.push(E({
|
|
341
366
|
type: this.type,
|
|
342
367
|
defaultProtocol: this.options.defaultProtocol,
|
|
343
368
|
validate: (e) => this.options.isAllowedUri(e, {
|
|
344
|
-
defaultValidate: (e) => !!
|
|
369
|
+
defaultValidate: (e) => !!z(e, t),
|
|
345
370
|
protocols: t,
|
|
346
371
|
defaultProtocol: n
|
|
347
372
|
}),
|
|
348
373
|
shouldAutoLink: this.options.shouldAutoLink
|
|
349
|
-
})), e.push(
|
|
374
|
+
})), e.push(D({
|
|
350
375
|
type: this.type,
|
|
351
376
|
editor: this.editor,
|
|
352
377
|
openOnClick: this.options.openOnClick === "whenNotEditable" || this.options.openOnClick,
|
|
353
378
|
enableClickSelection: this.options.enableClickSelection
|
|
354
|
-
})), this.options.linkOnPaste && e.push(
|
|
379
|
+
})), this.options.linkOnPaste && e.push(R({
|
|
355
380
|
editor: this.editor,
|
|
356
381
|
defaultProtocol: this.options.defaultProtocol,
|
|
357
382
|
type: this.type,
|
|
@@ -359,6 +384,6 @@ var I = t.create({
|
|
|
359
384
|
})), e;
|
|
360
385
|
}
|
|
361
386
|
});
|
|
362
|
-
export {
|
|
387
|
+
export { B as Link, z as isAllowedUri };
|
|
363
388
|
|
|
364
389
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Plugin2","PluginKey2","Plugin3","PluginKey3","find2","markPasteRule2","UNICODE_WHITESPACE_PATTERN","UNICODE_WHITESPACE_REGEX","UNICODE_WHITESPACE_REGEX_END","UNICODE_WHITESPACE_REGEX_GLOBAL","isValidLinkStructure","tokens","autolink","Plugin","PluginKey","docChanges","transactions","transaction","oldState","newState","preventAutolink","transform","combineTransactionSteps","getChangedRanges","nodesInChangedRanges","findChildrenInRange","newRange","node","textBlock","textBeforeWhitespace","endText","wordsBeforeWhitespace","lastWordBeforeSpace","lastWordAndBlockOffset","linksBeforeSpace","tokenize","options","link","getMarksBetween","item","tr","clickHandler","event","view","target","root","handled","attrs","getAttributes","href","MARKDOWN_LINK_INPUT_REGEX","MARKDOWN_LINK_PASTE_REGEX","isEscaped","backslashes","position","index","text","isInsideCodeSpan","openRunLength","matchIndex","runLength","isConvertibleLink","linkText","match","isAllowedHref","toRuleMatch","linkSyntax","straightQuotedTitle","curlyDoubleTitle","curlySingleTitle","title","matchesOverlap","a","b","getMarkdownLinkAttributes","markdownLinkInputRule","rule","markInputRule","config","InputRule","result","props","markdownLinkPasteRule","markPasteRule","markdownMatches","plainUrlMatches","markdownMatch","urlMatch","PasteRule","pasteHandler","state","selection","empty","textContent","find","shouldAutoLink","isAllowedUri","allowedProtocols","protocols","nextProtocol","protocol","uri","Link","Mark","registerCustomProtocol","url","ctx","hasProtocol","hasMaybeProtocol","hostname","element","dom","HTMLAttributes","mergeAttributes","helpers","token","h","attributes","chain","findPlainUrls","foundLinks","plugins"],"sources":["../../../../../node_modules/@tiptap/extension-link/dist/index.js"],"sourcesContent":["// src/link.ts\nimport { Mark, markPasteRule as markPasteRule2, mergeAttributes } from \"@tiptap/core\";\nimport { find as find2, registerCustomProtocol, reset } from \"linkifyjs\";\n\n// src/helpers/autolink.ts\nimport {\n combineTransactionSteps,\n findChildrenInRange,\n getChangedRanges,\n getMarksBetween\n} from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { tokenize } from \"linkifyjs\";\n\n// src/helpers/whitespace.ts\nvar UNICODE_WHITESPACE_PATTERN = \"[\\0- \\xA0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]\";\nvar UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);\nvar UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);\nvar UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, \"g\");\n\n// src/helpers/autolink.ts\nfunction isValidLinkStructure(tokens) {\n if (tokens.length === 1) {\n return tokens[0].isLink;\n }\n if (tokens.length === 3 && tokens[1].isLink) {\n return [\"()\", \"[]\"].includes(tokens[0].value + tokens[2].value);\n }\n return false;\n}\nfunction autolink(options) {\n return new Plugin({\n key: new PluginKey(\"autolink\"),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n const preventAutolink = transactions.some(\n (transaction) => transaction.getMeta(\"preventAutolink\")\n );\n if (!docChanges || preventAutolink) {\n return;\n }\n const { tr } = newState;\n const transform = combineTransactionSteps(oldState.doc, [...transactions]);\n const changes = getChangedRanges(transform);\n changes.forEach(({ newRange }) => {\n const nodesInChangedRanges = findChildrenInRange(\n newState.doc,\n newRange,\n (node) => node.isTextblock\n );\n let textBlock;\n let textBeforeWhitespace;\n if (nodesInChangedRanges.length > 1) {\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n textBlock.pos + textBlock.node.nodeSize,\n void 0,\n \" \"\n );\n } else if (nodesInChangedRanges.length) {\n const endText = newState.doc.textBetween(newRange.from, newRange.to, \" \", \" \");\n if (!UNICODE_WHITESPACE_REGEX_END.test(endText)) {\n return;\n }\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n newRange.to,\n void 0,\n \" \"\n );\n }\n if (textBlock && textBeforeWhitespace) {\n const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);\n if (wordsBeforeWhitespace.length <= 0) {\n return false;\n }\n const lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];\n const lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);\n if (!lastWordBeforeSpace) {\n return false;\n }\n const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(\n (t) => t.toObject(options.defaultProtocol)\n );\n if (!isValidLinkStructure(linksBeforeSpace)) {\n return false;\n }\n linksBeforeSpace.filter((link) => link.isLink).map((link) => ({\n ...link,\n from: lastWordAndBlockOffset + link.start + 1,\n to: lastWordAndBlockOffset + link.end + 1\n })).filter((link) => {\n if (!newState.schema.marks.code) {\n return true;\n }\n return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);\n }).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {\n if (getMarksBetween(link.from, link.to, newState.doc).some(\n (item) => item.mark.type === options.type\n )) {\n return;\n }\n tr.addMark(\n link.from,\n link.to,\n options.type.create({\n href: link.href\n })\n );\n });\n }\n });\n if (!tr.steps.length) {\n return;\n }\n return tr;\n }\n });\n}\n\n// src/helpers/clickHandler.ts\nimport { getAttributes } from \"@tiptap/core\";\nimport { Plugin as Plugin2, PluginKey as PluginKey2 } from \"@tiptap/pm/state\";\nfunction clickHandler(options) {\n return new Plugin2({\n key: new PluginKey2(\"handleClickLink\"),\n props: {\n handleClick: (view, pos, event) => {\n var _a, _b;\n if (event.button !== 0) {\n return false;\n }\n if (!view.editable) {\n return false;\n }\n let link = null;\n if (event.target instanceof HTMLAnchorElement) {\n link = event.target;\n } else {\n const target = event.target;\n if (!target) {\n return false;\n }\n const root = options.editor.view.dom;\n link = target.closest(\"a\");\n if (link && !root.contains(link)) {\n link = null;\n }\n }\n if (!link) {\n return false;\n }\n let handled = false;\n if (options.enableClickSelection) {\n const commandResult = options.editor.commands.extendMarkRange(options.type.name);\n handled = commandResult;\n }\n if (options.openOnClick) {\n const attrs = getAttributes(view.state, options.type.name);\n const href = (_a = link.href) != null ? _a : attrs.href;\n const target = (_b = link.target) != null ? _b : attrs.target;\n if (href) {\n window.open(href, target);\n handled = true;\n }\n }\n return handled;\n }\n }\n });\n}\n\n// src/helpers/markdownLink.ts\nimport { InputRule, markInputRule, markPasteRule, PasteRule } from \"@tiptap/core\";\nvar MARKDOWN_LINK_INPUT_REGEX = /\\[([^[\\]]+)\\]\\(((?:[^\\s()]|\\([^\\s()]*\\))+)(?:\\s+(?:([\"'])(.*?)\\3|“(.*?)”|‘(.*?)’))?\\)$/;\nvar MARKDOWN_LINK_PASTE_REGEX = /\\[([^[\\]]+)\\]\\(((?:[^\\s()]|\\([^\\s()]*\\))+)(?:\\s+(?:([\"'])(.*?)\\3|“(.*?)”|‘(.*?)’))?\\)/g;\nfunction isEscaped(text, index) {\n let backslashes = 0;\n for (let position = index - 1; position >= 0 && text[position] === \"\\\\\"; position -= 1) {\n backslashes += 1;\n }\n return backslashes % 2 === 1;\n}\nfunction isInsideCodeSpan(text, matchIndex) {\n let openRunLength = 0;\n let index = 0;\n while (index < matchIndex) {\n if (text[index] !== \"`\") {\n index += 1;\n continue;\n }\n if (openRunLength === 0 && isEscaped(text, index)) {\n index += 1;\n continue;\n }\n let runLength = 0;\n while (index < matchIndex && text[index] === \"`\") {\n runLength += 1;\n index += 1;\n }\n if (openRunLength === 0) {\n openRunLength = runLength;\n } else if (runLength === openRunLength) {\n openRunLength = 0;\n }\n }\n return openRunLength > 0;\n}\nfunction isConvertibleLink(text, match, isAllowedHref) {\n var _a, _b;\n const [, linkText, href] = match;\n const characterBefore = match.index ? text[match.index - 1] : void 0;\n if (characterBefore === \"!\" || isEscaped(text, (_a = match.index) != null ? _a : 0)) {\n return false;\n }\n if (isInsideCodeSpan(text, (_b = match.index) != null ? _b : 0)) {\n return false;\n }\n return !!linkText.trim() && isAllowedHref(href);\n}\nfunction toRuleMatch(match) {\n var _a, _b;\n const [linkSyntax, linkText, href, , straightQuotedTitle, curlyDoubleTitle, curlySingleTitle] = match;\n const title = (_a = straightQuotedTitle != null ? straightQuotedTitle : curlyDoubleTitle) != null ? _a : curlySingleTitle;\n return {\n index: (_b = match.index) != null ? _b : 0,\n text: linkSyntax,\n replaceWith: linkText,\n data: {\n href,\n // an empty title (\"\") counts as no title, as in CommonMark\n title: title || null,\n markdown: true\n }\n };\n}\nfunction matchesOverlap(a, b) {\n return a.index < b.index + b.text.length && b.index < a.index + a.text.length;\n}\nfunction getMarkdownLinkAttributes(match) {\n var _a, _b, _c;\n return {\n href: (_a = match.data) == null ? void 0 : _a.href,\n title: (_c = (_b = match.data) == null ? void 0 : _b.title) != null ? _c : null\n };\n}\nfunction markdownLinkInputRule(config) {\n const rule = markInputRule({\n find: (text) => {\n const match = MARKDOWN_LINK_INPUT_REGEX.exec(text);\n if (!match || !isConvertibleLink(text, match, config.isAllowedHref)) {\n return null;\n }\n return toRuleMatch(match);\n },\n type: config.type,\n getAttributes: getMarkdownLinkAttributes\n });\n return new InputRule({\n find: rule.find,\n handler: (props) => {\n const result = rule.handler(props);\n if (result !== null && props.state.tr.steps.length) {\n props.state.tr.setMeta(\"preventAutolink\", true);\n }\n return result;\n }\n });\n}\nfunction markdownLinkPasteRule(config) {\n const rule = markPasteRule({\n find: (text) => {\n var _a, _b;\n const markdownMatches = [];\n for (const match of text.matchAll(MARKDOWN_LINK_PASTE_REGEX)) {\n if (isConvertibleLink(text, match, config.isAllowedHref)) {\n markdownMatches.push(toRuleMatch(match));\n }\n }\n const plainUrlMatches = ((_b = (_a = config.findPlainUrls) == null ? void 0 : _a.call(config, text)) != null ? _b : []).filter(\n (urlMatch) => !markdownMatches.some((markdownMatch) => matchesOverlap(markdownMatch, urlMatch))\n );\n return [...markdownMatches, ...plainUrlMatches];\n },\n type: config.type,\n getAttributes: getMarkdownLinkAttributes\n });\n return new PasteRule({\n find: rule.find,\n handler: (props) => {\n var _a;\n const result = rule.handler(props);\n if (result !== null && props.state.tr.steps.length && ((_a = props.match.data) == null ? void 0 : _a.markdown)) {\n props.state.tr.setMeta(\"preventAutolink\", true);\n }\n return result;\n }\n });\n}\n\n// src/helpers/pasteHandler.ts\nimport { Plugin as Plugin3, PluginKey as PluginKey3 } from \"@tiptap/pm/state\";\nimport { find } from \"linkifyjs\";\nfunction pasteHandler(options) {\n return new Plugin3({\n key: new PluginKey3(\"handlePasteLink\"),\n props: {\n handlePaste: (view, _event, slice) => {\n const { shouldAutoLink } = options;\n const { state } = view;\n const { selection } = state;\n const { empty } = selection;\n if (empty) {\n return false;\n }\n let textContent = \"\";\n slice.content.forEach((node) => {\n textContent += node.textContent;\n });\n const link = find(textContent, { defaultProtocol: options.defaultProtocol }).find(\n (item) => item.isLink && item.value === textContent\n );\n if (!textContent || !link || shouldAutoLink !== void 0 && !shouldAutoLink(link.value)) {\n return false;\n }\n return options.editor.commands.setMark(options.type, {\n href: link.href\n });\n }\n }\n });\n}\n\n// src/link.ts\nvar pasteRegex = /https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi;\nfunction isAllowedUri(uri, protocols) {\n const allowedProtocols = [\n \"http\",\n \"https\",\n \"ftp\",\n \"ftps\",\n \"mailto\",\n \"tel\",\n \"callto\",\n \"sms\",\n \"cid\",\n \"xmpp\"\n ];\n if (protocols) {\n protocols.forEach((protocol) => {\n const nextProtocol = typeof protocol === \"string\" ? protocol : protocol.scheme;\n if (nextProtocol) {\n allowedProtocols.push(nextProtocol);\n }\n });\n }\n return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, \"\").match(\n new RegExp(\n `^(?:(?:${allowedProtocols.map((protocol) => protocol.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\")).join(\"|\")}):|[^a-z]|[a-z0-9+.\\\\-]+(?:[^a-z+.\\\\-:]|$))`,\n \"i\"\n )\n );\n}\nvar Link = Mark.create({\n name: \"link\",\n priority: 1e3,\n keepOnSplit: false,\n exitable: true,\n onCreate() {\n if (this.options.validate && !this.options.shouldAutoLink) {\n this.options.shouldAutoLink = this.options.validate;\n console.warn(\n \"The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.\"\n );\n }\n this.options.protocols.forEach((protocol) => {\n if (typeof protocol === \"string\") {\n registerCustomProtocol(protocol);\n return;\n }\n registerCustomProtocol(protocol.scheme, protocol.optionalSlashes);\n });\n },\n onDestroy() {\n reset();\n },\n inclusive() {\n return this.options.autolink;\n },\n addOptions() {\n return {\n openOnClick: true,\n enableClickSelection: false,\n linkOnPaste: true,\n markdownLinks: false,\n // TODO (major) - default to true on next major version\n autolink: true,\n protocols: [],\n defaultProtocol: \"http\",\n HTMLAttributes: {\n target: \"_blank\",\n rel: \"noopener noreferrer nofollow\",\n class: null\n },\n isAllowedUri: (url, ctx) => !!isAllowedUri(url, ctx.protocols),\n validate: (url) => !!url,\n shouldAutoLink: (url) => {\n const hasProtocol = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(url);\n const hasMaybeProtocol = /^[a-z][a-z0-9+.-]*:/i.test(url);\n if (hasProtocol || hasMaybeProtocol && !url.includes(\"@\")) {\n return true;\n }\n const urlWithoutUserinfo = url.includes(\"@\") ? url.split(\"@\").pop() : url;\n const hostname = urlWithoutUserinfo.split(/[/?#:]/)[0];\n if (/^\\d{1,3}(\\.\\d{1,3}){3}$/.test(hostname)) {\n return false;\n }\n if (!/\\./.test(hostname)) {\n return false;\n }\n return true;\n }\n };\n },\n addAttributes() {\n var _a, _b, _c;\n return {\n href: {\n default: null,\n parseHTML(element) {\n return element.getAttribute(\"href\");\n }\n },\n target: {\n // Coerce `undefined` to `null` because `undefined` is an invalid attribute value\n default: (_a = this.options.HTMLAttributes.target) != null ? _a : null\n },\n rel: {\n // Coerce `undefined` to `null` because `undefined` is an invalid attribute value\n default: (_b = this.options.HTMLAttributes.rel) != null ? _b : null\n },\n class: {\n // Coerce `undefined` to `null` because `undefined` is an invalid attribute value\n default: (_c = this.options.HTMLAttributes.class) != null ? _c : null\n },\n title: {\n default: null\n }\n };\n },\n parseHTML() {\n return [\n {\n tag: \"a[href]\",\n getAttrs: (dom) => {\n const href = dom.getAttribute(\"href\");\n if (!href || !this.options.isAllowedUri(href, {\n defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n })) {\n return false;\n }\n return null;\n }\n }\n ];\n },\n renderHTML({ HTMLAttributes }) {\n if (!this.options.isAllowedUri(HTMLAttributes.href, {\n defaultValidate: (href) => !!isAllowedUri(href, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n })) {\n return [\"a\", mergeAttributes(this.options.HTMLAttributes, { ...HTMLAttributes, href: \"\" }), 0];\n }\n return [\"a\", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];\n },\n markdownTokenName: \"link\",\n parseMarkdown: (token, helpers) => {\n return helpers.applyMark(\"link\", helpers.parseInline(token.tokens || []), {\n href: token.href,\n title: token.title || null\n });\n },\n renderMarkdown: (node, h) => {\n var _a, _b, _c, _d;\n const href = (_b = (_a = node.attrs) == null ? void 0 : _a.href) != null ? _b : \"\";\n const title = (_d = (_c = node.attrs) == null ? void 0 : _c.title) != null ? _d : \"\";\n const text = h.renderChildren(node);\n return title ? `[${text}](${href} \"${title}\")` : `[${text}](${href})`;\n },\n addCommands() {\n return {\n setLink: (attributes) => ({ chain }) => {\n const { href } = attributes;\n if (!this.options.isAllowedUri(href, {\n defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n })) {\n return false;\n }\n return chain().setMark(this.name, attributes).setMeta(\"preventAutolink\", true).run();\n },\n toggleLink: (attributes) => ({ chain }) => {\n const { href } = attributes || {};\n if (href && !this.options.isAllowedUri(href, {\n defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n })) {\n return false;\n }\n return chain().toggleMark(this.name, attributes, { extendEmptyMarkRange: true }).setMeta(\"preventAutolink\", true).run();\n },\n unsetLink: () => ({ chain }) => {\n return chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta(\"preventAutolink\", true).run();\n }\n };\n },\n addInputRules() {\n if (!this.options.markdownLinks) {\n return [];\n }\n return [\n markdownLinkInputRule({\n type: this.type,\n isAllowedHref: (href) => this.options.isAllowedUri(href, {\n defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n })\n })\n ];\n },\n addPasteRules() {\n const findPlainUrls = (text) => {\n const foundLinks = [];\n if (text) {\n const { protocols, defaultProtocol } = this.options;\n const links = find2(text).filter(\n (item) => item.isLink && this.options.isAllowedUri(item.value, {\n defaultValidate: (href) => !!isAllowedUri(href, protocols),\n protocols,\n defaultProtocol\n })\n );\n links.forEach((link) => {\n if (!this.options.shouldAutoLink(link.value)) {\n return;\n }\n foundLinks.push({\n text: link.value,\n data: {\n href: link.href\n },\n index: link.start\n });\n });\n }\n return foundLinks;\n };\n if (this.options.markdownLinks) {\n return [\n markdownLinkPasteRule({\n type: this.type,\n isAllowedHref: (href) => this.options.isAllowedUri(href, {\n defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n protocols: this.options.protocols,\n defaultProtocol: this.options.defaultProtocol\n }),\n findPlainUrls\n })\n ];\n }\n return [\n markPasteRule2({\n find: findPlainUrls,\n type: this.type,\n getAttributes: (match) => {\n var _a;\n return {\n href: (_a = match.data) == null ? void 0 : _a.href\n };\n }\n })\n ];\n },\n addProseMirrorPlugins() {\n const plugins = [];\n const { protocols, defaultProtocol } = this.options;\n if (this.options.autolink) {\n plugins.push(\n autolink({\n type: this.type,\n defaultProtocol: this.options.defaultProtocol,\n validate: (url) => this.options.isAllowedUri(url, {\n defaultValidate: (href) => !!isAllowedUri(href, protocols),\n protocols,\n defaultProtocol\n }),\n shouldAutoLink: this.options.shouldAutoLink\n })\n );\n }\n plugins.push(\n clickHandler({\n type: this.type,\n editor: this.editor,\n openOnClick: this.options.openOnClick === \"whenNotEditable\" ? true : this.options.openOnClick,\n enableClickSelection: this.options.enableClickSelection\n })\n );\n if (this.options.linkOnPaste) {\n plugins.push(\n pasteHandler({\n editor: this.editor,\n defaultProtocol: this.options.defaultProtocol,\n type: this.type,\n shouldAutoLink: this.options.shouldAutoLink\n })\n );\n }\n return plugins;\n }\n});\n\n// src/index.ts\nvar index_default = Link;\nexport {\n Link,\n index_default as default,\n isAllowedUri,\n pasteRegex\n};\n//# sourceMappingURL=index.js.map"],"ignoreList":[0],"mappings":";;;;AAeA,IAAIM,IAA6B,0BAC7BC,IAA2B,IAAI,OAAOD,CAA0B,GAChEE,IAAmC,OAAO,GAAGF,EAA2B,EAAE,GAC1EG,IAAkC,IAAI,OAAOH,GAA4B,GAAG;AAGhF,SAASI,EAAqB,GAAQ;CAOpC,OANIC,EAAO,WAAW,IACbA,EAAO,EAAE,CAAC,SAEfA,EAAO,WAAW,KAAKA,EAAO,EAAE,CAAC,SAC5B,CAAC,MAAM,IAAI,CAAC,CAAC,SAASA,EAAO,EAAE,CAAC,QAAQA,EAAO,EAAE,CAAC,KAAK,IAEzD;AACT;AACA,SAASC,EAAS,GAAS;CACzB,OAAO,IAAIC,EAAO;EAChB,KAAK,IAAIC,EAAU,UAAU;EAC7B,oBAAoB,GAAc,GAAU,MAAa;GACvD,IAAMC,IAAaC,EAAa,MAAM,MAAgBC,EAAY,UAAU,KAAK,CAACC,EAAS,IAAI,GAAGC,EAAS,GAAG,GACxGC,IAAkBJ,EAAa,MAClC,MAAgBC,EAAY,QAAQ,iBAAiB,CACxD;GACA,IAAI,CAACF,KAAcK,GACjB;GAEF,IAAM,EAAE,UAAOD,GACTE,IAAYC,EAAwBJ,EAAS,KAAK,CAAC,GAAGF,CAAY,CAAC;GAwEzE,IAtEAO,EADiCF,CAC3B,CAAC,CAAC,SAAS,EAAE,kBAAe;IAChC,IAAMG,IAAuBC,EAC3BN,EAAS,KACTO,IACC,MAASC,EAAK,WACjB,GACIC,GACAC;IACJ,IAAIL,EAAqB,SAAS,GAEhC,AADA,IAAYA,EAAqB,IACjC,IAAuBL,EAAS,IAAI,YAClCS,EAAU,KACVA,EAAU,MAAMA,EAAU,KAAK,UAC/B,KAAK,GACL,GACF;SACK,IAAIJ,EAAqB,QAAQ;KACtC,IAAMM,IA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gC;CACT;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["UNICODE_WHITESPACE_PATTERN","UNICODE_WHITESPACE_REGEX","UNICODE_WHITESPACE_REGEX_END","UNICODE_WHITESPACE_REGEX_TRAILING","UNICODE_WHITESPACE_REGEX_GLOBAL","unlinkTrailingWhitespace","rangeEnd","tr","range","trailingWhitespace","whitespaceFrom","linkMarks","getMarksBetween","item","type","nodeAfter","storedMarks","isValidLinkStructure","tokens","autolink","Plugin","PluginKey","docChanges","transactions","transaction","oldState","newState","preventAutolink","transform","combineTransactionSteps","isHistoryTransaction","insertedRanges","step","ReplaceStep","mapping","index","from","to","right","left","options","getChangedRanges","nodesInChangedRanges","findChildrenInRange","newRange","node","textBlock","textBeforeWhitespace","endText","wordsBeforeWhitespace","lastWordBeforeSpace","lastWordAndBlockOffset","linksBeforeSpace","tokenize","link","clickHandler","event","view","target","root","handled","attrs","getAttributes","href","MARKDOWN_LINK_INPUT_REGEX","MARKDOWN_LINK_PASTE_REGEX","isEscaped","backslashes","position","text","isInsideCodeSpan","openRunLength","matchIndex","runLength","isConvertibleLink","linkText","match","isAllowedHref","toRuleMatch","linkSyntax","straightQuotedTitle","curlyDoubleTitle","curlySingleTitle","title","matchesOverlap","a","b","getMarkdownLinkAttributes","markdownLinkInputRule","rule","markInputRule","config","InputRule","result","props","markdownLinkPasteRule","markPasteRule","markdownMatches","plainUrlMatches","markdownMatch","urlMatch","PasteRule","pasteHandler","state","selection","empty","textContent","find","shouldAutoLink","isAllowedUri","allowedProtocols","protocols","nextProtocol","protocol","uri","Link","Mark","registerCustomProtocol","url","ctx","hasProtocol","hasMaybeProtocol","hostname","element","dom","HTMLAttributes","mergeAttributes","helpers","token","h","attributes","chain","findPlainUrls","foundLinks","plugins"],"sources":["../../../../../node_modules/@tiptap/extension-link/dist/index.js"],"sourcesContent":["import { InputRule, Mark, PasteRule, combineTransactionSteps, findChildrenInRange, getAttributes, getChangedRanges, getMarksBetween, markInputRule, markPasteRule, mergeAttributes } from \"@tiptap/core\";\nimport { find, registerCustomProtocol, reset, tokenize } from \"linkifyjs\";\nimport { isHistoryTransaction } from \"@tiptap/pm/history\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { ReplaceStep } from \"@tiptap/pm/transform\";\n//#region src/helpers/whitespace.ts\nconst UNICODE_WHITESPACE_PATTERN = \"[\\0- \\xA0 -\\u2029 ]\";\nconst UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);\nconst UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);\nconst UNICODE_WHITESPACE_REGEX_TRAILING = new RegExp(`${UNICODE_WHITESPACE_PATTERN}+$`);\nconst UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, \"g\");\n//#endregion\n//#region src/helpers/unlinkTrailingWhitespace.ts\nfunction unlinkTrailingWhitespace(tr, range, type) {\n\tvar _rangeEnd$nodeBefore, _insertedText$match;\n\tconst rangeEnd = tr.doc.resolve(range.to);\n\tif (!((_rangeEnd$nodeBefore = rangeEnd.nodeBefore) === null || _rangeEnd$nodeBefore === void 0 ? void 0 : _rangeEnd$nodeBefore.isText)) return;\n\tconst trailingWhitespace = (_insertedText$match = tr.doc.textBetween(range.from, range.to, \"\", \"\").match(UNICODE_WHITESPACE_REGEX_TRAILING)) === null || _insertedText$match === void 0 ? void 0 : _insertedText$match[0];\n\tif (!trailingWhitespace) return;\n\tconst whitespaceFrom = range.to - trailingWhitespace.length;\n\tconst linkMarks = getMarksBetween(whitespaceFrom, range.to, tr.doc).filter((item) => item.mark.type === type);\n\tif (!linkMarks.length) return;\n\tconst { nodeAfter } = rangeEnd;\n\tif (!!nodeAfter && linkMarks.some((item) => item.mark.isInSet(nodeAfter.marks))) return;\n\tconst storedMarks = tr.storedMarks;\n\ttr.removeMark(whitespaceFrom, range.to, type);\n\ttr.setStoredMarks(storedMarks);\n\tif (tr.selection.empty && tr.selection.from === range.to) tr.removeStoredMark(type);\n}\n//#endregion\n//#region src/helpers/autolink.ts\n/**\n* Check if the provided tokens form a valid link structure, which can either be a single link token\n* or a link token surrounded by parentheses or square brackets.\n*\n* This ensures that only complete and valid text is hyperlinked, preventing cases where a valid\n* top-level domain (TLD) is immediately followed by an invalid character, like a number. For\n* example, with the `find` method from Linkify, entering `example.com1` would result in\n* `example.com` being linked and the trailing `1` left as plain text. By using the `tokenize`\n* method, we can perform more comprehensive validation on the input text.\n*/\nfunction isValidLinkStructure(tokens) {\n\tif (tokens.length === 1) return tokens[0].isLink;\n\tif (tokens.length === 3 && tokens[1].isLink) return [\"()\", \"[]\"].includes(tokens[0].value + tokens[2].value);\n\treturn false;\n}\n/**\n* This plugin allows you to automatically add links to your editor.\n* @param options The plugin options\n* @returns The plugin instance\n*/\nfunction autolink(options) {\n\treturn new Plugin({\n\t\tkey: new PluginKey(\"autolink\"),\n\t\tappendTransaction: (transactions, oldState, newState) => {\n\t\t\t/**\n\t\t\t* Does the transaction change the document?\n\t\t\t*/\n\t\t\tconst docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n\t\t\t/**\n\t\t\t* Prevent autolink if the transaction is not a document change or if the transaction has the meta `preventAutolink`.\n\t\t\t*/\n\t\t\tconst preventAutolink = transactions.some((transaction) => transaction.getMeta(\"preventAutolink\"));\n\t\t\t/**\n\t\t\t* Prevent autolink if the transaction is not a document change\n\t\t\t* or if the transaction has the meta `preventAutolink`.\n\t\t\t*/\n\t\t\tif (!docChanges || preventAutolink) return;\n\t\t\tconst { tr } = newState;\n\t\t\tconst transform = combineTransactionSteps(oldState.doc, [...transactions]);\n\t\t\tif (!transactions.some(isHistoryTransaction)) {\n\t\t\t\tconst insertedRanges = [];\n\t\t\t\ttransform.steps.forEach((step, index) => {\n\t\t\t\t\tif (!(step instanceof ReplaceStep) || !step.slice.size) return;\n\t\t\t\t\tconst mapping = transform.mapping.slice(index + 1);\n\t\t\t\t\tconst from = mapping.map(step.from, 1);\n\t\t\t\t\tconst to = mapping.map(step.from + step.slice.size, -1);\n\t\t\t\t\tif (from < to) insertedRanges.push({\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tinsertedRanges.sort((left, right) => right.to - left.to);\n\t\t\t\tinsertedRanges.forEach((range) => unlinkTrailingWhitespace(tr, range, options.type));\n\t\t\t}\n\t\t\tgetChangedRanges(transform).forEach(({ newRange }) => {\n\t\t\t\tconst nodesInChangedRanges = findChildrenInRange(newState.doc, newRange, (node) => node.isTextblock);\n\t\t\t\tlet textBlock;\n\t\t\t\tlet textBeforeWhitespace;\n\t\t\t\tif (nodesInChangedRanges.length > 1) {\n\t\t\t\t\ttextBlock = nodesInChangedRanges[0];\n\t\t\t\t\ttextBeforeWhitespace = newState.doc.textBetween(textBlock.pos, textBlock.pos + textBlock.node.nodeSize, void 0, \" \");\n\t\t\t\t} else if (nodesInChangedRanges.length) {\n\t\t\t\t\tconst endText = newState.doc.textBetween(newRange.from, newRange.to, \" \", \" \");\n\t\t\t\t\tif (!UNICODE_WHITESPACE_REGEX_END.test(endText)) return;\n\t\t\t\t\ttextBlock = nodesInChangedRanges[0];\n\t\t\t\t\ttextBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, void 0, \" \");\n\t\t\t\t}\n\t\t\t\tif (textBlock && textBeforeWhitespace) {\n\t\t\t\t\tconst wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);\n\t\t\t\t\tif (wordsBeforeWhitespace.length <= 0) return false;\n\t\t\t\t\tconst lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];\n\t\t\t\t\tconst lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);\n\t\t\t\t\tif (!lastWordBeforeSpace) return false;\n\t\t\t\t\tconst linksBeforeSpace = tokenize(lastWordBeforeSpace).map((t) => t.toObject(options.defaultProtocol));\n\t\t\t\t\tif (!isValidLinkStructure(linksBeforeSpace)) return false;\n\t\t\t\t\tlinksBeforeSpace.filter((link) => link.isLink).map((link) => ({\n\t\t\t\t\t\t...link,\n\t\t\t\t\t\tfrom: lastWordAndBlockOffset + link.start + 1,\n\t\t\t\t\t\tto: lastWordAndBlockOffset + link.end + 1\n\t\t\t\t\t})).filter((link) => {\n\t\t\t\t\t\tif (!newState.schema.marks.code) return true;\n\t\t\t\t\t\treturn !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);\n\t\t\t\t\t}).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {\n\t\t\t\t\t\tif (getMarksBetween(link.from, link.to, newState.doc).some((item) => item.mark.type === options.type)) return;\n\t\t\t\t\t\ttr.addMark(link.from, link.to, options.type.create({ href: link.href }));\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (!tr.steps.length) return;\n\t\t\treturn tr;\n\t\t}\n\t});\n}\n//#endregion\n//#region src/helpers/clickHandler.ts\nfunction clickHandler(options) {\n\treturn new Plugin({\n\t\tkey: new PluginKey(\"handleClickLink\"),\n\t\tprops: { handleClick: (view, pos, event) => {\n\t\t\tif (event.button !== 0) return false;\n\t\t\tif (!view.editable) return false;\n\t\t\tlet link = null;\n\t\t\tif (event.target instanceof HTMLAnchorElement) link = event.target;\n\t\t\telse {\n\t\t\t\tconst target = event.target;\n\t\t\t\tif (!target) return false;\n\t\t\t\tconst root = options.editor.view.dom;\n\t\t\t\tlink = target.closest(\"a\");\n\t\t\t\tif (link && !root.contains(link)) link = null;\n\t\t\t}\n\t\t\tif (!link) return false;\n\t\t\tlet handled = false;\n\t\t\tif (options.enableClickSelection) handled = options.editor.commands.extendMarkRange(options.type.name);\n\t\t\tif (options.openOnClick) {\n\t\t\t\tvar _link$href, _link$target;\n\t\t\t\tconst attrs = getAttributes(view.state, options.type.name);\n\t\t\t\tconst href = (_link$href = link.href) !== null && _link$href !== void 0 ? _link$href : attrs.href;\n\t\t\t\tconst target = (_link$target = link.target) !== null && _link$target !== void 0 ? _link$target : attrs.target;\n\t\t\t\tif (href) {\n\t\t\t\t\twindow.open(href, target);\n\t\t\t\t\thandled = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn handled;\n\t\t} }\n\t});\n}\n//#endregion\n//#region src/helpers/markdownLink.ts\n/**\n* Matches a Markdown link with an optional quoted title.\n* for ex: [Tiptap](https://tiptap.dev) or [Tiptap](https://tiptap.dev \"some title\")\n* the URL may also contain one level of balanced parentheses, as in CommonMark\n* (titles accept curly quotes too, the Typography extension swaps them in while typing)\n* the title delimiters must come in matching pairs\n*/\nconst MARKDOWN_LINK_INPUT_REGEX = /\\[([^[\\]]+)\\]\\(((?:[^\\s()]|\\([^\\s()]*\\))+)(?:\\s+(?:([\"'])(.*?)\\3|“(.*?)”|‘(.*?)’))?\\)$/;\n/**\n* Same as the input regex but global, to find every Markdown link in pasted text.\n*/\nconst MARKDOWN_LINK_PASTE_REGEX = /\\[([^[\\]]+)\\]\\(((?:[^\\s()]|\\([^\\s()]*\\))+)(?:\\s+(?:([\"'])(.*?)\\3|“(.*?)”|‘(.*?)’))?\\)/g;\nfunction isEscaped(text, index) {\n\tlet backslashes = 0;\n\tfor (let position = index - 1; position >= 0 && text[position] === \"\\\\\"; position -= 1) backslashes += 1;\n\treturn backslashes % 2 === 1;\n}\n/**\n* Pairs the backtick runs before the match by length, as CommonMark does.\n* A run left open means the match sits in an unfinished code span.\n*/\nfunction isInsideCodeSpan(text, matchIndex) {\n\tlet openRunLength = 0;\n\tlet index = 0;\n\twhile (index < matchIndex) {\n\t\tif (text[index] !== \"`\") {\n\t\t\tindex += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (openRunLength === 0 && isEscaped(text, index)) {\n\t\t\tindex += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tlet runLength = 0;\n\t\twhile (index < matchIndex && text[index] === \"`\") {\n\t\t\trunLength += 1;\n\t\t\tindex += 1;\n\t\t}\n\t\tif (openRunLength === 0) openRunLength = runLength;\n\t\telse if (runLength === openRunLength) openRunLength = 0;\n\t}\n\treturn openRunLength > 0;\n}\nfunction isConvertibleLink(text, match, isAllowedHref) {\n\tvar _match$index, _match$index2;\n\tconst [, linkText, href] = match;\n\tif ((match.index ? text[match.index - 1] : void 0) === \"!\" || isEscaped(text, (_match$index = match.index) !== null && _match$index !== void 0 ? _match$index : 0)) return false;\n\tif (isInsideCodeSpan(text, (_match$index2 = match.index) !== null && _match$index2 !== void 0 ? _match$index2 : 0)) return false;\n\treturn !!linkText.trim() && isAllowedHref(href);\n}\nfunction toRuleMatch(match) {\n\tvar _ref, _match$index3;\n\tconst [linkSyntax, linkText, href, , straightQuotedTitle, curlyDoubleTitle, curlySingleTitle] = match;\n\tconst title = (_ref = straightQuotedTitle !== null && straightQuotedTitle !== void 0 ? straightQuotedTitle : curlyDoubleTitle) !== null && _ref !== void 0 ? _ref : curlySingleTitle;\n\treturn {\n\t\tindex: (_match$index3 = match.index) !== null && _match$index3 !== void 0 ? _match$index3 : 0,\n\t\ttext: linkSyntax,\n\t\treplaceWith: linkText,\n\t\tdata: {\n\t\t\thref,\n\t\t\ttitle: title || null,\n\t\t\tmarkdown: true\n\t\t}\n\t};\n}\nfunction matchesOverlap(a, b) {\n\treturn a.index < b.index + b.text.length && b.index < a.index + a.text.length;\n}\nfunction getMarkdownLinkAttributes(match) {\n\tvar _match$data, _match$data$title, _match$data2;\n\treturn {\n\t\thref: (_match$data = match.data) === null || _match$data === void 0 ? void 0 : _match$data.href,\n\t\ttitle: (_match$data$title = (_match$data2 = match.data) === null || _match$data2 === void 0 ? void 0 : _match$data2.title) !== null && _match$data$title !== void 0 ? _match$data$title : null\n\t};\n}\n/**\n* Turns typed Markdown link syntax into a link mark as soon as the closing `)` comes in.\n* The transaction gets flagged so autolink doesn't touch the converted text again.\n*/\nfunction markdownLinkInputRule(config) {\n\tconst rule = markInputRule({\n\t\tfind: (text) => {\n\t\t\tconst match = MARKDOWN_LINK_INPUT_REGEX.exec(text);\n\t\t\tif (!match || !isConvertibleLink(text, match, config.isAllowedHref)) return null;\n\t\t\treturn toRuleMatch(match);\n\t\t},\n\t\ttype: config.type,\n\t\tgetAttributes: getMarkdownLinkAttributes\n\t});\n\treturn new InputRule({\n\t\tfind: rule.find,\n\t\thandler: (props) => {\n\t\t\tconst result = rule.handler(props);\n\t\t\tif (result !== null && props.state.tr.steps.length) props.state.tr.setMeta(\"preventAutolink\", true);\n\t\t\treturn result;\n\t\t}\n\t});\n}\n/**\n* Same for pasting, converts every Markdown link found in the pasted text\n* and links the plain URLs from `findPlainUrls`.\n*/\nfunction markdownLinkPasteRule(config) {\n\tconst rule = markPasteRule({\n\t\tfind: (text) => {\n\t\t\tvar _config$findPlainUrls, _config$findPlainUrls2;\n\t\t\tconst markdownMatches = [];\n\t\t\tfor (const match of text.matchAll(MARKDOWN_LINK_PASTE_REGEX)) if (isConvertibleLink(text, match, config.isAllowedHref)) markdownMatches.push(toRuleMatch(match));\n\t\t\tconst plainUrlMatches = ((_config$findPlainUrls = (_config$findPlainUrls2 = config.findPlainUrls) === null || _config$findPlainUrls2 === void 0 ? void 0 : _config$findPlainUrls2.call(config, text)) !== null && _config$findPlainUrls !== void 0 ? _config$findPlainUrls : []).filter((urlMatch) => !markdownMatches.some((markdownMatch) => matchesOverlap(markdownMatch, urlMatch)));\n\t\t\treturn [...markdownMatches, ...plainUrlMatches];\n\t\t},\n\t\ttype: config.type,\n\t\tgetAttributes: getMarkdownLinkAttributes\n\t});\n\treturn new PasteRule({\n\t\tfind: rule.find,\n\t\thandler: (props) => {\n\t\t\tvar _props$match$data;\n\t\t\tconst result = rule.handler(props);\n\t\t\tif (result !== null && props.state.tr.steps.length && ((_props$match$data = props.match.data) === null || _props$match$data === void 0 ? void 0 : _props$match$data.markdown)) props.state.tr.setMeta(\"preventAutolink\", true);\n\t\t\treturn result;\n\t\t}\n\t});\n}\n//#endregion\n//#region src/helpers/pasteHandler.ts\nfunction pasteHandler(options) {\n\treturn new Plugin({\n\t\tkey: new PluginKey(\"handlePasteLink\"),\n\t\tprops: { handlePaste: (view, _event, slice) => {\n\t\t\tconst { shouldAutoLink } = options;\n\t\t\tconst { state } = view;\n\t\t\tconst { selection } = state;\n\t\t\tconst { empty } = selection;\n\t\t\tif (empty) return false;\n\t\t\tlet textContent = \"\";\n\t\t\tslice.content.forEach((node) => {\n\t\t\t\ttextContent += node.textContent;\n\t\t\t});\n\t\t\tconst link = find(textContent, { defaultProtocol: options.defaultProtocol }).find((item) => item.isLink && item.value === textContent);\n\t\t\tif (!textContent || !link || shouldAutoLink !== void 0 && !shouldAutoLink(link.value)) return false;\n\t\t\treturn options.editor.commands.setMark(options.type, { href: link.href });\n\t\t} }\n\t});\n}\n//#endregion\n//#region src/link.ts\nconst pasteRegex = /https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi;\nfunction isAllowedUri(uri, protocols) {\n\tconst allowedProtocols = [\n\t\t\"http\",\n\t\t\"https\",\n\t\t\"ftp\",\n\t\t\"ftps\",\n\t\t\"mailto\",\n\t\t\"tel\",\n\t\t\"callto\",\n\t\t\"sms\",\n\t\t\"cid\",\n\t\t\"xmpp\"\n\t];\n\tif (protocols) protocols.forEach((protocol) => {\n\t\tconst nextProtocol = typeof protocol === \"string\" ? protocol : protocol.scheme;\n\t\tif (nextProtocol) allowedProtocols.push(nextProtocol);\n\t});\n\treturn !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, \"\").match(new RegExp(`^(?:(?:${allowedProtocols.map((protocol) => protocol.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\")).join(\"|\")}):|[^a-z]|[a-z0-9+.\\\\-]+(?:[^a-z+.\\\\-:]|$))`, \"i\"));\n}\n/**\n* This extension allows you to create links.\n* @see https://www.tiptap.dev/api/marks/link\n*/\nconst Link = Mark.create({\n\tname: \"link\",\n\tpriority: 1e3,\n\tkeepOnSplit: false,\n\texitable: true,\n\tonCreate() {\n\t\tif (this.options.validate && !this.options.shouldAutoLink) {\n\t\t\tthis.options.shouldAutoLink = this.options.validate;\n\t\t\tconsole.warn(\"The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.\");\n\t\t}\n\t\tthis.options.protocols.forEach((protocol) => {\n\t\t\tif (typeof protocol === \"string\") {\n\t\t\t\tregisterCustomProtocol(protocol);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tregisterCustomProtocol(protocol.scheme, protocol.optionalSlashes);\n\t\t});\n\t},\n\tonDestroy() {\n\t\treset();\n\t},\n\tinclusive() {\n\t\treturn this.options.autolink;\n\t},\n\taddOptions() {\n\t\treturn {\n\t\t\topenOnClick: true,\n\t\t\tenableClickSelection: false,\n\t\t\tlinkOnPaste: true,\n\t\t\tmarkdownLinks: false,\n\t\t\tautolink: true,\n\t\t\tprotocols: [],\n\t\t\tdefaultProtocol: \"http\",\n\t\t\tHTMLAttributes: {\n\t\t\t\ttarget: \"_blank\",\n\t\t\t\trel: \"noopener noreferrer nofollow\",\n\t\t\t\tclass: null\n\t\t\t},\n\t\t\tisAllowedUri: (url, ctx) => !!isAllowedUri(url, ctx.protocols),\n\t\t\tvalidate: (url) => !!url,\n\t\t\tshouldAutoLink: (url) => {\n\t\t\t\tconst hasProtocol = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(url);\n\t\t\t\tconst hasMaybeProtocol = /^[a-z][a-z0-9+.-]*:/i.test(url);\n\t\t\t\tif (hasProtocol || hasMaybeProtocol && !url.includes(\"@\")) return true;\n\t\t\t\tconst hostname = (url.includes(\"@\") ? url.split(\"@\").pop() : url).split(/[/?#:]/)[0];\n\t\t\t\tif (/^\\d{1,3}(\\.\\d{1,3}){3}$/.test(hostname)) return false;\n\t\t\t\tif (!/\\./.test(hostname)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t},\n\taddAttributes() {\n\t\tvar _this$options$HTMLAtt, _this$options$HTMLAtt2, _this$options$HTMLAtt3;\n\t\treturn {\n\t\t\thref: {\n\t\t\t\tdefault: null,\n\t\t\t\tparseHTML(element) {\n\t\t\t\t\treturn element.getAttribute(\"href\");\n\t\t\t\t}\n\t\t\t},\n\t\t\ttarget: { default: (_this$options$HTMLAtt = this.options.HTMLAttributes.target) !== null && _this$options$HTMLAtt !== void 0 ? _this$options$HTMLAtt : null },\n\t\t\trel: { default: (_this$options$HTMLAtt2 = this.options.HTMLAttributes.rel) !== null && _this$options$HTMLAtt2 !== void 0 ? _this$options$HTMLAtt2 : null },\n\t\t\tclass: { default: (_this$options$HTMLAtt3 = this.options.HTMLAttributes.class) !== null && _this$options$HTMLAtt3 !== void 0 ? _this$options$HTMLAtt3 : null },\n\t\t\ttitle: { default: null }\n\t\t};\n\t},\n\tparseHTML() {\n\t\treturn [{\n\t\t\ttag: \"a[href]\",\n\t\t\tgetAttrs: (dom) => {\n\t\t\t\tconst href = dom.getAttribute(\"href\");\n\t\t\t\tif (!href || !this.options.isAllowedUri(href, {\n\t\t\t\t\tdefaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n\t\t\t\t\tprotocols: this.options.protocols,\n\t\t\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t\t\t})) return false;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}];\n\t},\n\trenderHTML({ HTMLAttributes }) {\n\t\tif (!this.options.isAllowedUri(HTMLAttributes.href, {\n\t\t\tdefaultValidate: (href) => !!isAllowedUri(href, this.options.protocols),\n\t\t\tprotocols: this.options.protocols,\n\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t})) return [\n\t\t\t\"a\",\n\t\t\tmergeAttributes(this.options.HTMLAttributes, {\n\t\t\t\t...HTMLAttributes,\n\t\t\t\thref: \"\"\n\t\t\t}),\n\t\t\t0\n\t\t];\n\t\treturn [\n\t\t\t\"a\",\n\t\t\tmergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n\t\t\t0\n\t\t];\n\t},\n\tmarkdownTokenName: \"link\",\n\tparseMarkdown: (token, helpers) => {\n\t\treturn helpers.applyMark(\"link\", helpers.parseInline(token.tokens || []), {\n\t\t\thref: token.href,\n\t\t\ttitle: token.title || null\n\t\t});\n\t},\n\trenderMarkdown: (node, h) => {\n\t\tvar _node$attrs$href, _node$attrs, _node$attrs$title, _node$attrs2;\n\t\tconst href = (_node$attrs$href = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.href) !== null && _node$attrs$href !== void 0 ? _node$attrs$href : \"\";\n\t\tconst title = (_node$attrs$title = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) !== null && _node$attrs$title !== void 0 ? _node$attrs$title : \"\";\n\t\tconst text = h.renderChildren(node);\n\t\treturn title ? `[${text}](${href} \"${title}\")` : `[${text}](${href})`;\n\t},\n\taddCommands() {\n\t\treturn {\n\t\t\tsetLink: (attributes) => ({ chain }) => {\n\t\t\t\tconst { href } = attributes;\n\t\t\t\tif (!this.options.isAllowedUri(href, {\n\t\t\t\t\tdefaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n\t\t\t\t\tprotocols: this.options.protocols,\n\t\t\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t\t\t})) return false;\n\t\t\t\treturn chain().setMark(this.name, attributes).setMeta(\"preventAutolink\", true).run();\n\t\t\t},\n\t\t\ttoggleLink: (attributes) => ({ chain }) => {\n\t\t\t\tconst { href } = attributes || {};\n\t\t\t\tif (href && !this.options.isAllowedUri(href, {\n\t\t\t\t\tdefaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n\t\t\t\t\tprotocols: this.options.protocols,\n\t\t\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t\t\t})) return false;\n\t\t\t\treturn chain().toggleMark(this.name, attributes, { extendEmptyMarkRange: true }).setMeta(\"preventAutolink\", true).run();\n\t\t\t},\n\t\t\tunsetLink: () => ({ chain }) => {\n\t\t\t\treturn chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta(\"preventAutolink\", true).run();\n\t\t\t}\n\t\t};\n\t},\n\taddInputRules() {\n\t\tif (!this.options.markdownLinks) return [];\n\t\treturn [markdownLinkInputRule({\n\t\t\ttype: this.type,\n\t\t\tisAllowedHref: (href) => this.options.isAllowedUri(href, {\n\t\t\t\tdefaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n\t\t\t\tprotocols: this.options.protocols,\n\t\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t\t})\n\t\t})];\n\t},\n\taddPasteRules() {\n\t\tconst findPlainUrls = (text) => {\n\t\t\tconst foundLinks = [];\n\t\t\tif (text) {\n\t\t\t\tconst { protocols, defaultProtocol } = this.options;\n\t\t\t\tfind(text, { defaultProtocol }).filter((item) => item.isLink && this.options.isAllowedUri(item.value, {\n\t\t\t\t\tdefaultValidate: (href) => !!isAllowedUri(href, protocols),\n\t\t\t\t\tprotocols,\n\t\t\t\t\tdefaultProtocol\n\t\t\t\t})).forEach((link) => {\n\t\t\t\t\tif (!this.options.shouldAutoLink(link.value)) return;\n\t\t\t\t\tfoundLinks.push({\n\t\t\t\t\t\ttext: link.value,\n\t\t\t\t\t\tdata: { href: link.href },\n\t\t\t\t\t\tindex: link.start\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn foundLinks;\n\t\t};\n\t\tif (this.options.markdownLinks) return [markdownLinkPasteRule({\n\t\t\ttype: this.type,\n\t\t\tisAllowedHref: (href) => this.options.isAllowedUri(href, {\n\t\t\t\tdefaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),\n\t\t\t\tprotocols: this.options.protocols,\n\t\t\t\tdefaultProtocol: this.options.defaultProtocol\n\t\t\t}),\n\t\t\tfindPlainUrls\n\t\t})];\n\t\treturn [markPasteRule({\n\t\t\tfind: findPlainUrls,\n\t\t\ttype: this.type,\n\t\t\tgetAttributes: (match) => {\n\t\t\t\tvar _match$data;\n\t\t\t\treturn { href: (_match$data = match.data) === null || _match$data === void 0 ? void 0 : _match$data.href };\n\t\t\t}\n\t\t})];\n\t},\n\taddProseMirrorPlugins() {\n\t\tconst plugins = [];\n\t\tconst { protocols, defaultProtocol } = this.options;\n\t\tif (this.options.autolink) plugins.push(autolink({\n\t\t\ttype: this.type,\n\t\t\tdefaultProtocol: this.options.defaultProtocol,\n\t\t\tvalidate: (url) => this.options.isAllowedUri(url, {\n\t\t\t\tdefaultValidate: (href) => !!isAllowedUri(href, protocols),\n\t\t\t\tprotocols,\n\t\t\t\tdefaultProtocol\n\t\t\t}),\n\t\t\tshouldAutoLink: this.options.shouldAutoLink\n\t\t}));\n\t\tplugins.push(clickHandler({\n\t\t\ttype: this.type,\n\t\t\teditor: this.editor,\n\t\t\topenOnClick: this.options.openOnClick === \"whenNotEditable\" ? true : this.options.openOnClick,\n\t\t\tenableClickSelection: this.options.enableClickSelection\n\t\t}));\n\t\tif (this.options.linkOnPaste) plugins.push(pasteHandler({\n\t\t\teditor: this.editor,\n\t\t\tdefaultProtocol: this.options.defaultProtocol,\n\t\t\ttype: this.type,\n\t\t\tshouldAutoLink: this.options.shouldAutoLink\n\t\t}));\n\t\treturn plugins;\n\t}\n});\n//#endregion\n//#region src/index.ts\nvar src_default = Link;\n//#endregion\nexport { Link, src_default as default, isAllowedUri, pasteRegex };\n\n//# sourceMappingURL=index.js.map"],"ignoreList":[0],"mappings":";;;;;;AAMA,IAAMA,IAA6B,0BAC7BC,IAA2B,IAAI,OAAOD,CAA0B,GAChEE,IAAmC,OAAO,GAAGF,EAA2B,EAAE,GAC1EG,IAAwC,OAAO,GAAGH,EAA2B,GAAG,GAChFI,IAAkC,IAAI,OAAOJ,GAA4B,GAAG;AAGlF,SAASK,EAAyB,GAAI,GAAO,GAAM;CAElD,IAAMC,IA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