From f0de914f4993fd7a35c105b6acf6077027fc9ab5 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Tue, 26 Nov 2024 15:52:00 +0100 Subject: [PATCH] add nostr: prefix to all nostr entities using nostr-editor --- src/app/editor/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/editor/index.ts b/src/app/editor/index.ts index e11f4a3d..29b3685d 100644 --- a/src/app/editor/index.ts +++ b/src/app/editor/index.ts @@ -108,6 +108,7 @@ export const getEditorOptions = ({ Bolt11Extension.extend(asInline({addNodeView: () => SvelteNodeViewRenderer(EditBolt11)})), NProfileExtension.extend({ addNodeView: () => SvelteNodeViewRenderer(EditMention), + renderText: props => "nostr:" + props.node.attrs.nprofile, addProseMirrorPlugins() { return [ createSuggestions({ @@ -127,8 +128,18 @@ export const getEditorOptions = ({ ] }, }), - NEventExtension.extend(asInline({addNodeView: () => SvelteNodeViewRenderer(EditEvent)})), - NAddrExtension.extend(asInline({addNodeView: () => SvelteNodeViewRenderer(EditEvent)})), + NEventExtension.extend( + asInline({ + addNodeView: () => SvelteNodeViewRenderer(EditEvent), + renderText: props => "nostr:" + props.node.attrs.nevent, + }), + ), + NAddrExtension.extend( + asInline({ + addNodeView: () => SvelteNodeViewRenderer(EditEvent), + renderText: props => "nostr:" + props.node.attrs.naddr, + }), + ), ImageExtension.extend( asInline({addNodeView: () => SvelteNodeViewRenderer(EditMedia)}), ).configure({defaultUploadUrl, defaultUploadType: uploadType}),