Skip to content

Commit

Permalink
Only match entities not embedded in links
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Staab committed Aug 26, 2024
1 parent beb2ef3 commit 36c4f77
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/extensions/Bolt11Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { decode } from 'light-bolt11-decoder'
import type { MarkdownSerializerState } from 'prosemirror-markdown'
import { createPasteRuleMatch } from '../helpers/utils'

const LNBC_REGEX = /(lnbc[0-9a-z]{10,})/g
const LNBC_REGEX = /(?:^|\s)(lnbc[0-9a-z]{10,})/g

declare module '@tiptap/core' {
interface Commands<ReturnType> {
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/NAddrExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AddressPointer } from 'nostr-tools/nip19'
import type { MarkdownSerializerState } from 'prosemirror-markdown'
import { createPasteRuleMatch } from '../helpers/utils'

export const NADDR_REGEX = /(nostr:)?(naddr1[0-9a-z]+)/g
export const NADDR_REGEX = /(?:^|\s)(nostr:)?(naddr1[0-9a-z]+)/g

export interface NAddrAttributes {
naddr: string
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/NEventExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import type { EventPointer } from 'nostr-tools/nip19'
import type { MarkdownSerializerState } from 'prosemirror-markdown'
import { createPasteRuleMatch } from '../helpers/utils'

export const NOTE_REGEX = /(nostr:)?(note1[0-9a-z]+)/g
export const NOTE_REGEX = /(?:^|\s)(nostr:)?(note1[0-9a-z]+)/g

export const NEVENT_REGEX = /(nostr:)?(nevent1[0-9a-z]+)/g
export const NEVENT_REGEX = /(?:^|\s)(nostr:)?(nevent1[0-9a-z]+)/g

export interface NEventAttributes {
nevent: string
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/NProfileExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import type { ProfilePointer } from 'nostr-tools/nip19'
import type { MarkdownSerializerState } from 'prosemirror-markdown'
import { createPasteRuleMatch } from '../helpers/utils'

export const NPUB_REGEX = /(nostr:)?(npub1[0-9a-z]+)/g
export const NPUB_REGEX = /(?:^|\s)(nostr:)?(npub1[0-9a-z]+)/g

export const NPROFILE_REGEX = /(nostr:)?(nprofile1[0-9a-z]+)/g
export const NPROFILE_REGEX = /(?:^|\s)(nostr:)?(nprofile1[0-9a-z]+)/g

export type NProfileAttributes = {
nprofile: string
Expand Down

0 comments on commit 36c4f77

Please sign in to comment.