-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only match entities not embedded in links #3
Conversation
fd8d229
to
36c4f77
Compare
Yeah, this problem is very annoying, I also tried to do this exact approach you did but I ended up reverting it because of other issues it caused, I will do some more investigation before merging it. |
What do you think of for (const match of text.matchAll(NEVENT_REGEX)) {
+ if (text[match.index - 1] !== '/') {
try {
const data = nip19.decode(match[2]).data as EventPointer
const nevent = match[0]
matches.push(createPasteRuleMatch(match, { ...data, nevent }))
} catch (e) {
continue
}
+ }
} |
What kind of other issues did you run into? We could limit the scope of the regex ( |
Pasting multiple nprofiles at once eats the space between them, doesn't happen with block nodes though |
Even if there's a space between the nprofiles in the copied text? Seems like a bug rather than a parser problem. I've run into lots of similar things working with tiptap/prosemirror. It's very hard to get the behavior exactly right. |
36c4f77
to
f82863e
Compare
@staab Sorry for the delay, just coming back into this. I just tried with Here's the issue with pasting:
Let me know what you think. |
f82863e
to
d0dc1d9
Compare
d0dc1d9
to
c721c4a
Compare
That makes sense, just pushed an update |
Before this change, pasting njump links would trigger the entity regexp. This ensures only entities surrounded by a space or the beginning/end of a string will get matched.