sereneinserenade / tiptap-media-resize

Tiptap 2 Media 🌁 🎥 Resize, Realignment extension.
MIT License
113 stars 6 forks source link

Drag and drop functionality #1

Open jelleroorda opened 2 years ago

jelleroorda commented 2 years ago

Hey @sereneinserenade, great work!

I'm just leaving a feature request here after checking out the demo. It would be great if it were possible to drag and drop media to other places in the text. For example, when you add an image and then float it left. It would be great if you could drag it in front of some text so the text would go around the image.

sereneinserenade commented 2 years ago

Hi @jelleroorda thank you very much!

That's actually a very nice touch. I'd have to research and play around a bit to see how that would become possible in code. In the meantime, let me know if you already have any insight on how to implement this

mrcego commented 1 year ago

Hey @sereneinserenade!

Your extension is very useful. I'm learning how to create extension for Tiptap, and my main goal is "merging" your Extension with coolswitch extension for Drag And Drop and upload support, in case of images I mean. I'm rushing about it and try to understand how to do that, but both logics, at least for me, are uneven. Would you mind putting in the right direction to do this? This process would be end in a PR for the extension.

Thanks in advanced if any help is available.

sereneinserenade commented 1 year ago

hey, @mrcego

I've already made a pasteDropPlugin for it. here's a link

hope that helps

mrcego commented 1 year ago

hey, @mrcego

I've already made a pasteDropPlugin for it. here's a link

hope that helps

I have implemented the plugin, but I'm facing two issues now:

  1. The uploaded image is not being shown in the editor. The weird thing here is, log is showing image in the object from editor. And when save code in the VSCode, image is shown, so, reactivity issue here??

  2. Position menu from uploaded image when I hover it is not shown, probably because is not wrapped into ResizableMediaNodeView.vue component as article tag.

Could I sharing with you a repro link, if you have time to check it?

pbell23 commented 10 months ago

For the drag and drop functionality, I added the data-drag-handle attribute to the img element to make it work :

<img
          v-if="mediaType === 'img'"
          v-bind="node.attrs"
          ref="resizableImg"
          class="rounded-lg"
          :class="[`${isFloat && `float-${props.node.attrs.dataFloat}` || ''}`, `${isAlign && `align-${props.node.attrs.dataAlign}` || ''}`]"
          draggable="true"
          data-drag-handle
        >