bae-sh / tiptap-extension-resize-image

tiptap-extension-resize-image
https://www.npmjs.com/package/tiptap-extension-resize-image
MIT License
58 stars 5 forks source link

After reloading, (size/position) styles ignored #5

Closed demiro closed 4 months ago

demiro commented 4 months ago

So, firstly I want to say - THANK YOU for the great extension!

I am trying to make it work correctly, and in edit mode, it works great! Image is loaded, all the icons show correctly, the toolbar as well. When for example set this:

<div style="position: relative; width: 572px; height: 381.333px; cursor: pointer; justify-content: center; cursor: pointer;"><img class="tiptap-image-center" src="https://someimage.url" style="width: 572px; height: 381.333px; cursor: pointer; justify-content: center;" draggable="true"></div>

what content.getHTML() returns is:

<img src=\"https://someimage.url\" style=\"width: 572px; height: 381.333px; cursor: pointer; justify-content: center;\" draggable=\"true\">

and this is what I save. So far, so good!

but when I am trying to load the content

const editor = useEditor({ ...editorSettings, content: articleStore.article?.content || "", });

I am getting this:

<div style="position: relative; width: 100%; height: auto; cursor: pointer; cursor: pointer;"><img src="https://someimage.url" style="width: 100%; height: auto; cursor: pointer;" draggable="true"></div>

Is there a setting that I need to look out for?

Also, is there a way to style the alignment icons?

bae-sh commented 4 months ago

Thank you @demiro

I was wondering the values that you have when you got bug. ex) editorSettings, articleStore.article?.content

But let you know, if you don't put any width, default is 100% in this extension.

And, I used google Icon as a alignment icons. So, if you want to customize it, how about patch this extension. Or your pull requests are also good chance! 😄

bae-sh commented 4 months ago

@demiro I check the bug that all size is saved 100% regardless of sizing. i'll fix asap

bae-sh commented 4 months ago

I fixed that bug in version 1.1.6. Thanks @demiro