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

[v2] How to add a plugin that requires user input #1553

Closed
yellow1912 opened this issue Jul 8, 2021 · 1 comment
Closed

[v2] How to add a plugin that requires user input #1553

yellow1912 opened this issue Jul 8, 2021 · 1 comment
Assignees
Labels
Type: Documentation The issue or pullrequest is related to documentation

Comments

@yellow1912
Copy link

yellow1912 commented Jul 8, 2021

I have read through the document, and I feel like the document itself may benefit from having some have more complex plugin/extension examples. It seems like there are many ways to do things with tiptap, but without proper examples, we can do things the "bad" way.

Lets start with a use case:

  1. I would like to add support for an image extension that allows user to select images from an image list (click on the image button -> open the modal -> select the image -> image is inserted into the content). Using this example: Better Clarification in Docs for examples #112 it seems like I will have to trigger the modal from somewhere, perhaps I need to add showModal method directly to the component? If we do it like that then it will be difficult for other users to just simply include the plugin to use?
  2. I would like to be able to edit the alt text, and perhaps the caption for the image as well. Does it seem like I will need the NodeView for this purpose: https://www.tiptap.dev/guide/node-views?
  3. What would be the proper way to pack all this as a plugin that can be easily included and customized for other developers?

Edit 1: I see that here https://www.tiptap.dev/api/nodes/image you seem to suggest doing the same thing: adding an addImage method to the component. It feels a bit too elaborated? (Sorry English is not my first language). There are many manual steps that a dev need to do and that may result in many possible errors.

@yellow1912 yellow1912 added Type: Documentation The issue or pullrequest is related to documentation v2 labels Jul 8, 2021
@hanspagel
Copy link
Contributor

Not really sure what you’re asking for. We’ll build more and more extensions over time, something like the one you’re describing is on our list too.

Generally speaking, we see all provided extensions as examples on how to build extensions. On the other hand, the documentation can talk about the underlying concepts and has like 200 interactive demos and code snippets for different use cases. Sure, there aren’t all use cases covered and we won’t ever be able to cover all.

For your uses case there is a very simple demo that probably helps to get started, I don’t see us to extend that or write a guide on that, but probably add such an extension at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation The issue or pullrequest is related to documentation
Projects
None yet
Development

No branches or pull requests

2 participants