diff --git a/src/lib/editor/EditLink.svelte b/src/lib/editor/EditLink.svelte
deleted file mode 100644
index a777a88c..00000000
--- a/src/lib/editor/EditLink.svelte
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
- {displayUrl(node.attrs.url)}
-
-
diff --git a/src/lib/editor/LinkExtension.ts b/src/lib/editor/LinkExtension.ts
deleted file mode 100644
index c0049b1a..00000000
--- a/src/lib/editor/LinkExtension.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-import {last} from "@welshman/lib"
-import {Node, InputRule, nodePasteRule} from "@tiptap/core"
-import type {Node as ProsemirrorNode} from "@tiptap/pm/model"
-import type {MarkdownSerializerState} from "prosemirror-markdown"
-import {createPasteRuleMatch} from "./util"
-
-export const LINK_REGEX = /([a-z\+:]{2,30}:\/\/)?[^<>\(\)\s]+\.[a-z]{2,6}[^\s<>"'\.!?,:\)\(]*/gi
-
-export interface LinkAttributes {
- url: string
-}
-
-declare module "@tiptap/core" {
- interface Commands {
- inlineLink: {
- insertLink: (options: {url: string}) => ReturnType
- }
- }
-}
-
-export const LinkExtension = Node.create({
- atom: true,
- name: "inlineLink",
- group: "inline",
- inline: true,
- selectable: true,
- draggable: true,
- priority: 1000,
- addAttributes() {
- return {
- url: {default: null},
- }
- },
- renderHTML(props) {
- return ["div", {"data-url": props.node.attrs.url}]
- },
- renderText(props) {
- return props.node.attrs.url
- },
- addStorage() {
- return {
- markdown: {
- serialize(state: MarkdownSerializerState, node: ProsemirrorNode) {
- state.write(node.attrs.url)
- },
- parse: {},
- },
- }
- },
- addCommands() {
- return {
- insertLink:
- ({url}) =>
- ({commands}) => {
- return commands.insertContent(
- {type: this.name, attrs: {url}},
- {
- updateSelection: false,
- },
- )
- },
- }
- },
- addInputRules() {
- return [
- new InputRule({
- find: text => {
- const match = last(Array.from(text.matchAll(LINK_REGEX)))
-
- if (match && text.length === match.index + match[0].length + 1) {
- return {
- index: match.index!,
- text: match[0],
- data: {
- url: match[0],
- },
- }
- }
-
- return null
- },
- handler: ({state, range, match}) => {
- const {tr} = state
-
- if (match[0]) {
- try {
- tr.insert(range.from - 1, this.type.create(match.data))
- .delete(tr.mapping.map(range.from - 1), tr.mapping.map(range.to))
- .insert(
- tr.mapping.map(range.to),
- this.editor.schema.text(last(Array.from(match.input!))),
- )
- } catch (e) {
- // If the node was already linkified, the above code breaks for whatever reason
- }
- }
-
- tr.scrollIntoView()
- },
- }),
- ]
- },
- addPasteRules() {
- return [
- nodePasteRule({
- type: this.type,
- getAttributes: match => match.data,
- find: text => {
- const matches = []
-
- for (const match of text.matchAll(LINK_REGEX)) {
- try {
- matches.push(createPasteRuleMatch(match, {url: match[0]}))
- } catch (e) {
- continue
- }
- }
-
- return matches
- },
- }),
- ]
- },
-})
diff --git a/src/lib/editor/index.ts b/src/lib/editor/index.ts
index e9f8f598..f88d3000 100644
--- a/src/lib/editor/index.ts
+++ b/src/lib/editor/index.ts
@@ -23,13 +23,11 @@ import type {StampedEvent} from "@welshman/util"
import {signer, profileSearch} from "@welshman/app"
import {FileUploadExtension} from "./FileUpload"
import {createSuggestions} from "./Suggestions"
-// import {LinkExtension} from "./LinkExtension"
import EditMention from "./EditMention.svelte"
import EditEvent from "./EditEvent.svelte"
import EditImage from "./EditImage.svelte"
import EditBolt11 from "./EditBolt11.svelte"
import EditVideo from "./EditVideo.svelte"
-import EditLink from "./EditLink.svelte"
import Suggestions from "./Suggestions.svelte"
import SuggestionProfile from "./SuggestionProfile.svelte"
import {asInline} from "./util"
@@ -37,13 +35,11 @@ import {getSetting} from "@app/state"
export {
createSuggestions,
- // LinkExtension,
EditMention,
EditEvent,
EditImage,
EditBolt11,
EditVideo,
- EditLink,
Suggestions,
SuggestionProfile,
}
@@ -108,7 +104,6 @@ export const getEditorOptions = ({
}
},
}),
- // LinkExtension.extend({addNodeView: () => SvelteNodeViewRenderer(EditLink)}),
Bolt11Extension.extend(asInline({addNodeView: () => SvelteNodeViewRenderer(EditBolt11)})),
NProfileExtension.extend({
addNodeView: () => SvelteNodeViewRenderer(EditMention),