@docs.plus/extension-hyperlink 1.5.1 → 2.0.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.
@@ -0,0 +1,403 @@
1
+ /**
2
+ * @docs.plus/extension-hyperlink — default styles
3
+ *
4
+ * A minimal, framework-agnostic stylesheet for the prebuilt create/preview/edit
5
+ * popovers. Every visual token is exposed as a `--hl-*` CSS custom property so
6
+ * consumers can retheme without copy-pasting rules.
7
+ *
8
+ * Usage:
9
+ * import '@docs.plus/extension-hyperlink/styles.css'
10
+ *
11
+ * Theming:
12
+ * :root {
13
+ * --hl-accent: #2563eb;
14
+ * --hl-radius: 8px;
15
+ * }
16
+ *
17
+ * Customizing a specific rule is fine — class names are part of the public API
18
+ * and are documented in the README.
19
+ */
20
+
21
+ /*
22
+ * Theme tokens use `light-dark()` so the popover follows the nearest
23
+ * ancestor's `color-scheme` — that means a consumer who toggles
24
+ * `color-scheme: light | dark` on <html> (or an ancestor) flips the
25
+ * popover automatically, and it no longer gets stuck in dark mode just
26
+ * because the OS prefers dark. When `color-scheme` is `normal` (the
27
+ * default), `light-dark()` falls back to `prefers-color-scheme`, which
28
+ * preserves the previous OS-driven behavior for unopinionated hosts.
29
+ */
30
+ :root {
31
+ --hl-bg: light-dark(#ffffff, #1f2937);
32
+ --hl-fg: light-dark(#111827, #f3f4f6);
33
+ --hl-muted: light-dark(#6b7280, #9ca3af);
34
+ --hl-border: light-dark(#e5e7eb, #374151);
35
+ --hl-hover: light-dark(#f3f4f6, #374151);
36
+ --hl-accent: light-dark(#2563eb, #60a5fa);
37
+ --hl-accent-fg: light-dark(#ffffff, #0b1220);
38
+ --hl-danger: light-dark(#dc2626, #f87171);
39
+ /* Elevation matches the docs.plus floating-surface language: 10px shells with a
40
+ two-layer overlay shadow (anchored panels), 8px inner controls. */
41
+ --hl-shadow:
42
+ 0 20px 25px -5px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5)),
43
+ 0 8px 10px -6px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4));
44
+ --hl-radius: 10px;
45
+ --hl-radius-sm: 8px;
46
+ --hl-font:
47
+ ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
48
+ --hl-font-size: 14px;
49
+ /* Deceleration-only: popover hide removes the node, so this curve only ever plays entrances. */
50
+ --hl-transition: 120ms ease-out;
51
+ }
52
+
53
+ /* -------------------------------------------------------------------------
54
+ Floating popover shell (shared by all three popovers — preview / edit / create)
55
+ Positioning (fixed + top/left + z-index 9999) is inline from createPopover;
56
+ override stacking via `createPopover({ zIndex })`.
57
+ extension-hypermultimedia's media-toolbar.css carries a lockstep copy of
58
+ this shell — mirror edits there.
59
+ ------------------------------------------------------------------------- */
60
+ .floating-popover {
61
+ opacity: 0;
62
+ transform: scale(0.96);
63
+ /* exit: 80ms ease-in fade (plays when .visible is removed; engine defers removal) */
64
+ transition:
65
+ opacity 80ms ease-in,
66
+ transform 80ms ease-in;
67
+ pointer-events: none;
68
+ -webkit-tap-highlight-color: transparent;
69
+ will-change: transform, opacity;
70
+ }
71
+
72
+ .floating-popover.visible {
73
+ opacity: 1;
74
+ transform: scale(1);
75
+ pointer-events: auto;
76
+ /* enter: 120ms ease-out scale from the anchored side (engine sets transform-origin) */
77
+ transition:
78
+ opacity 120ms ease-out,
79
+ transform 120ms ease-out;
80
+ }
81
+
82
+ @media (prefers-reduced-motion: reduce) {
83
+ .floating-popover,
84
+ .floating-popover.visible {
85
+ transition: none;
86
+ }
87
+ }
88
+
89
+ .floating-popover-arrow {
90
+ position: absolute;
91
+ width: 10px;
92
+ height: 10px;
93
+ background: var(--hl-bg);
94
+ transform: rotate(45deg);
95
+ pointer-events: none;
96
+ z-index: 1;
97
+ }
98
+
99
+ .floating-popover-arrow-top {
100
+ border-right: 1px solid var(--hl-border);
101
+ border-bottom: 1px solid var(--hl-border);
102
+ }
103
+
104
+ .floating-popover-arrow-bottom {
105
+ border-top: 1px solid var(--hl-border);
106
+ border-left: 1px solid var(--hl-border);
107
+ }
108
+
109
+ .floating-popover-arrow-left {
110
+ border-top: 1px solid var(--hl-border);
111
+ border-right: 1px solid var(--hl-border);
112
+ }
113
+
114
+ .floating-popover-arrow-right {
115
+ border-bottom: 1px solid var(--hl-border);
116
+ border-left: 1px solid var(--hl-border);
117
+ }
118
+
119
+ .floating-popover-content {
120
+ position: relative;
121
+ z-index: 2;
122
+ }
123
+
124
+ /* -------------------------------------------------------------------------
125
+ Floating tooltip (icon buttons in the prebuilt popovers)
126
+ Behavior ships in the bundled @docs.plus/floating-tooltip; this skin is
127
+ the consumer's, lockstep with extension-hypermultimedia's media-toolbar.css.
128
+ Both extensions style this one global class, so the block uses identical
129
+ literals, never per-package tokens: with both bundles loaded, cascade
130
+ order would pick one package's tokens for every bubble.
131
+ ------------------------------------------------------------------------- */
132
+ .floating-tooltip {
133
+ position: fixed;
134
+ z-index: 10000;
135
+ width: max-content;
136
+ padding: 3px 8px;
137
+ border-radius: 6px;
138
+ background: light-dark(#374151, #e5e7eb);
139
+ color: light-dark(#ffffff, #1f2937);
140
+ font-size: 11px;
141
+ box-shadow: 0 4px 12px light-dark(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
142
+ opacity: 0;
143
+ pointer-events: none;
144
+ transform: translateY(2px);
145
+ transition:
146
+ opacity 100ms ease,
147
+ transform 100ms ease;
148
+ }
149
+
150
+ .floating-tooltip.visible {
151
+ opacity: 1;
152
+ transform: translateY(0);
153
+ }
154
+
155
+ /* -------------------------------------------------------------------------
156
+ Popover shell — shared shape for create / preview / edit
157
+ ------------------------------------------------------------------------- */
158
+ .hyperlink-create-popover,
159
+ .hyperlink-preview-popover,
160
+ .hyperlink-edit-popover {
161
+ display: flex;
162
+ align-items: center;
163
+ gap: 6px;
164
+ padding: 8px;
165
+ background: var(--hl-bg);
166
+ color: var(--hl-fg);
167
+ border: 1px solid var(--hl-border);
168
+ border-radius: var(--hl-radius);
169
+ box-shadow: var(--hl-shadow);
170
+ font-family: var(--hl-font);
171
+ font-size: var(--hl-font-size);
172
+ line-height: 1.4;
173
+ }
174
+
175
+ .hyperlink-create-popover form,
176
+ .hyperlink-edit-popover {
177
+ display: flex;
178
+ align-items: center;
179
+ gap: 8px;
180
+ margin: 0;
181
+ width: 100%;
182
+ }
183
+
184
+ /* Input groups (create + edit) */
185
+ .hyperlink-create-popover .inputs-wrapper,
186
+ .hyperlink-edit-popover .text-wrapper,
187
+ .hyperlink-edit-popover .href-wrapper {
188
+ position: relative;
189
+ display: flex;
190
+ align-items: center;
191
+ gap: 6px;
192
+ width: 100%;
193
+ padding: 6px 8px;
194
+ background: var(--hl-bg);
195
+ border: 1px solid var(--hl-border);
196
+ border-radius: var(--hl-radius-sm);
197
+ transition:
198
+ border-color var(--hl-transition),
199
+ box-shadow var(--hl-transition);
200
+ }
201
+
202
+ .hyperlink-create-popover .inputs-wrapper:focus-within,
203
+ .hyperlink-edit-popover .text-wrapper:focus-within,
204
+ .hyperlink-edit-popover .href-wrapper:focus-within {
205
+ border-color: var(--hl-accent);
206
+ box-shadow: 0 0 0 1px var(--hl-accent);
207
+ }
208
+
209
+ .hyperlink-create-popover .inputs-wrapper.error,
210
+ .hyperlink-edit-popover .text-wrapper.error,
211
+ .hyperlink-edit-popover .href-wrapper.error {
212
+ border-color: var(--hl-danger);
213
+ box-shadow: 0 0 0 1px var(--hl-danger);
214
+ }
215
+
216
+ .hyperlink-create-popover .inputs-wrapper,
217
+ .hyperlink-edit-popover .text-wrapper,
218
+ .hyperlink-edit-popover .href-wrapper {
219
+ min-width: 0;
220
+ max-width: 100%;
221
+ box-sizing: border-box;
222
+ }
223
+
224
+ .hyperlink-create-popover input,
225
+ .hyperlink-edit-popover input {
226
+ flex: 1;
227
+ min-width: 0;
228
+ padding: 0;
229
+ border: none;
230
+ outline: none;
231
+ background: transparent;
232
+ color: inherit;
233
+ font: inherit;
234
+ }
235
+
236
+ .hyperlink-create-popover input::placeholder,
237
+ .hyperlink-edit-popover input::placeholder {
238
+ color: var(--hl-muted);
239
+ }
240
+
241
+ .hyperlink-create-popover .search-icon,
242
+ .hyperlink-edit-popover .search-icon {
243
+ display: flex;
244
+ align-items: center;
245
+ flex-shrink: 0;
246
+ color: var(--hl-muted);
247
+ }
248
+
249
+ .hyperlink-create-popover .search-icon svg,
250
+ .hyperlink-edit-popover .search-icon svg {
251
+ width: 18px;
252
+ height: 18px;
253
+ }
254
+
255
+ .hyperlink-create-popover .error-message,
256
+ .hyperlink-edit-popover .error-message {
257
+ position: absolute;
258
+ top: -8px;
259
+ left: 8px;
260
+ display: none;
261
+ padding: 0 4px;
262
+ background: var(--hl-bg);
263
+ color: var(--hl-danger);
264
+ font-size: 11px;
265
+ font-weight: 600;
266
+ border-radius: var(--hl-radius-sm);
267
+ }
268
+
269
+ .hyperlink-create-popover .error-message.show,
270
+ .hyperlink-edit-popover .error-message.show {
271
+ display: block;
272
+ }
273
+
274
+ .hyperlink-create-popover .inputs-wrapper {
275
+ width: auto;
276
+ flex: 1;
277
+ min-width: 0;
278
+ }
279
+
280
+ /* Action buttons (create submit + edit back/apply) */
281
+ .hyperlink-create-popover .buttons-wrapper,
282
+ .hyperlink-edit-popover .buttons-wrapper {
283
+ display: flex;
284
+ flex-shrink: 0;
285
+ gap: 4px;
286
+ }
287
+
288
+ .hyperlink-create-popover button[type='submit'],
289
+ .hyperlink-edit-popover .back-button,
290
+ .hyperlink-edit-popover .apply-button {
291
+ padding: 6px 12px;
292
+ background: transparent;
293
+ color: var(--hl-fg);
294
+ border: none;
295
+ border-radius: var(--hl-radius-sm);
296
+ font: inherit;
297
+ font-weight: 600;
298
+ white-space: nowrap;
299
+ cursor: pointer;
300
+ transition:
301
+ background-color var(--hl-transition),
302
+ color var(--hl-transition);
303
+ }
304
+
305
+ .hyperlink-create-popover button[type='submit']:hover:not(:disabled),
306
+ .hyperlink-edit-popover .back-button:hover,
307
+ .hyperlink-edit-popover .apply-button:hover {
308
+ background: var(--hl-accent);
309
+ color: var(--hl-accent-fg);
310
+ }
311
+
312
+ .hyperlink-create-popover button[type='submit']:disabled {
313
+ color: var(--hl-muted);
314
+ cursor: not-allowed;
315
+ }
316
+
317
+ /* Keyboard-focus ring for popover buttons (inputs get theirs via :focus-within). */
318
+ .hyperlink-create-popover button:focus-visible,
319
+ .hyperlink-preview-popover button:focus-visible,
320
+ .hyperlink-edit-popover button:focus-visible {
321
+ outline: 2px solid var(--hl-accent);
322
+ outline-offset: 1px;
323
+ }
324
+
325
+ /* -------------------------------------------------------------------------
326
+ Preview popover (anchor + copy / edit / remove icon buttons)
327
+ ------------------------------------------------------------------------- */
328
+ .hyperlink-preview-popover a {
329
+ display: inline-block;
330
+ max-width: 260px;
331
+ overflow: hidden;
332
+ text-overflow: ellipsis;
333
+ white-space: nowrap;
334
+ padding: 2px 6px;
335
+ color: var(--hl-accent);
336
+ text-decoration: none;
337
+ font-weight: 500;
338
+ }
339
+
340
+ .hyperlink-preview-popover a:hover {
341
+ text-decoration: underline;
342
+ }
343
+
344
+ .hyperlink-preview-popover button {
345
+ display: flex;
346
+ align-items: center;
347
+ justify-content: center;
348
+ padding: 5px;
349
+ background: transparent;
350
+ border: none;
351
+ border-radius: var(--hl-radius-sm);
352
+ color: var(--hl-fg);
353
+ cursor: pointer;
354
+ transition: background-color var(--hl-transition);
355
+ }
356
+
357
+ .hyperlink-preview-popover button:hover {
358
+ background: var(--hl-hover);
359
+ }
360
+
361
+ .hyperlink-preview-popover button svg {
362
+ width: 18px;
363
+ height: 18px;
364
+ }
365
+
366
+ .hyperlink-preview-popover .copy {
367
+ margin-left: auto;
368
+ }
369
+
370
+ .hyperlink-edit-popover {
371
+ align-items: stretch;
372
+ }
373
+
374
+ .hyperlink-edit-popover .inputs-wrapper {
375
+ display: flex;
376
+ flex-direction: column;
377
+ gap: 6px;
378
+ flex: 1;
379
+ min-width: 0;
380
+ }
381
+
382
+ .hyperlink-edit-popover .buttons-wrapper {
383
+ display: flex;
384
+ flex-direction: column;
385
+ gap: 6px;
386
+ flex-shrink: 0;
387
+ }
388
+
389
+ .hyperlink-edit-popover .back-button,
390
+ .hyperlink-edit-popover .apply-button {
391
+ flex: 1;
392
+ display: flex;
393
+ align-items: center;
394
+ justify-content: center;
395
+ }
396
+
397
+ /* Matches extension-hypermultimedia's reduced-motion guard for the shared surfaces. */
398
+ @media (prefers-reduced-motion: reduce) {
399
+ .floating-popover,
400
+ .floating-tooltip {
401
+ transition: none;
402
+ }
403
+ }
package/package.json CHANGED
@@ -1,50 +1,100 @@
1
1
  {
2
2
  "name": "@docs.plus/extension-hyperlink",
3
- "description": "Hyperlink component for docs.plus",
4
- "version": "1.5.1",
3
+ "version": "2.0.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
- "homepage": "https://github.com/HMarzban/extension-hyperlink",
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": "packages/extension-hyperlink"
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
+ "prepack": "bunx release-prepack",
52
+ "prepublishOnly": "bunx release-preflight"
53
+ },
54
+ "files": [
55
+ "dist",
56
+ "CHANGELOG.md",
57
+ "LICENSE"
58
+ ],
59
+ "publishConfig": {
60
+ "access": "public"
11
61
  },
12
62
  "keywords": [
13
63
  "tiptap",
14
64
  "tiptap extension",
15
65
  "hyperlink",
16
66
  "link",
17
- "docs.plus",
18
- "prosemirror"
67
+ "autolink",
68
+ "rich-text-editor",
69
+ "floating-ui",
70
+ "url-validation",
71
+ "prosemirror",
72
+ "docs.plus"
19
73
  ],
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
74
  "dependencies": {
43
- "linkifyjs": "^4.1.1",
44
- "tippy.js": "^6.3.7"
75
+ "@floating-ui/dom": "^1.7.6",
76
+ "linkifyjs": "^4.3.3"
45
77
  },
46
78
  "peerDependencies": {
47
- "@tiptap/core": "^2.0.3",
48
- "@tiptap/pm": "^2.0.3"
79
+ "@tiptap/core": "^3.22.3",
80
+ "@tiptap/pm": "^3.22.3"
81
+ },
82
+ "devDependencies": {
83
+ "@docs.plus/floating-popover": "0.0.0",
84
+ "@docs.plus/floating-tooltip": "0.0.0",
85
+ "@docs.plus/playground": "0.0.0",
86
+ "@docs.plus/release-tooling": "0.1.0",
87
+ "@tiptap/core": "^3.22.3",
88
+ "@tiptap/markdown": "^3.22.3",
89
+ "@tiptap/pm": "^3.22.3",
90
+ "@tiptap/starter-kit": "^3.22.3",
91
+ "@types/node": "^25.5.2",
92
+ "bun-types": "^1.3.13",
93
+ "cypress": "^15.13.1",
94
+ "cypress-real-events": "^1.15.0",
95
+ "eslint": "^9.39.4",
96
+ "start-server-and-test": "^2.1.0",
97
+ "tsup": "^8.5.1",
98
+ "typescript": "^5.9.3"
49
99
  }
50
100
  }
@@ -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;
@@ -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>;