-
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
Add nevent extension separate from matcher extension #1
Conversation
Awesome, thanks a lot for the PR, I think your approach makes a lot more sense, since nostr links only makes sense as copy/paste events, and the current approach we call parseReferences on every key change, but we also need to be able to parse existing notes outside the editor. I thought about this approach too where each extensions would have it's own logic, but I was initially was making the autolink work where a pasteRule wouldn't apply and I figure out I could replace everything at once in a single prosemirror transaction and I didn't want to duplicate the I really like the idea where nostr-editor provides the actual extensions implementation instead of instructing the users implement them, gonna take a deeper look. |
Doing some interesting progress here, we could heavily split the main |
What would it look like to use the editor to parse notes so I can try it out? Would addInputRules solve that? Or maybe parseHTML? |
Right now there's this file that I am about to eliminate in favor of a simple editor command a (addInputRules might also works, gonna take a look), it basically apply some changes in a transaction and return a new state. You can also follow the unit tests here https://github.com/cesardeazevedo/nostr-editor/blob/main/src/__tests__/parser.test.ts |
Just pushed some changes in your branch together with some code that I had, I think your approach is good and we are can start doing the same approach for nprofile and naddr. |
Great, just pushed an update for naddr and nprofile. I also added support for npub and note within nprofile and nevent. Next, I want to add functionality for a suggestions popover when the user types |
Ok, just pushed a very rough version of profile suggestions. It would be nice to package in the main lib, but a lot of the complexity comes from integrating the framework, so I'm not sure the best way to do it. |
That's looking great, I initially thought about putting something in the package, but in the end, nostr-editor will be just a small handful extensions, adding abstractions around tiptap suggestions will just add unnecessary abstractions. Do you know what nostr-editor could also be shipped with? or what is missing? I am still planning to deploy a small gitbook for documentation and some end to end tests with playwright. |
Here's what I'm shooting for:
How much of this should be in the library is totally debatable, especially since so much of the behavior will be application-specific. I do think an extension for building suggestions would be nice to have to guide developers with implementation, even if it's very minimal. |
* Moved some files to helper folder
Thanks, that looks a solid roadmap. Just pushed some improvements on the profile suggestions component, and also moved the rest of the extensions to the library. I also been thinking about "differentiating between media and external links" as way to build imeta tags when creating notes. I am gonna merge this pr for now. |
Just playing around with the code, trying to understand tiptap/prosemirror. One thing I would like is to be able to pick and choose which extensions get added, and to be able to configure each extension independently. To that end, I've created an
nevent
node, which uses tiptap'snodePasteRule
. This code is much simpler, and seems to work just as well. Is this an approach you've considered? Are there any flaws with it? Just trying to understand how this all works so I can effectively contribute.