@docs.plus/extension-hyperlink 1.5.2 → 2.1.0
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/CHANGELOG.md +572 -0
- package/LICENSE +21 -0
- package/README.md +135 -385
- package/dist/index.cjs +22 -712
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +392 -0
- package/dist/index.d.ts +392 -9
- package/dist/index.js +22 -707
- package/dist/index.js.map +1 -1
- package/dist/styles.css +362 -0
- package/package.json +85 -33
- package/dist/helpers/autoHyperlink.d.ts +0 -8
- package/dist/helpers/clickHandler.d.ts +0 -11
- package/dist/helpers/editHyperlink.d.ts +0 -9
- package/dist/helpers/pasteHandler.d.ts +0 -9
- package/dist/helpers/tippyHelper.d.ts +0 -29
- package/dist/hyperlink.d.ts +0 -77
- package/dist/index.umd.js +0 -713
- package/dist/index.umd.js.map +0 -1
- package/dist/modals/editeHyperlink.d.ts +0 -11
- package/dist/modals/icons.d.ts +0 -9
- package/dist/modals/previewHyperlink.d.ts +0 -11
- package/dist/modals/setHyperlink.d.ts +0 -14
- package/src/helpers/autoHyperlink.ts +0 -167
- package/src/helpers/clickHandler.ts +0 -80
- package/src/helpers/editHyperlink.ts +0 -59
- package/src/helpers/pasteHandler.ts +0 -46
- package/src/helpers/tippyHelper.ts +0 -136
- package/src/hyperlink.ts +0 -277
- package/src/index.ts +0 -17
- package/src/modals/editeHyperlink.ts +0 -99
- package/src/modals/icons.ts +0 -46
- package/src/modals/previewHyperlink.ts +0 -85
- package/src/modals/setHyperlink.ts +0 -97
package/dist/styles.css
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prebuilt popover skin. Tokens are `--hl-*`; class names are public (see README).
|
|
3
|
+
* Theme with `light-dark()` against the nearest ancestor `color-scheme`.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* `light-dark()` follows the nearest ancestor `color-scheme`. When that is
|
|
8
|
+
* `normal`, it falls back to `prefers-color-scheme` so unopinionated hosts
|
|
9
|
+
* keep OS-driven dark mode.
|
|
10
|
+
*/
|
|
11
|
+
:root {
|
|
12
|
+
--hl-bg: light-dark(#ffffff, #1f2937);
|
|
13
|
+
--hl-fg: light-dark(#111827, #f3f4f6);
|
|
14
|
+
--hl-muted: light-dark(#6b7280, #9ca3af);
|
|
15
|
+
--hl-border: light-dark(#e5e7eb, #374151);
|
|
16
|
+
--hl-hover: light-dark(#f3f4f6, #374151);
|
|
17
|
+
--hl-accent: light-dark(#2563eb, #60a5fa);
|
|
18
|
+
--hl-accent-fg: light-dark(#ffffff, #0b1220);
|
|
19
|
+
--hl-danger: light-dark(#dc2626, #f87171);
|
|
20
|
+
/* Elevation matches the docs.plus floating-surface language: 10px shells with a
|
|
21
|
+
two-layer overlay shadow (anchored panels), 8px inner controls. */
|
|
22
|
+
--hl-shadow:
|
|
23
|
+
0 20px 25px -5px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5)),
|
|
24
|
+
0 8px 10px -6px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4));
|
|
25
|
+
--hl-radius: 10px;
|
|
26
|
+
--hl-radius-sm: 8px;
|
|
27
|
+
--hl-font:
|
|
28
|
+
ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
29
|
+
--hl-font-size: 14px;
|
|
30
|
+
/* Deceleration-only: popover hide removes the node, so this curve only ever plays entrances. */
|
|
31
|
+
--hl-transition: 120ms ease-out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Shared shell. Positioning is inline from createPopover (`zIndex` option). Lockstep copy in hypermultimedia media-toolbar.css. */
|
|
35
|
+
.floating-popover {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transform: scale(0.96);
|
|
38
|
+
/* exit: 80ms ease-in fade (plays when .visible is removed; engine defers removal) */
|
|
39
|
+
transition:
|
|
40
|
+
opacity 80ms ease-in,
|
|
41
|
+
transform 80ms ease-in;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
-webkit-tap-highlight-color: transparent;
|
|
44
|
+
will-change: transform, opacity;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.floating-popover.visible {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
transform: scale(1);
|
|
50
|
+
pointer-events: auto;
|
|
51
|
+
/* enter: 120ms ease-out scale from the anchored side (engine sets transform-origin) */
|
|
52
|
+
transition:
|
|
53
|
+
opacity 120ms ease-out,
|
|
54
|
+
transform 120ms ease-out;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
.floating-popover,
|
|
59
|
+
.floating-popover.visible {
|
|
60
|
+
transition: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.floating-popover-arrow {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 10px;
|
|
67
|
+
height: 10px;
|
|
68
|
+
background: var(--hl-bg);
|
|
69
|
+
transform: rotate(45deg);
|
|
70
|
+
pointer-events: none;
|
|
71
|
+
z-index: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.floating-popover-arrow-top {
|
|
75
|
+
border-right: 1px solid var(--hl-border);
|
|
76
|
+
border-bottom: 1px solid var(--hl-border);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.floating-popover-arrow-bottom {
|
|
80
|
+
border-top: 1px solid var(--hl-border);
|
|
81
|
+
border-left: 1px solid var(--hl-border);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.floating-popover-arrow-left {
|
|
85
|
+
border-top: 1px solid var(--hl-border);
|
|
86
|
+
border-right: 1px solid var(--hl-border);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.floating-popover-arrow-right {
|
|
90
|
+
border-bottom: 1px solid var(--hl-border);
|
|
91
|
+
border-left: 1px solid var(--hl-border);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.floating-popover-content {
|
|
95
|
+
position: relative;
|
|
96
|
+
z-index: 2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Tooltip skin. Lockstep literals with hypermultimedia media-toolbar.css — both style one global class. */
|
|
100
|
+
.floating-tooltip {
|
|
101
|
+
position: fixed;
|
|
102
|
+
z-index: 10000;
|
|
103
|
+
width: max-content;
|
|
104
|
+
padding: 3px 8px;
|
|
105
|
+
border-radius: 6px;
|
|
106
|
+
background: light-dark(#374151, #e5e7eb);
|
|
107
|
+
color: light-dark(#ffffff, #1f2937);
|
|
108
|
+
font-size: 11px;
|
|
109
|
+
box-shadow: 0 4px 12px light-dark(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
|
|
110
|
+
opacity: 0;
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
transform: translateY(2px);
|
|
113
|
+
transition:
|
|
114
|
+
opacity 100ms ease,
|
|
115
|
+
transform 100ms ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.floating-tooltip.visible {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
transform: translateY(0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.hyperlink-create-popover,
|
|
124
|
+
.hyperlink-preview-popover,
|
|
125
|
+
.hyperlink-edit-popover {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: 6px;
|
|
129
|
+
padding: 8px;
|
|
130
|
+
background: var(--hl-bg);
|
|
131
|
+
color: var(--hl-fg);
|
|
132
|
+
border: 1px solid var(--hl-border);
|
|
133
|
+
border-radius: var(--hl-radius);
|
|
134
|
+
box-shadow: var(--hl-shadow);
|
|
135
|
+
font-family: var(--hl-font);
|
|
136
|
+
font-size: var(--hl-font-size);
|
|
137
|
+
line-height: 1.4;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.hyperlink-create-popover form,
|
|
141
|
+
.hyperlink-edit-popover {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 8px;
|
|
145
|
+
margin: 0;
|
|
146
|
+
width: 100%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.hyperlink-create-popover .inputs-wrapper,
|
|
150
|
+
.hyperlink-edit-popover .text-wrapper,
|
|
151
|
+
.hyperlink-edit-popover .href-wrapper {
|
|
152
|
+
position: relative;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
gap: 6px;
|
|
156
|
+
width: 100%;
|
|
157
|
+
padding: 6px 8px;
|
|
158
|
+
background: var(--hl-bg);
|
|
159
|
+
border: 1px solid var(--hl-border);
|
|
160
|
+
border-radius: var(--hl-radius-sm);
|
|
161
|
+
transition:
|
|
162
|
+
border-color var(--hl-transition),
|
|
163
|
+
box-shadow var(--hl-transition);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.hyperlink-create-popover .inputs-wrapper:focus-within,
|
|
167
|
+
.hyperlink-edit-popover .text-wrapper:focus-within,
|
|
168
|
+
.hyperlink-edit-popover .href-wrapper:focus-within {
|
|
169
|
+
border-color: var(--hl-accent);
|
|
170
|
+
box-shadow: 0 0 0 1px var(--hl-accent);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.hyperlink-create-popover .inputs-wrapper.error,
|
|
174
|
+
.hyperlink-edit-popover .text-wrapper.error,
|
|
175
|
+
.hyperlink-edit-popover .href-wrapper.error {
|
|
176
|
+
border-color: var(--hl-danger);
|
|
177
|
+
box-shadow: 0 0 0 1px var(--hl-danger);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.hyperlink-create-popover .inputs-wrapper,
|
|
181
|
+
.hyperlink-edit-popover .text-wrapper,
|
|
182
|
+
.hyperlink-edit-popover .href-wrapper {
|
|
183
|
+
min-width: 0;
|
|
184
|
+
max-width: 100%;
|
|
185
|
+
box-sizing: border-box;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.hyperlink-create-popover input,
|
|
189
|
+
.hyperlink-edit-popover input {
|
|
190
|
+
flex: 1;
|
|
191
|
+
min-width: 0;
|
|
192
|
+
padding: 0;
|
|
193
|
+
border: none;
|
|
194
|
+
outline: none;
|
|
195
|
+
background: transparent;
|
|
196
|
+
color: inherit;
|
|
197
|
+
font: inherit;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.hyperlink-create-popover input::placeholder,
|
|
201
|
+
.hyperlink-edit-popover input::placeholder {
|
|
202
|
+
color: var(--hl-muted);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.hyperlink-create-popover .search-icon,
|
|
206
|
+
.hyperlink-edit-popover .search-icon {
|
|
207
|
+
display: flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
color: var(--hl-muted);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.hyperlink-create-popover .search-icon svg,
|
|
214
|
+
.hyperlink-edit-popover .search-icon svg {
|
|
215
|
+
width: 18px;
|
|
216
|
+
height: 18px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.hyperlink-create-popover .error-message,
|
|
220
|
+
.hyperlink-edit-popover .error-message {
|
|
221
|
+
position: absolute;
|
|
222
|
+
top: -8px;
|
|
223
|
+
left: 8px;
|
|
224
|
+
display: none;
|
|
225
|
+
padding: 0 4px;
|
|
226
|
+
background: var(--hl-bg);
|
|
227
|
+
color: var(--hl-danger);
|
|
228
|
+
font-size: 11px;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
border-radius: var(--hl-radius-sm);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.hyperlink-create-popover .error-message.show,
|
|
234
|
+
.hyperlink-edit-popover .error-message.show {
|
|
235
|
+
display: block;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.hyperlink-create-popover .inputs-wrapper {
|
|
239
|
+
width: auto;
|
|
240
|
+
flex: 1;
|
|
241
|
+
min-width: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.hyperlink-create-popover .buttons-wrapper,
|
|
245
|
+
.hyperlink-edit-popover .buttons-wrapper {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-shrink: 0;
|
|
248
|
+
gap: 4px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.hyperlink-create-popover button[type='submit'],
|
|
252
|
+
.hyperlink-edit-popover .back-button,
|
|
253
|
+
.hyperlink-edit-popover .apply-button {
|
|
254
|
+
padding: 6px 12px;
|
|
255
|
+
background: transparent;
|
|
256
|
+
color: var(--hl-fg);
|
|
257
|
+
border: none;
|
|
258
|
+
border-radius: var(--hl-radius-sm);
|
|
259
|
+
font: inherit;
|
|
260
|
+
font-weight: 600;
|
|
261
|
+
white-space: nowrap;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
transition:
|
|
264
|
+
background-color var(--hl-transition),
|
|
265
|
+
color var(--hl-transition);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.hyperlink-create-popover button[type='submit']:hover:not(:disabled),
|
|
269
|
+
.hyperlink-edit-popover .back-button:hover,
|
|
270
|
+
.hyperlink-edit-popover .apply-button:hover {
|
|
271
|
+
background: var(--hl-accent);
|
|
272
|
+
color: var(--hl-accent-fg);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.hyperlink-create-popover button[type='submit']:disabled {
|
|
276
|
+
color: var(--hl-muted);
|
|
277
|
+
cursor: not-allowed;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Keyboard-focus ring for popover buttons (inputs get theirs via :focus-within). */
|
|
281
|
+
.hyperlink-create-popover button:focus-visible,
|
|
282
|
+
.hyperlink-preview-popover button:focus-visible,
|
|
283
|
+
.hyperlink-edit-popover button:focus-visible {
|
|
284
|
+
outline: 2px solid var(--hl-accent);
|
|
285
|
+
outline-offset: 1px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.hyperlink-preview-popover a {
|
|
289
|
+
display: inline-block;
|
|
290
|
+
max-width: 260px;
|
|
291
|
+
overflow: hidden;
|
|
292
|
+
text-overflow: ellipsis;
|
|
293
|
+
white-space: nowrap;
|
|
294
|
+
padding: 2px 6px;
|
|
295
|
+
color: var(--hl-accent);
|
|
296
|
+
text-decoration: none;
|
|
297
|
+
font-weight: 500;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.hyperlink-preview-popover a:hover {
|
|
301
|
+
text-decoration: underline;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.hyperlink-preview-popover button {
|
|
305
|
+
display: flex;
|
|
306
|
+
align-items: center;
|
|
307
|
+
justify-content: center;
|
|
308
|
+
padding: 5px;
|
|
309
|
+
background: transparent;
|
|
310
|
+
border: none;
|
|
311
|
+
border-radius: var(--hl-radius-sm);
|
|
312
|
+
color: var(--hl-fg);
|
|
313
|
+
cursor: pointer;
|
|
314
|
+
transition: background-color var(--hl-transition);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.hyperlink-preview-popover button:hover {
|
|
318
|
+
background: var(--hl-hover);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.hyperlink-preview-popover button svg {
|
|
322
|
+
width: 18px;
|
|
323
|
+
height: 18px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.hyperlink-preview-popover .copy {
|
|
327
|
+
margin-left: auto;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.hyperlink-edit-popover {
|
|
331
|
+
align-items: stretch;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.hyperlink-edit-popover .inputs-wrapper {
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
gap: 6px;
|
|
338
|
+
flex: 1;
|
|
339
|
+
min-width: 0;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.hyperlink-edit-popover .buttons-wrapper {
|
|
343
|
+
display: flex;
|
|
344
|
+
flex-direction: column;
|
|
345
|
+
gap: 6px;
|
|
346
|
+
flex-shrink: 0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.hyperlink-edit-popover .back-button,
|
|
350
|
+
.hyperlink-edit-popover .apply-button {
|
|
351
|
+
flex: 1;
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
justify-content: center;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* Tooltip guard sits after the tooltip rules so it wins the cascade. The popover guard is at the top. */
|
|
358
|
+
@media (prefers-reduced-motion: reduce) {
|
|
359
|
+
.floating-tooltip {
|
|
360
|
+
transition: none;
|
|
361
|
+
}
|
|
362
|
+
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docs.plus/extension-hyperlink",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Tiptap extension for hyperlinks with built-in popovers, auto-linking, and 50+ URL scheme support",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"**/*.css"
|
|
24
|
+
],
|
|
5
25
|
"author": "Hossein Marzban",
|
|
6
|
-
"
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"homepage": "https://github.com/docs-plus/docs.plus/tree/main/extensions/extension-hyperlink#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/docs-plus/docs.plus/issues"
|
|
31
|
+
},
|
|
7
32
|
"repository": {
|
|
8
33
|
"type": "git",
|
|
9
34
|
"url": "https://github.com/docs-plus/docs.plus",
|
|
10
|
-
"directory": "
|
|
35
|
+
"directory": "extensions/extension-hyperlink"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "NODE_ENV=production bunx tsup",
|
|
39
|
+
"dev": "bunx tsup --watch",
|
|
40
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
41
|
+
"playground": "bun --hot docs-playground --entry ./test/playground/main.ts --port 5173",
|
|
42
|
+
"test:unit": "bun test src",
|
|
43
|
+
"test:unit:watch": "bun test --watch src",
|
|
44
|
+
"pretest": "bun run build",
|
|
45
|
+
"test": "bun run test:unit && bunx start-server-and-test playground http://127.0.0.1:5173 cypress:run",
|
|
46
|
+
"test:e2e": "bunx start-server-and-test playground http://127.0.0.1:5173 cypress:run",
|
|
47
|
+
"test:e2e:watch": "bunx start-server-and-test playground http://127.0.0.1:5173 cypress:open",
|
|
48
|
+
"cypress:run": "bunx cypress run",
|
|
49
|
+
"cypress:open": "bunx cypress open",
|
|
50
|
+
"docs:screenshots": "bun run build && bunx start-server-and-test playground http://127.0.0.1:5173 'bunx cypress run --config specPattern=cypress/docs/**/*.cy.ts'",
|
|
51
|
+
"docs:gif": "bun run build && bunx start-server-and-test playground http://127.0.0.1:5173 'bun cypress/docs/demo-gif.ts'",
|
|
52
|
+
"prepack": "bunx release-prepack",
|
|
53
|
+
"prepublishOnly": "bunx release-preflight"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist",
|
|
57
|
+
"CHANGELOG.md",
|
|
58
|
+
"LICENSE"
|
|
59
|
+
],
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
11
62
|
},
|
|
12
63
|
"keywords": [
|
|
13
64
|
"tiptap",
|
|
14
|
-
"tiptap
|
|
65
|
+
"tiptap-extension",
|
|
15
66
|
"hyperlink",
|
|
16
67
|
"link",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
68
|
+
"autolink",
|
|
69
|
+
"link-preview",
|
|
70
|
+
"rich-text-editor",
|
|
71
|
+
"floating-ui",
|
|
72
|
+
"url-validation",
|
|
73
|
+
"prosemirror",
|
|
74
|
+
"docs.plus"
|
|
19
75
|
],
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.js",
|
|
24
|
-
"require": "./dist/index.cjs"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"type": "module",
|
|
28
|
-
"main": "dist/index.cjs",
|
|
29
|
-
"module": "dist/index.js",
|
|
30
|
-
"umd": "dist/index.umd.js",
|
|
31
|
-
"types": "dist/index.d.ts",
|
|
32
|
-
"files": [
|
|
33
|
-
"src",
|
|
34
|
-
"dist"
|
|
35
|
-
],
|
|
36
|
-
"scripts": {
|
|
37
|
-
"clean": "rm -rf dist",
|
|
38
|
-
"build": "npm run clean && rollup -c",
|
|
39
|
-
"ts": "tsc -p tsconfig.json"
|
|
40
|
-
},
|
|
41
|
-
"license": "MIT",
|
|
42
76
|
"dependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
77
|
+
"@floating-ui/dom": "^1.8.0",
|
|
78
|
+
"linkifyjs": "^4.3.3"
|
|
45
79
|
},
|
|
46
80
|
"peerDependencies": {
|
|
47
|
-
"@tiptap/core": "^
|
|
48
|
-
"@tiptap/pm": "^
|
|
81
|
+
"@tiptap/core": "^3.31.3",
|
|
82
|
+
"@tiptap/pm": "^3.31.3"
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@docs.plus/floating-popover": "0.0.0",
|
|
86
|
+
"@docs.plus/floating-tooltip": "0.0.0",
|
|
87
|
+
"@docs.plus/playground": "0.0.0",
|
|
88
|
+
"@docs.plus/release-tooling": "0.1.0",
|
|
89
|
+
"@tiptap/core": "^3.31.3",
|
|
90
|
+
"@tiptap/markdown": "^3.31.3",
|
|
91
|
+
"@tiptap/pm": "^3.31.3",
|
|
92
|
+
"@tiptap/starter-kit": "^3.31.3",
|
|
93
|
+
"@types/node": "^25.9.5",
|
|
94
|
+
"bun-types": "^1.4.2",
|
|
95
|
+
"cypress": "^15.21.1",
|
|
96
|
+
"cypress-real-events": "^1.15.0",
|
|
97
|
+
"eslint": "^9.39.5",
|
|
98
|
+
"start-server-and-test": "^2.1.5",
|
|
99
|
+
"tsup": "^8.5.1",
|
|
100
|
+
"typescript": "^5.9.3"
|
|
49
101
|
}
|
|
50
102
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MarkType } from "@tiptap/pm/model";
|
|
2
|
-
import { Plugin } from "@tiptap/pm/state";
|
|
3
|
-
type AutoHyperlinkOptions = {
|
|
4
|
-
type: MarkType;
|
|
5
|
-
validate?: (url: string) => boolean;
|
|
6
|
-
};
|
|
7
|
-
export default function autoHyperlink(options: AutoHyperlinkOptions): Plugin;
|
|
8
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MarkType } from "@tiptap/pm/model";
|
|
2
|
-
import { Plugin } from "@tiptap/pm/state";
|
|
3
|
-
import { Editor } from "@tiptap/core";
|
|
4
|
-
type ClickHandlerOptions = {
|
|
5
|
-
type: MarkType;
|
|
6
|
-
editor: Editor;
|
|
7
|
-
validate?: (url: string) => boolean;
|
|
8
|
-
modal?: ((options: any) => void | HTMLElement) | null;
|
|
9
|
-
};
|
|
10
|
-
export default function clickHandler(options: ClickHandlerOptions): Plugin;
|
|
11
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Editor } from "@tiptap/core";
|
|
2
|
-
type EditHyperlinkOptions = {
|
|
3
|
-
editor: Editor;
|
|
4
|
-
validate?: (url: string) => boolean;
|
|
5
|
-
newURL?: string;
|
|
6
|
-
newText?: string;
|
|
7
|
-
};
|
|
8
|
-
export default function editHyperlink(options: EditHyperlinkOptions): boolean;
|
|
9
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Editor } from "@tiptap/core";
|
|
2
|
-
import { MarkType } from "@tiptap/pm/model";
|
|
3
|
-
import { Plugin } from "@tiptap/pm/state";
|
|
4
|
-
type PasteHandlerOptions = {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
type: MarkType;
|
|
7
|
-
};
|
|
8
|
-
export declare function pasteHandler(options: PasteHandlerOptions): Plugin;
|
|
9
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Instance, Props } from "tippy.js";
|
|
2
|
-
import { Editor } from "@tiptap/core";
|
|
3
|
-
import { EditorView } from "@tiptap/pm/view";
|
|
4
|
-
export interface TippyInitOptions {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
validate?: (url: string) => boolean;
|
|
7
|
-
}
|
|
8
|
-
declare class Tooltip {
|
|
9
|
-
private tippyInstance?;
|
|
10
|
-
private preventHide;
|
|
11
|
-
private tippyWrapper;
|
|
12
|
-
private editor;
|
|
13
|
-
private view;
|
|
14
|
-
constructor(options: TippyInitOptions);
|
|
15
|
-
init(): {
|
|
16
|
-
tippyModal: HTMLDivElement;
|
|
17
|
-
tippyInstance: Instance<Props> | undefined;
|
|
18
|
-
};
|
|
19
|
-
show(): boolean;
|
|
20
|
-
hide(): boolean;
|
|
21
|
-
private mousedownHandler;
|
|
22
|
-
private dragstartHandler;
|
|
23
|
-
private blurHandler;
|
|
24
|
-
private tippyBlurHandler;
|
|
25
|
-
private createTooltip;
|
|
26
|
-
update(view: EditorView, option?: any): {};
|
|
27
|
-
destroyTooltip(): void;
|
|
28
|
-
}
|
|
29
|
-
export default Tooltip;
|
package/dist/hyperlink.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Mark } from "@tiptap/core";
|
|
2
|
-
import { TSetHyperlinkModalOptions } from "./modals/setHyperlink";
|
|
3
|
-
import { THyperlinkPreviewModalOptions } from "./modals/previewHyperlink";
|
|
4
|
-
export interface LinkProtocolOptions {
|
|
5
|
-
scheme: string;
|
|
6
|
-
optionalSlashes?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface HyperlinkOptions {
|
|
9
|
-
/**
|
|
10
|
-
* If enabled, it adds links as you type.
|
|
11
|
-
*/
|
|
12
|
-
autoHyperlink: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* An array of custom protocols to be registered with linkifyjs.
|
|
15
|
-
*/
|
|
16
|
-
protocols: Array<LinkProtocolOptions | string>;
|
|
17
|
-
/**
|
|
18
|
-
* If enabled, links will be opened on click.
|
|
19
|
-
*/
|
|
20
|
-
openOnClick: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Adds a link to the current selection if the pasted content only contains an url.
|
|
23
|
-
*/
|
|
24
|
-
hyperlinkOnPaste: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* A list of HTML attributes to be rendered.
|
|
27
|
-
*/
|
|
28
|
-
HTMLAttributes: Record<string, any>;
|
|
29
|
-
/**
|
|
30
|
-
* A list of modals to be rendered.
|
|
31
|
-
* @default null
|
|
32
|
-
* @example
|
|
33
|
-
*/
|
|
34
|
-
modals: {
|
|
35
|
-
previewHyperlink?: ((options: THyperlinkPreviewModalOptions) => void | HTMLElement) | null;
|
|
36
|
-
setHyperlink?: ((options: TSetHyperlinkModalOptions) => void | HTMLElement) | null;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* A validation function that modifies link verification for the auto linker.
|
|
40
|
-
* @param url - The url to be validated.
|
|
41
|
-
* @returns - True if the url is valid, false otherwise.
|
|
42
|
-
*/
|
|
43
|
-
validate?: (url: string) => boolean;
|
|
44
|
-
}
|
|
45
|
-
declare module "@tiptap/core" {
|
|
46
|
-
interface Commands<ReturnType> {
|
|
47
|
-
link: {
|
|
48
|
-
/**
|
|
49
|
-
* Edit the hyperlink's text
|
|
50
|
-
*/
|
|
51
|
-
editHyperLinkText: (text: string) => ReturnType;
|
|
52
|
-
/**
|
|
53
|
-
* Edit the hyperlink's href value
|
|
54
|
-
*/
|
|
55
|
-
editHyperLinkHref: (href: string) => ReturnType;
|
|
56
|
-
/**
|
|
57
|
-
* Edit the hyperlink's
|
|
58
|
-
*/
|
|
59
|
-
editHyperlink: (attributes?: {
|
|
60
|
-
newText?: string;
|
|
61
|
-
newURL?: string;
|
|
62
|
-
}) => ReturnType;
|
|
63
|
-
/**
|
|
64
|
-
* Set a hyperlink
|
|
65
|
-
*/
|
|
66
|
-
setHyperlink: (attributes?: {
|
|
67
|
-
href: string;
|
|
68
|
-
target?: string | null;
|
|
69
|
-
}) => ReturnType;
|
|
70
|
-
/**
|
|
71
|
-
* Unset a link mark
|
|
72
|
-
*/
|
|
73
|
-
unsetHyperlink: () => ReturnType;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export declare const Hyperlink: Mark<HyperlinkOptions, any>;
|