How to customize drag and drop handling? #36
-
In my case i have a row for image previews, however when i drag them over to the editor they get embedded the same as the original element, but i'd like to convert them to an admonition like |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @Kebab11noel, Thank you for giving the editor a try! Based on what you're saying, I assume that you would rather store images as markdown directives and not as html tags (or markdown images). To do so, you don't need to customize the drag and drop handling, but rather tap into the markdown processing itself and swap the way images are handled. Here's an example of a plugin that does that. Notice however, that the images are inline elements. So I am using the Let me know if I got that right or if you need any further help. |
Beta Was this translation helpful? Give feedback.
-
The error suggests that the mdast visitor has not caught the parsed MDAST node - or, maybe, you have another directive node that needs parsing? That's just a guess, of course. You can do some debugging at this line and see what happens there. If you can reproduce the problem somewhere in sample, I will take a look. |
Beta Was this translation helpful? Give feedback.
Hey @Kebab11noel,
Thank you for giving the editor a try! Based on what you're saying, I assume that you would rather store images as markdown directives and not as html tags (or markdown images).
To do so, you don't need to customize the drag and drop handling, but rather tap into the markdown processing itself and swap the way images are handled. Here's an example of a plugin that does that. Notice however, that the images are inline elements. So I am using the
TextDirective
:img
rather than the leaf (block)::img
.Let me know if I got that right or if you need any further help.