Skip to content
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

Here's what I'm shooting for: #2

Open
1 of 8 tasks
cesardeazevedo opened this issue Aug 5, 2024 · 6 comments
Open
1 of 8 tasks

Here's what I'm shooting for: #2

cesardeazevedo opened this issue Aug 5, 2024 · 6 comments

Comments

@cesardeazevedo
Copy link
Owner

cesardeazevedo commented Aug 5, 2024

Here's what I'm shooting for:

  • Profile/topic suggestions
  • Inline code and code blocks support
  • Cashu invoice parsing and QR display
  • Possibly group/community/feed/list/note suggestions with custom triggers
  • Note embeds are configurable by kind
  • Paste parses things (differentiating between media and external links)
  • Image upload via selection and drag and drop to a section in the note
  • nsecs are recognized and rejected with UI feedback

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.

Originally posted by @staab in #1 (comment)

@cesardeazevedo
Copy link
Owner Author

cesardeazevedo commented Aug 5, 2024

✅ nsecs are recognized and rejected with UI feedback b907d49

@cesardeazevedo
Copy link
Owner Author

✅ Bolt11 extension
Screenshot 2024-08-06 at 13 29 56

@staab
Copy link
Collaborator

staab commented Aug 6, 2024

Got another one for you, NIP 73 was just merged this morning, it would be cool to recognize guids (maybe prefixed with nostr:) and add i tags for them. When parsing note content, these guids could be replaced with suggested links, or widget-ized. coracle-social/coracle#403

Edit: scratch that, I think it might be best for these to be opaque, and for users to just use normal links.

@cesardeazevedo
Copy link
Owner Author

Just did some progress.

Now things are much simpler and could be set up with a single extension called NostrExtension, which you can configure which extensions you want to include, this is the same approach of StarterKit.

const editor = new Editor({
  extensions: [
    StarterKit,
    NostrExtension.configure({
      naddr: false,
      nevent: { addNodeView: () => ReactNodeViewRenderer(NEventComponent) }
    })
  ]
})

Let me know what you think.

I am trying to make everything out-of-box, but the user still have to include the Markdown extension, apparently there's no way to dynamically load an extension, so we will need 2 editor instances if we are parsing multiple notes.

const editorWithMarkdown = new Editor({ extensions: [StarterKit, Markdown, NostrExtension] })
event.kind === 30023
  ? editorWithMarkdown.commands.parseNote(event)
  : editor.commands.parseNote(event)

Still looking for some solution.

I managed to simplify the parseNote approach by triggering the paste rules on the extensions, so all the parsing code are unified now.

I included a Content component that renders a content schema of an existing note, now any nevent pasted into the editor should be properly rendered, including markdown, that still needs more testing.

(still possible to render the editor for an existing note with editable: false, just an overhead tho)

@cesardeazevedo
Copy link
Owner Author

@staab Just did good progress on the FileUploadExtension, now we can:

  • Drag and drop images and videos into the editor at the cursor position.
  • Select images directly on the filesystem through an extension command.

Would love to hear your thoughts on how we should handle file uploads properly (NIP-96), as some services might also require NIP-98 for auth, not so sure on how to structure this, I also see coracle do some sort of image compression on the client, should we also handle that?

@staab
Copy link
Collaborator

staab commented Aug 9, 2024

Looking good, I'll try to play with it more next week. On the topic of file uploads, maybe a callback as a configuration option would be best so there aren't tons of weird dependencies. But maybe you could release batteries-included versions of the editor, since you're already building a pretty nice react one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants