@docs.plus/extension-hyperlink 1.1.0 → 1.2.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/index.js CHANGED
@@ -101,121 +101,112 @@ function autoHyperlink(options) {
101
101
  });
102
102
  }
103
103
 
104
- let tippyInstance;
105
- let preventHide = false;
106
- let tippyWrapper;
107
- let editor;
108
- let view;
109
- const init = (options) => {
110
- editor = options.editor;
111
- view = options.view;
112
- if (!tippyInstance) {
113
- tippyWrapper = document.createElement("div");
114
- tippyWrapper.addEventListener("mousedown", mousedownHandler, {
104
+ class Tooltip {
105
+ constructor(options) {
106
+ this.preventHide = false;
107
+ this.mousedownHandler = () => {
108
+ this.preventHide = true;
109
+ };
110
+ this.dragstartHandler = () => {
111
+ this.hide();
112
+ };
113
+ this.blurHandler = ({ event }) => {
114
+ var _a;
115
+ if (this.preventHide) {
116
+ this.preventHide = false;
117
+ return;
118
+ }
119
+ if ((event === null || event === void 0 ? void 0 : event.relatedTarget) &&
120
+ ((_a = this.tippyWrapper.parentNode) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))) {
121
+ return;
122
+ }
123
+ this.hide();
124
+ };
125
+ this.tippyBlurHandler = (event) => {
126
+ this.blurHandler({ event });
127
+ };
128
+ this.editor = options.editor;
129
+ this.view = options.view;
130
+ this.tippyWrapper = document.createElement("div");
131
+ this.tippyWrapper.addEventListener("mousedown", this.mousedownHandler, {
115
132
  capture: true,
116
133
  });
117
- view.dom.addEventListener("dragstart", dragstartHandler);
118
- editor.on("focus", focusHandler);
119
- editor.on("blur", blurHandler);
134
+ this.view.dom.addEventListener("dragstart", this.dragstartHandler);
135
+ this.editor.on("blur", this.blurHandler);
120
136
  }
121
- return { tippyModal: tippyWrapper, tippyInstance: tippyInstance };
122
- };
123
- const show = () => {
124
- tippyInstance === null || tippyInstance === void 0 ? void 0 : tippyInstance.show();
125
- return true;
126
- };
127
- const hide = () => {
128
- setTimeout(() => tippyInstance === null || tippyInstance === void 0 ? void 0 : tippyInstance.hide());
129
- return false;
130
- };
131
- const mousedownHandler = () => {
132
- preventHide = true;
133
- };
134
- const dragstartHandler = () => {
135
- hide();
136
- };
137
- const focusHandler = () => {
138
- setTimeout(() => update(editor.view));
139
- };
140
- const blurHandler = ({ event }) => {
141
- var _a;
142
- if (preventHide) {
143
- preventHide = false;
144
- return;
137
+ init() {
138
+ this.tippyWrapper.innerHTML = "";
139
+ return { tippyModal: this.tippyWrapper, tippyInstance: this.tippyInstance };
145
140
  }
146
- if ((event === null || event === void 0 ? void 0 : event.relatedTarget) && ((_a = tippyWrapper.parentNode) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))) {
147
- return;
141
+ show() {
142
+ var _a;
143
+ (_a = this.tippyInstance) === null || _a === void 0 ? void 0 : _a.show();
144
+ return true;
148
145
  }
149
- hide();
150
- };
151
- const tippyBlurHandler = (event) => {
152
- blurHandler({ event });
153
- };
154
- const createTooltip = () => {
155
- if (!editor || !editor.options)
156
- return;
157
- const { element: editorElement } = editor.options;
158
- const editorIsAttached = !!editorElement.parentElement;
159
- if (tippyInstance || !editorIsAttached) {
160
- return;
146
+ hide() {
147
+ setTimeout(() => { var _a; return (_a = this.tippyInstance) === null || _a === void 0 ? void 0 : _a.hide(); });
148
+ return false;
161
149
  }
162
- tippyInstance = tippy(editorElement, {
163
- duration: 0,
164
- getReferenceClientRect: null,
165
- content: tippyWrapper,
166
- interactive: true,
167
- trigger: "manual",
168
- placement: "bottom",
169
- hideOnClick: "toggle",
170
- });
171
- if (tippyInstance.popper.firstChild) {
172
- tippyInstance.popper.firstChild.addEventListener("blur", tippyBlurHandler);
173
- }
174
- };
175
- const update = (view, option = {}) => {
176
- var _a;
177
- createTooltip();
178
- // Ensure 'arrow' is false when not provided
179
- option.arrow = (_a = option === null || option === void 0 ? void 0 : option.arrow) !== null && _a !== void 0 ? _a : false;
180
- if (tippyInstance) {
181
- tippyInstance.setProps({
182
- ...option,
183
- getReferenceClientRect: () => {
184
- const pos = view.state.selection.from;
185
- return posToDOMRect(view, pos, pos);
150
+ createTooltip() {
151
+ if (!this.editor || !this.editor.options)
152
+ return;
153
+ const { element: editorElement } = this.editor.options;
154
+ const editorIsAttached = !!editorElement.parentElement;
155
+ if (this.tippyInstance || !editorIsAttached) {
156
+ return;
157
+ }
158
+ this.tippyInstance = tippy(editorElement, {
159
+ duration: 0,
160
+ getReferenceClientRect: null,
161
+ content: this.tippyWrapper,
162
+ interactive: true,
163
+ trigger: "manual",
164
+ placement: "bottom",
165
+ hideOnClick: "toggle",
166
+ onClickOutside: (instance, event) => {
167
+ this.hide();
168
+ },
169
+ onAfterUpdate: (instance, partialProps) => {
170
+ this.show();
186
171
  },
187
172
  });
188
- show();
173
+ if (this.tippyInstance.popper.firstChild) {
174
+ this.tippyInstance.popper.firstChild.addEventListener("blur", this.tippyBlurHandler);
175
+ }
189
176
  }
190
- return {};
191
- };
192
- const destroyTooltip = () => {
193
- if (tippyInstance) {
194
- tippyInstance.destroy();
195
- tippyInstance = undefined;
196
- tippyWrapper.removeEventListener("mousedown", mousedownHandler, {
197
- capture: true,
198
- });
199
- view.dom.removeEventListener("dragstart", dragstartHandler);
200
- editor.off("focus", focusHandler);
201
- editor.off("blur", blurHandler);
177
+ update(view, option = {}) {
178
+ var _a;
179
+ this.createTooltip();
180
+ option.arrow = (_a = option === null || option === void 0 ? void 0 : option.arrow) !== null && _a !== void 0 ? _a : false;
181
+ if (this.tippyInstance) {
182
+ this.tippyInstance.setProps({
183
+ ...option,
184
+ getReferenceClientRect: () => {
185
+ const pos = view.state.selection.from;
186
+ return posToDOMRect(view, pos, pos);
187
+ },
188
+ });
189
+ }
190
+ return {};
202
191
  }
203
- };
204
-
205
- var tippyHelper = /*#__PURE__*/Object.freeze({
206
- __proto__: null,
207
- destroyTooltip: destroyTooltip,
208
- dragstartHandler: dragstartHandler,
209
- focusHandler: focusHandler,
210
- hide: hide,
211
- init: init,
212
- mousedownHandler: mousedownHandler,
213
- show: show,
214
- update: update
215
- });
192
+ destroyTooltip() {
193
+ if (this.tippyInstance) {
194
+ this.tippyInstance.destroy();
195
+ this.tippyInstance = undefined;
196
+ this.tippyWrapper.removeEventListener("mousedown", this.mousedownHandler, {
197
+ capture: true,
198
+ });
199
+ this.view.dom.removeEventListener("dragstart", this.dragstartHandler);
200
+ this.editor.off("blur", this.blurHandler);
201
+ }
202
+ }
203
+ }
216
204
 
217
205
  function clickHandler(options) {
218
- const { tippyModal } = init(options);
206
+ // Create the tooltip instance
207
+ let tooltip = new Tooltip(options);
208
+ // Initialize the tooltip
209
+ let { tippyModal, tippyInstance } = tooltip.init();
219
210
  return new Plugin({
220
211
  key: new PluginKey("handleClickHyperlink"),
221
212
  props: {
@@ -242,21 +233,24 @@ function clickHandler(options) {
242
233
  }
243
234
  // if the link does not contain href attribute, hide the tooltip
244
235
  if (!(link === null || link === void 0 ? void 0 : link.href))
245
- return hide();
236
+ return tooltip.hide();
246
237
  // Create a preview of the hyperlink
247
238
  const hyperlinkPreview = options.modals.previewHyperlink({
248
239
  link,
249
240
  nodePos,
241
+ tippy: tooltip,
250
242
  ...options,
251
243
  });
252
244
  // If there is no hyperlink preview, hide the modal
253
245
  if (!hyperlinkPreview)
254
- return hide();
246
+ return tooltip.hide();
255
247
  // Empty the modal and append the hyperlink preview box
256
- tippyModal.innerHTML = "";
248
+ while (tippyModal.firstChild) {
249
+ tippyModal.removeChild(tippyModal.firstChild);
250
+ }
257
251
  tippyModal.append(hyperlinkPreview);
258
252
  // Update the modal position
259
- update(options.view);
253
+ tooltip.update(options.view);
260
254
  return false;
261
255
  },
262
256
  },
@@ -486,5 +480,5 @@ const Hyperlink = Mark.create({
486
480
  },
487
481
  });
488
482
 
489
- export { Hyperlink, Hyperlink as default, tippyHelper as tippy };
483
+ export { Hyperlink, Tooltip, Hyperlink as default };
490
484
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/helpers/autoHyperlink.ts","../src/helpers/tippyHelper.ts","../src/helpers/clickHandler.ts","../src/helpers/pasteHandler.ts","../src/helpers/editHyperlink.ts","../src/hyperlink.ts"],"sourcesContent":["import {\n combineTransactionSteps,\n findChildrenInRange,\n getChangedRanges,\n getMarksBetween,\n NodeWithPos,\n} from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { find, test } from \"linkifyjs\";\n\ntype AutoHyperlinkOptions = {\n type: MarkType;\n validate?: (url: string) => boolean;\n};\n\nexport default function autoHyperlink(options: AutoHyperlinkOptions): Plugin {\n return new Plugin({\n key: new PluginKey(\"autoHyperlink\"),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges =\n transactions.some((transaction) => transaction.docChanged) &&\n !oldState.doc.eq(newState.doc);\n const preventAutoHyperlink = transactions.some((transaction) =>\n transaction.getMeta(\"preventAutoHyperlink\")\n );\n\n if (!docChanges || preventAutoHyperlink) {\n return;\n }\n\n const { tr } = newState;\n const transform = combineTransactionSteps(oldState.doc, [\n ...transactions,\n ]);\n const { mapping } = transform;\n const changes = getChangedRanges(transform);\n\n changes.forEach(({ oldRange, newRange }) => {\n // at first we check if we have to remove links\n getMarksBetween(oldRange.from, oldRange.to, oldState.doc)\n .filter((item) => item.mark.type === options.type)\n .forEach((oldMark) => {\n const newFrom = mapping.map(oldMark.from);\n const newTo = mapping.map(oldMark.to);\n const newMarks = getMarksBetween(\n newFrom,\n newTo,\n newState.doc\n ).filter((item) => item.mark.type === options.type);\n\n if (!newMarks.length) {\n return;\n }\n\n const newMark = newMarks[0];\n const oldLinkText = oldState.doc.textBetween(\n oldMark.from,\n oldMark.to,\n undefined,\n \" \"\n );\n const newLinkText = newState.doc.textBetween(\n newMark.from,\n newMark.to,\n undefined,\n \" \"\n );\n const wasLink = test(oldLinkText);\n const isLink = test(newLinkText);\n\n // remove only the link, if it was a link before too\n // because we don’t want to remove links that were set manually\n if (wasLink && !isLink) {\n tr.removeMark(newMark.from, newMark.to, options.type);\n }\n });\n\n // now let’s see if we can add new links\n const nodesInChangedRanges = findChildrenInRange(\n newState.doc,\n newRange,\n (node) => node.isTextblock\n );\n\n let textBlock: NodeWithPos | undefined;\n let textBeforeWhitespace: string | undefined;\n\n if (nodesInChangedRanges.length > 1) {\n // Grab the first node within the changed ranges (ex. the first of two paragraphs when hitting enter)\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n textBlock.pos + textBlock.node.nodeSize,\n undefined,\n \" \"\n );\n } else if (\n nodesInChangedRanges.length &&\n // We want to make sure to include the block seperator argument to treat hard breaks like spaces\n newState.doc\n .textBetween(newRange.from, newRange.to, \" \", \" \")\n .endsWith(\" \")\n ) {\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n newRange.to,\n undefined,\n \" \"\n );\n }\n\n if (textBlock && textBeforeWhitespace) {\n const wordsBeforeWhitespace = textBeforeWhitespace\n .split(\" \")\n .filter((s) => s !== \"\");\n\n if (wordsBeforeWhitespace.length <= 0) {\n return false;\n }\n\n const lastWordBeforeSpace =\n wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];\n const lastWordAndBlockOffset =\n textBlock.pos +\n textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);\n\n if (!lastWordBeforeSpace) {\n return false;\n }\n\n find(lastWordBeforeSpace)\n .filter((link) => link.isLink)\n .filter((link) => {\n if (options.validate) {\n return options.validate(link.value);\n }\n return true;\n })\n // calculate link position\n .map((link) => ({\n ...link,\n from: lastWordAndBlockOffset + link.start + 1,\n to: lastWordAndBlockOffset + link.end + 1,\n }))\n // add link mark\n .forEach((link) => {\n tr.addMark(\n link.from,\n link.to,\n options.type.create({\n href: link.href,\n })\n );\n });\n }\n });\n\n if (!tr.steps.length) {\n return;\n }\n\n return tr;\n },\n });\n}\n","import tippy, { Instance, Props, roundArrow } from \"tippy.js\";\nimport { Editor } from \"@tiptap/core\";\nimport { EditorView } from \"@tiptap/pm/view\";\nimport { getAttributes, posToDOMRect } from \"@tiptap/core\";\n\nlet tippyInstance: Instance | undefined;\nlet preventHide: boolean = false;\nlet tippyWrapper: HTMLDivElement;\nlet editor: Editor;\nlet view: EditorView;\n\ntype TippyInitOptions = {\n editor: Editor;\n validate?: (url: string) => boolean;\n view: EditorView;\n};\n\nexport const init = (options: TippyInitOptions) => {\n editor = options.editor;\n view = options.view;\n if (!tippyInstance) {\n tippyWrapper = document.createElement(\"div\");\n tippyWrapper.addEventListener(\"mousedown\", mousedownHandler, {\n capture: true,\n });\n view.dom.addEventListener(\"dragstart\", dragstartHandler);\n editor.on(\"focus\", focusHandler);\n editor.on(\"blur\", blurHandler);\n }\n\n return { tippyModal: tippyWrapper, tippyInstance: tippyInstance };\n};\n\nexport const show = () => {\n tippyInstance?.show();\n return true;\n};\n\nexport const hide = () => {\n setTimeout(() => tippyInstance?.hide());\n return false;\n};\n\nexport const mousedownHandler = () => {\n preventHide = true;\n};\n\nexport const dragstartHandler = () => {\n hide();\n};\n\nexport const focusHandler = () => {\n setTimeout(() => update(editor.view));\n};\n\nconst blurHandler = ({ event }: { event: FocusEvent }) => {\n if (preventHide) {\n preventHide = false;\n return;\n }\n if (event?.relatedTarget && tippyWrapper.parentNode?.contains(event.relatedTarget as Node)) {\n return;\n }\n hide();\n};\n\nconst tippyBlurHandler = (event: FocusEvent) => {\n blurHandler({ event });\n};\n\nconst createTooltip = () => {\n if (!editor || !editor.options) return;\n const { element: editorElement } = editor.options;\n const editorIsAttached = !!editorElement.parentElement;\n\n if (tippyInstance || !editorIsAttached) {\n return;\n }\n\n tippyInstance = tippy(editorElement, {\n duration: 0,\n getReferenceClientRect: null,\n content: tippyWrapper,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom\",\n hideOnClick: \"toggle\",\n });\n\n if (tippyInstance.popper.firstChild) {\n (tippyInstance.popper.firstChild as HTMLElement).addEventListener(\"blur\", tippyBlurHandler);\n }\n};\n\nexport const update = (view: EditorView, option: any = {}) => {\n createTooltip();\n\n // Ensure 'arrow' is false when not provided\n option.arrow = option?.arrow ?? false;\n\n if (tippyInstance) {\n tippyInstance.setProps({\n ...option,\n getReferenceClientRect: () => {\n const pos = view.state.selection.from;\n return posToDOMRect(view, pos, pos);\n },\n });\n show();\n }\n\n return {};\n};\n\nexport const destroyTooltip = () => {\n if (tippyInstance) {\n tippyInstance.destroy();\n tippyInstance = undefined;\n tippyWrapper.removeEventListener(\"mousedown\", mousedownHandler, {\n capture: true,\n });\n view.dom.removeEventListener(\"dragstart\", dragstartHandler);\n editor.off(\"focus\", focusHandler);\n editor.off(\"blur\", blurHandler);\n }\n};\n","import { getAttributes } from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { Editor } from \"@tiptap/core\";\nimport { EditorView } from \"@tiptap/pm/view\";\nimport * as tippy from \"./tippyHelper\";\n// import \"tippy.js/dist/svg-arrow.css\";\n\n// Define type for the ClickHandlerOptions\ntype ClickHandlerOptions = {\n type: MarkType;\n editor: Editor;\n validate?: (url: string) => boolean;\n view: EditorView;\n modals: {\n previewHyperlink?: ((options: any) => HTMLElement) | null;\n setHyperlink?: ((options: any) => HTMLElement) | null;\n };\n};\n\nexport default function clickHandler(options: ClickHandlerOptions): Plugin {\n const { tippyModal } = tippy.init(options);\n\n return new Plugin({\n key: new PluginKey(\"handleClickHyperlink\"),\n props: {\n handleClick: (view, pos, event) => {\n if (event.button !== 0) return false;\n\n // Get the target HTML element and its position\n const nodeTarget: HTMLElement = event.target as HTMLElement;\n const nodePos = view.posAtDOM(nodeTarget, 0);\n\n // Find the closest link element to the target element\n const link = nodeTarget?.closest(\"a\");\n\n // Extract attributes from the state\n const attrs = getAttributes(view.state, options.type.name);\n\n // Extract href and target attributes from the link element or the state\n const href = link?.href ?? attrs.href;\n const target = link?.target ?? attrs.target;\n\n // If there is no previewHyperlink modal provided, then open the link in new window\n if (!options.modals.previewHyperlink) {\n if (link && href) {\n window.open(href, target);\n }\n return true;\n }\n\n // if the link does not contain href attribute, hide the tooltip\n if (!link?.href) return tippy.hide();\n\n // Create a preview of the hyperlink\n const hyperlinkPreview = options.modals.previewHyperlink({\n link,\n nodePos,\n ...options,\n });\n\n // If there is no hyperlink preview, hide the modal\n if (!hyperlinkPreview) return tippy.hide();\n\n // Empty the modal and append the hyperlink preview box\n tippyModal.innerHTML = \"\";\n tippyModal.append(hyperlinkPreview);\n\n // Update the modal position\n tippy.update(options.view);\n\n return false;\n },\n },\n });\n}\n","import { Editor } from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { find } from \"linkifyjs\";\n\ntype PasteHandlerOptions = {\n editor: Editor;\n type: MarkType;\n};\n\nexport function pasteHandler(options: PasteHandlerOptions): Plugin {\n return new Plugin({\n key: new PluginKey(\"handlePasteHyperlink\"),\n props: {\n handlePaste: (view, event, slice) => {\n const { state } = view;\n const { selection } = state;\n const { empty } = selection;\n\n if (empty) {\n return false;\n }\n\n let textContent = \"\";\n\n slice.content.forEach((node) => {\n textContent += node.textContent;\n });\n\n const link = find(textContent).find(\n (item) => item.isLink && item.value === textContent\n );\n\n if (!textContent || !link) {\n return false;\n }\n\n options.editor.commands.setMark(options.type, {\n href: link.href,\n });\n\n return true;\n },\n },\n });\n}\n","import { Editor } from \"@tiptap/core\";\nimport { find } from \"linkifyjs\";\n\ntype EditHyperlinkOptions = {\n editor: Editor;\n validate?: (url: string) => boolean;\n newURL?: string;\n newText?: string;\n};\n\nexport default function editHyperlink(options: EditHyperlinkOptions) {\n const { state, dispatch } = options.editor.view;\n const { from, to } = state.selection;\n let link: HTMLAnchorElement | null = null;\n\n const selectedNode = options.editor.view.domAtPos(from - 1)\n .node as HTMLElement;\n\n if (selectedNode?.nodeName === \"#text\") {\n link = (selectedNode.parentNode as HTMLElement)?.closest(\"a\");\n } else {\n link = selectedNode?.closest(\"a\");\n }\n\n if (!link) return true;\n\n const text = options.newText || link?.innerText;\n // Get the position of the link in the editor view\n const nodePos = options.editor.view.posAtDOM(link, 0);\n\n const sanitizeURL = find(options.newURL || link.href)\n .filter((link) => link.isLink)\n .filter((link) => (options.validate ? options.validate(link.value) : true))\n .at(0);\n\n return options.editor\n .chain()\n .focus()\n .command(({ tr }) => {\n // The command replaces the range from nodePos to nodePos + length of the text\n // with a new text node with the provided text and a link mark with the sanitized URL\n tr.replaceWith(\n nodePos,\n nodePos + text?.length,\n options.editor.schema.text(text, [\n options.editor.schema.marks.hyperlink.create({\n href: sanitizeURL?.href,\n }),\n ])\n );\n\n return true;\n })\n .run();\n}\n","import { Mark, markPasteRule, mergeAttributes } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { find, registerCustomProtocol, reset } from \"linkifyjs\";\nimport autoHyperlink from \"./helpers/autoHyperlink\";\nimport clickHandler from \"./helpers/clickHandler\";\nimport { pasteHandler } from \"./helpers/pasteHandler\";\nimport editHyperlinkHelper from \"./helpers/editHyperlink\";\n\nexport interface LinkProtocolOptions {\n scheme: string;\n optionalSlashes?: boolean;\n}\n\nexport interface HyperlinkOptions {\n /**\n * If enabled, it adds links as you type.\n */\n autoHyperlink: boolean;\n /**\n * An array of custom protocols to be registered with linkifyjs.\n */\n protocols: Array<LinkProtocolOptions | string>;\n /**\n * If enabled, links will be opened on click.\n */\n openOnClick: boolean;\n /**\n * Adds a link to the current selection if the pasted content only contains an url.\n */\n hyperlinkOnPaste: boolean;\n /**\n * A list of HTML attributes to be rendered.\n */\n HTMLAttributes: Record<string, any>;\n /**\n * A list of modals to be rendered.\n * @default null\n * @example\n */\n modals: {\n previewHyperlink?: ((options: any) => HTMLElement) | null;\n setHyperlink?: ((options: any) => HTMLElement) | null;\n };\n /**\n * A validation function that modifies link verification for the auto linker.\n * @param url - The url to be validated.\n * @returns - True if the url is valid, false otherwise.\n */\n validate?: (url: string) => boolean;\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n link: {\n /**\n * Edit the hyperlink's text\n */\n editHyperLinkText: (text: string) => ReturnType;\n\n /**\n * Edit the hyperlink's href value\n */\n editHyperLinkHref: (href: string) => ReturnType;\n\n /**\n * Edit the hyperlink's\n */\n editHyperlink: (attributes?: { newText?: string; newURL?: string }) => ReturnType;\n\n /**\n * Set a hyperlink\n */\n setHyperlink: (attributes?: { href: string; target?: string | null }) => ReturnType;\n\n /**\n * Unset a link mark\n */\n unsetHyperlink: () => ReturnType;\n };\n }\n}\n\nexport const Hyperlink = Mark.create<HyperlinkOptions>({\n name: \"hyperlink\",\n\n priority: 1000,\n\n keepOnSplit: false,\n\n onCreate() {\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\n onDestroy() {\n reset();\n },\n\n inclusive() {\n return this.options.autoHyperlink;\n },\n\n addOptions() {\n return {\n openOnClick: true,\n hyperlinkOnPaste: true,\n autoHyperlink: true,\n protocols: [],\n HTMLAttributes: {\n target: \"_blank\",\n rel: \"noopener noreferrer nofollow\",\n class: null,\n },\n modals: {\n previewHyperlink: null,\n setHyperlink: null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n class: {\n default: this.options.HTMLAttributes.class,\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'a[href]:not([href *= \"javascript:\" i])' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"a\", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];\n },\n\n addCommands() {\n return {\n setHyperlink:\n (attributes) =>\n ({ editor, chain }) => {\n if (!this.options.modals.setHyperlink) {\n return chain()\n .setMark(this.name, attributes)\n .setMeta(\"preventAutohyperlink\", true)\n .run();\n } else {\n this.options.modals.setHyperlink({\n editor,\n validate: this.options.validate,\n extentionName: this.name,\n attributes,\n });\n return true;\n }\n },\n\n editHyperlink:\n (attributes) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n ...attributes,\n editor,\n validate: this.options.validate,\n });\n },\n\n editHyperLinkText:\n (newText) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n editor,\n newText,\n validate: this.options.validate,\n });\n },\n\n editHyperLinkHref:\n (newURL) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n editor,\n validate: this.options.validate,\n newURL,\n });\n },\n\n unsetHyperlink:\n () =>\n ({ chain }) => {\n return chain()\n .unsetMark(this.name, { extendEmptyMarkRange: true })\n .setMeta(\"preventAutohyperlink\", true)\n .run();\n },\n };\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: (text) =>\n find(text)\n .filter((link) => {\n if (this.options.validate) {\n return this.options.validate(link.value);\n }\n\n return true;\n })\n .filter((link) => link.isLink)\n .map((link) => ({\n text: link.value,\n index: link.start,\n data: link,\n })),\n type: this.type,\n getAttributes: (match) => ({\n href: match.data?.href,\n }),\n }),\n ];\n },\n\n addProseMirrorPlugins() {\n const plugins: Plugin[] = [];\n\n if (this.options.autoHyperlink) {\n plugins.push(\n autoHyperlink({\n type: this.type,\n validate: this.options.validate,\n })\n );\n }\n\n if (this.options.openOnClick) {\n plugins.push(\n clickHandler({\n type: this.type,\n editor: this.editor,\n validate: this.options.validate,\n view: this.editor.view,\n modals: this.options.modals,\n })\n );\n }\n\n if (this.options.hyperlinkOnPaste) {\n plugins.push(\n pasteHandler({\n editor: this.editor,\n type: this.type,\n })\n );\n }\n\n return plugins;\n },\n});\n"],"names":["tippy.init","tippy.hide","tippy.update","editHyperlinkHelper"],"mappings":";;;;;AAgBwB,SAAA,aAAa,CAAC,OAA6B,EAAA;IACjE,OAAO,IAAI,MAAM,CAAC;AAChB,QAAA,GAAG,EAAE,IAAI,SAAS,CAAC,eAAe,CAAC;QACnC,iBAAiB,EAAE,CAA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AAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;AAChB,aAAA,CAAC,CACH,CAAC;AACH,SAAA;AAED,QAAA,OAAO,OAAO,CAAC;KAChB;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/helpers/autoHyperlink.ts","../src/helpers/tippyHelper.ts","../src/helpers/clickHandler.ts","../src/helpers/pasteHandler.ts","../src/helpers/editHyperlink.ts","../src/hyperlink.ts"],"sourcesContent":["import {\n combineTransactionSteps,\n findChildrenInRange,\n getChangedRanges,\n getMarksBetween,\n NodeWithPos,\n} from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { find, test } from \"linkifyjs\";\n\ntype AutoHyperlinkOptions = {\n type: MarkType;\n validate?: (url: string) => boolean;\n};\n\nexport default function autoHyperlink(options: AutoHyperlinkOptions): Plugin {\n return new Plugin({\n key: new PluginKey(\"autoHyperlink\"),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges =\n transactions.some((transaction) => transaction.docChanged) &&\n !oldState.doc.eq(newState.doc);\n const preventAutoHyperlink = transactions.some((transaction) =>\n transaction.getMeta(\"preventAutoHyperlink\")\n );\n\n if (!docChanges || preventAutoHyperlink) {\n return;\n }\n\n const { tr } = newState;\n const transform = combineTransactionSteps(oldState.doc, [\n ...transactions,\n ]);\n const { mapping } = transform;\n const changes = getChangedRanges(transform);\n\n changes.forEach(({ oldRange, newRange }) => {\n // at first we check if we have to remove links\n getMarksBetween(oldRange.from, oldRange.to, oldState.doc)\n .filter((item) => item.mark.type === options.type)\n .forEach((oldMark) => {\n const newFrom = mapping.map(oldMark.from);\n const newTo = mapping.map(oldMark.to);\n const newMarks = getMarksBetween(\n newFrom,\n newTo,\n newState.doc\n ).filter((item) => item.mark.type === options.type);\n\n if (!newMarks.length) {\n return;\n }\n\n const newMark = newMarks[0];\n const oldLinkText = oldState.doc.textBetween(\n oldMark.from,\n oldMark.to,\n undefined,\n \" \"\n );\n const newLinkText = newState.doc.textBetween(\n newMark.from,\n newMark.to,\n undefined,\n \" \"\n );\n const wasLink = test(oldLinkText);\n const isLink = test(newLinkText);\n\n // remove only the link, if it was a link before too\n // because we don’t want to remove links that were set manually\n if (wasLink && !isLink) {\n tr.removeMark(newMark.from, newMark.to, options.type);\n }\n });\n\n // now let’s see if we can add new links\n const nodesInChangedRanges = findChildrenInRange(\n newState.doc,\n newRange,\n (node) => node.isTextblock\n );\n\n let textBlock: NodeWithPos | undefined;\n let textBeforeWhitespace: string | undefined;\n\n if (nodesInChangedRanges.length > 1) {\n // Grab the first node within the changed ranges (ex. the first of two paragraphs when hitting enter)\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n textBlock.pos + textBlock.node.nodeSize,\n undefined,\n \" \"\n );\n } else if (\n nodesInChangedRanges.length &&\n // We want to make sure to include the block seperator argument to treat hard breaks like spaces\n newState.doc\n .textBetween(newRange.from, newRange.to, \" \", \" \")\n .endsWith(\" \")\n ) {\n textBlock = nodesInChangedRanges[0];\n textBeforeWhitespace = newState.doc.textBetween(\n textBlock.pos,\n newRange.to,\n undefined,\n \" \"\n );\n }\n\n if (textBlock && textBeforeWhitespace) {\n const wordsBeforeWhitespace = textBeforeWhitespace\n .split(\" \")\n .filter((s) => s !== \"\");\n\n if (wordsBeforeWhitespace.length <= 0) {\n return false;\n }\n\n const lastWordBeforeSpace =\n wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];\n const lastWordAndBlockOffset =\n textBlock.pos +\n textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);\n\n if (!lastWordBeforeSpace) {\n return false;\n }\n\n find(lastWordBeforeSpace)\n .filter((link) => link.isLink)\n .filter((link) => {\n if (options.validate) {\n return options.validate(link.value);\n }\n return true;\n })\n // calculate link position\n .map((link) => ({\n ...link,\n from: lastWordAndBlockOffset + link.start + 1,\n to: lastWordAndBlockOffset + link.end + 1,\n }))\n // add link mark\n .forEach((link) => {\n tr.addMark(\n link.from,\n link.to,\n options.type.create({\n href: link.href,\n })\n );\n });\n }\n });\n\n if (!tr.steps.length) {\n return;\n }\n\n return tr;\n },\n });\n}\n","import tippy, { Instance, Props, roundArrow } from \"tippy.js\";\nimport { Editor } from \"@tiptap/core\";\nimport { EditorView } from \"@tiptap/pm/view\";\nimport { getAttributes, posToDOMRect } from \"@tiptap/core\";\n\ninterface TippyInitOptions {\n editor: Editor;\n validate?: (url: string) => boolean;\n view: EditorView;\n}\n\nclass Tooltip {\n private tippyInstance?: Instance;\n private preventHide: boolean = false;\n private tippyWrapper: HTMLDivElement;\n private editor: Editor;\n private view: EditorView;\n\n constructor(options: TippyInitOptions) {\n this.editor = options.editor;\n this.view = options.view;\n this.tippyWrapper = document.createElement(\"div\");\n this.tippyWrapper.addEventListener(\"mousedown\", this.mousedownHandler, {\n capture: true,\n });\n this.view.dom.addEventListener(\"dragstart\", this.dragstartHandler);\n this.editor.on(\"blur\", this.blurHandler);\n }\n\n init() {\n this.tippyWrapper.innerHTML = \"\";\n\n return { tippyModal: this.tippyWrapper, tippyInstance: this.tippyInstance };\n }\n\n show() {\n this.tippyInstance?.show();\n return true;\n }\n\n hide() {\n setTimeout(() => this.tippyInstance?.hide());\n return false;\n }\n\n private mousedownHandler = () => {\n this.preventHide = true;\n };\n\n private dragstartHandler = () => {\n this.hide();\n };\n\n private blurHandler = ({ event }: { event: FocusEvent }) => {\n if (this.preventHide) {\n this.preventHide = false;\n return;\n }\n if (\n event?.relatedTarget &&\n this.tippyWrapper.parentNode?.contains(event.relatedTarget as Node)\n ) {\n return;\n }\n this.hide();\n };\n\n private tippyBlurHandler = (event: FocusEvent) => {\n this.blurHandler({ event });\n };\n\n private createTooltip() {\n if (!this.editor || !this.editor.options) return;\n const { element: editorElement } = this.editor.options;\n const editorIsAttached = !!editorElement.parentElement;\n\n if (this.tippyInstance || !editorIsAttached) {\n return;\n }\n\n this.tippyInstance = tippy(editorElement, {\n duration: 0,\n getReferenceClientRect: null,\n content: this.tippyWrapper,\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom\",\n hideOnClick: \"toggle\",\n onClickOutside: (instance, event) => {\n this.hide();\n },\n onAfterUpdate: (instance, partialProps) => {\n this.show();\n },\n });\n\n if (this.tippyInstance.popper.firstChild) {\n (this.tippyInstance.popper.firstChild as HTMLElement).addEventListener(\n \"blur\",\n this.tippyBlurHandler\n );\n }\n }\n\n update(view: EditorView, option: any = {}) {\n this.createTooltip();\n\n option.arrow = option?.arrow ?? false;\n\n if (this.tippyInstance) {\n this.tippyInstance.setProps({\n ...option,\n getReferenceClientRect: () => {\n const pos = view.state.selection.from;\n return posToDOMRect(view, pos, pos);\n },\n });\n }\n\n return {};\n }\n\n destroyTooltip() {\n if (this.tippyInstance) {\n this.tippyInstance.destroy();\n this.tippyInstance = undefined;\n this.tippyWrapper.removeEventListener(\"mousedown\", this.mousedownHandler, {\n capture: true,\n });\n this.view.dom.removeEventListener(\"dragstart\", this.dragstartHandler);\n this.editor.off(\"blur\", this.blurHandler);\n }\n }\n}\n\nexport default Tooltip;\n","import { getAttributes } from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { Editor } from \"@tiptap/core\";\nimport { EditorView } from \"@tiptap/pm/view\";\nimport Tooltip from \"./tippyHelper\";\n\n// Define type for the ClickHandlerOptions\ntype ClickHandlerOptions = {\n type: MarkType;\n editor: Editor;\n validate?: (url: string) => boolean;\n view: EditorView;\n modals: {\n previewHyperlink?: ((options: any) => HTMLElement) | null;\n setHyperlink?: ((options: any) => HTMLElement) | null;\n };\n};\n\nexport default function clickHandler(options: ClickHandlerOptions): Plugin {\n // Create the tooltip instance\n let tooltip = new Tooltip(options);\n\n // Initialize the tooltip\n let { tippyModal, tippyInstance } = tooltip.init();\n\n return new Plugin({\n key: new PluginKey(\"handleClickHyperlink\"),\n props: {\n handleClick: (view, pos, event) => {\n if (event.button !== 0) return false;\n\n // Get the target HTML element and its position\n const nodeTarget: HTMLElement = event.target as HTMLElement;\n const nodePos = view.posAtDOM(nodeTarget, 0);\n\n // Find the closest link element to the target element\n const link = nodeTarget?.closest(\"a\");\n\n // Extract attributes from the state\n const attrs = getAttributes(view.state, options.type.name);\n\n // Extract href and target attributes from the link element or the state\n const href = link?.href ?? attrs.href;\n const target = link?.target ?? attrs.target;\n\n // If there is no previewHyperlink modal provided, then open the link in new window\n if (!options.modals.previewHyperlink) {\n if (link && href) {\n window.open(href, target);\n }\n return true;\n }\n\n // if the link does not contain href attribute, hide the tooltip\n if (!link?.href) return tooltip.hide();\n\n // Create a preview of the hyperlink\n const hyperlinkPreview = options.modals.previewHyperlink({\n link,\n nodePos,\n tippy: tooltip,\n ...options,\n });\n\n // If there is no hyperlink preview, hide the modal\n if (!hyperlinkPreview) return tooltip.hide();\n\n // Empty the modal and append the hyperlink preview box\n\n while (tippyModal.firstChild) {\n tippyModal.removeChild(tippyModal.firstChild);\n }\n\n tippyModal.append(hyperlinkPreview);\n\n // Update the modal position\n tooltip.update(options.view);\n\n return false;\n },\n },\n });\n}\n","import { Editor } from \"@tiptap/core\";\nimport { MarkType } from \"@tiptap/pm/model\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { find } from \"linkifyjs\";\n\ntype PasteHandlerOptions = {\n editor: Editor;\n type: MarkType;\n};\n\nexport function pasteHandler(options: PasteHandlerOptions): Plugin {\n return new Plugin({\n key: new PluginKey(\"handlePasteHyperlink\"),\n props: {\n handlePaste: (view, event, slice) => {\n const { state } = view;\n const { selection } = state;\n const { empty } = selection;\n\n if (empty) {\n return false;\n }\n\n let textContent = \"\";\n\n slice.content.forEach((node) => {\n textContent += node.textContent;\n });\n\n const link = find(textContent).find(\n (item) => item.isLink && item.value === textContent\n );\n\n if (!textContent || !link) {\n return false;\n }\n\n options.editor.commands.setMark(options.type, {\n href: link.href,\n });\n\n return true;\n },\n },\n });\n}\n","import { Editor } from \"@tiptap/core\";\nimport { find } from \"linkifyjs\";\n\ntype EditHyperlinkOptions = {\n editor: Editor;\n validate?: (url: string) => boolean;\n newURL?: string;\n newText?: string;\n};\n\nexport default function editHyperlink(options: EditHyperlinkOptions) {\n const { state, dispatch } = options.editor.view;\n const { from, to } = state.selection;\n let link: HTMLAnchorElement | null = null;\n\n const selectedNode = options.editor.view.domAtPos(from - 1)\n .node as HTMLElement;\n\n if (selectedNode?.nodeName === \"#text\") {\n link = (selectedNode.parentNode as HTMLElement)?.closest(\"a\");\n } else {\n link = selectedNode?.closest(\"a\");\n }\n\n if (!link) return true;\n\n const text = options.newText || link?.innerText;\n // Get the position of the link in the editor view\n const nodePos = options.editor.view.posAtDOM(link, 0);\n\n const sanitizeURL = find(options.newURL || link.href)\n .filter((link) => link.isLink)\n .filter((link) => (options.validate ? options.validate(link.value) : true))\n .at(0);\n\n return options.editor\n .chain()\n .focus()\n .command(({ tr }) => {\n // The command replaces the range from nodePos to nodePos + length of the text\n // with a new text node with the provided text and a link mark with the sanitized URL\n tr.replaceWith(\n nodePos,\n nodePos + text?.length,\n options.editor.schema.text(text, [\n options.editor.schema.marks.hyperlink.create({\n href: sanitizeURL?.href,\n }),\n ])\n );\n\n return true;\n })\n .run();\n}\n","import { Mark, markPasteRule, mergeAttributes } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { find, registerCustomProtocol, reset } from \"linkifyjs\";\nimport autoHyperlink from \"./helpers/autoHyperlink\";\nimport clickHandler from \"./helpers/clickHandler\";\nimport { pasteHandler } from \"./helpers/pasteHandler\";\nimport editHyperlinkHelper from \"./helpers/editHyperlink\";\n\nexport interface LinkProtocolOptions {\n scheme: string;\n optionalSlashes?: boolean;\n}\n\nexport interface HyperlinkOptions {\n /**\n * If enabled, it adds links as you type.\n */\n autoHyperlink: boolean;\n /**\n * An array of custom protocols to be registered with linkifyjs.\n */\n protocols: Array<LinkProtocolOptions | string>;\n /**\n * If enabled, links will be opened on click.\n */\n openOnClick: boolean;\n /**\n * Adds a link to the current selection if the pasted content only contains an url.\n */\n hyperlinkOnPaste: boolean;\n /**\n * A list of HTML attributes to be rendered.\n */\n HTMLAttributes: Record<string, any>;\n /**\n * A list of modals to be rendered.\n * @default null\n * @example\n */\n modals: {\n previewHyperlink?: ((options: any) => HTMLElement) | null;\n setHyperlink?: ((options: any) => HTMLElement) | null;\n };\n /**\n * A validation function that modifies link verification for the auto linker.\n * @param url - The url to be validated.\n * @returns - True if the url is valid, false otherwise.\n */\n validate?: (url: string) => boolean;\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n link: {\n /**\n * Edit the hyperlink's text\n */\n editHyperLinkText: (text: string) => ReturnType;\n\n /**\n * Edit the hyperlink's href value\n */\n editHyperLinkHref: (href: string) => ReturnType;\n\n /**\n * Edit the hyperlink's\n */\n editHyperlink: (attributes?: { newText?: string; newURL?: string }) => ReturnType;\n\n /**\n * Set a hyperlink\n */\n setHyperlink: (attributes?: { href: string; target?: string | null }) => ReturnType;\n\n /**\n * Unset a link mark\n */\n unsetHyperlink: () => ReturnType;\n };\n }\n}\n\nexport const Hyperlink = Mark.create<HyperlinkOptions>({\n name: \"hyperlink\",\n\n priority: 1000,\n\n keepOnSplit: false,\n\n onCreate() {\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\n onDestroy() {\n reset();\n },\n\n inclusive() {\n return this.options.autoHyperlink;\n },\n\n addOptions() {\n return {\n openOnClick: true,\n hyperlinkOnPaste: true,\n autoHyperlink: true,\n protocols: [],\n HTMLAttributes: {\n target: \"_blank\",\n rel: \"noopener noreferrer nofollow\",\n class: null,\n },\n modals: {\n previewHyperlink: null,\n setHyperlink: null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n href: {\n default: null,\n },\n target: {\n default: this.options.HTMLAttributes.target,\n },\n class: {\n default: this.options.HTMLAttributes.class,\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'a[href]:not([href *= \"javascript:\" i])' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"a\", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];\n },\n\n addCommands() {\n return {\n setHyperlink:\n (attributes) =>\n ({ editor, chain }) => {\n if (!this.options.modals.setHyperlink) {\n return chain()\n .setMark(this.name, attributes)\n .setMeta(\"preventAutohyperlink\", true)\n .run();\n } else {\n this.options.modals.setHyperlink({\n editor,\n validate: this.options.validate,\n extentionName: this.name,\n attributes,\n });\n return true;\n }\n },\n\n editHyperlink:\n (attributes) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n ...attributes,\n editor,\n validate: this.options.validate,\n });\n },\n\n editHyperLinkText:\n (newText) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n editor,\n newText,\n validate: this.options.validate,\n });\n },\n\n editHyperLinkHref:\n (newURL) =>\n ({ editor }) => {\n return editHyperlinkHelper({\n editor,\n validate: this.options.validate,\n newURL,\n });\n },\n\n unsetHyperlink:\n () =>\n ({ chain }) => {\n return chain()\n .unsetMark(this.name, { extendEmptyMarkRange: true })\n .setMeta(\"preventAutohyperlink\", true)\n .run();\n },\n };\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: (text) =>\n find(text)\n .filter((link) => {\n if (this.options.validate) {\n return this.options.validate(link.value);\n }\n\n return true;\n })\n .filter((link) => link.isLink)\n .map((link) => ({\n text: link.value,\n index: link.start,\n data: link,\n })),\n type: this.type,\n getAttributes: (match) => ({\n href: match.data?.href,\n }),\n }),\n ];\n },\n\n addProseMirrorPlugins() {\n const plugins: Plugin[] = [];\n\n if (this.options.autoHyperlink) {\n plugins.push(\n autoHyperlink({\n type: this.type,\n validate: this.options.validate,\n })\n );\n }\n\n if (this.options.openOnClick) {\n plugins.push(\n clickHandler({\n type: this.type,\n editor: this.editor,\n validate: this.options.validate,\n view: this.editor.view,\n modals: this.options.modals,\n })\n );\n }\n\n if (this.options.hyperlinkOnPaste) {\n plugins.push(\n pasteHandler({\n editor: this.editor,\n type: this.type,\n })\n );\n }\n\n return plugins;\n },\n});\n"],"names":["editHyperlinkHelper"],"mappings":";;;;;AAgBwB,SAAA,aAAa,CAAC,OAA6B,EAAA;IACjE,OAAO,IAAI,MAAM,CAAC;AAChB,QAAA,GAAG,EAAE,IAAI,SAAS,CAAC,eAAe,CAAC;QACnC,iBAAiB,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,KAAI;AACtD,YAAA,MAAM,UAAU,GACd,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,UAAU,CAAC;gBAC1D,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACjC,YAAA,MAAM,oBAAoB,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,KACzD,WAAW,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAC5C,CAAC;AAEF,YAAA,IAAI,CAAC,UAAU,IAAI,oBAAoB,EAAE;gBACvC,OAAO;AACR,aAAA;AAED,YAAA,MAAM,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC;AACxB,YAAA,MAAM,SAAS,GAAG,uBAAuB,CAAC,QAAQ,CAAC,GAAG,EAAE;AACtD,gBAAA,GAAG,YAAY;AAChB,aAAA,CAAC,CAAC;AACH,YAAA,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;AAC9B,YAAA,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAE5C,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAI;;AAEzC,gBAAA,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC;AACtD,qBAAA,MAAM,CAAC,CA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