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

How to implement an image edit popup #242

Closed
francoisdop opened this issue Mar 19, 2019 · 3 comments
Closed

How to implement an image edit popup #242

francoisdop opened this issue Mar 19, 2019 · 3 comments

Comments

@francoisdop
Copy link

Thank you for the time spent developing this wrapper but I found very difficult to implement our own extensions due to the lack of documentation and tutorials.

I am looking to implement a small popup/modal that will appear next to an inserted image once clicked : this to have the possibility to either add a style/class to the image (left - right - float) or to change the src.

How could i achieve this ?? I am desperately looking for at least and idea how to start/ or being shown which functions to use.

  • I need an click event handler on the image, that will get the position for the popup to be shown next to the image
  • how to programatically add a class to the image (or add a style) and change the src attribute ??

Many thanks for any infos...

@erickwilder
Copy link
Contributor

You may share your main pain points in the open discussion to improve the documentation. In the meantime, I would recommend you to take a look at the structure of the Links example because it does something similar (but injecting a different Node (a tag) in the document.

Spending a bit of time reading through the Prosemirror docs also helps a lot because tiptap is really using a lot of its APIs instead of defining new things; as a starting point, the Commands is an essential part to create/patch how the editor works.

@laurensiusadi
Copy link

@francoisdop I would suggest making a custom node with Vue components. Copy everything from the image node, and start from there. You can check the example https://github.com/scrumpy/tiptap/tree/master/examples/Components/Routes/Embeds

@dev7ch
Copy link

dev7ch commented May 12, 2019

another approach, if you want a detached observer from the editor could be the implementation of a mutation observer, but destroy it wisely after usage.

https://github.com/dev7ch/app/blob/wysiwyg-replacement/src/interfaces/wysiwyg-full/components/EditorContent.vue#L111

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

6 participants