Skip to content

Commit

Permalink
chore: add align info to img class
Browse files Browse the repository at this point in the history
  • Loading branch information
bae-sh committed May 18, 2024
1 parent b63bb4e commit 293c8b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/imageResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ export const ImageResize = Image.extend({
$container.appendChild($postionController);
};

// add position style and className
$positionContainer.appendChild($container);
const justifyContent = style.match(/justify-content: (.*?);/);
$positionContainer.setAttribute(
'style',
`display: flex; ${justifyContent ? justifyContent[0] : ''}`,
);

if (justifyContent) {
$img.className = `tiptap-image-${justifyContent[1]}`;
}

$container.setAttribute('style', `${style}`);
$container.appendChild($img);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiptap-extension-resize-image",
"version": "1.1.3",
"version": "1.1.4",
"type": "module",
"description": "A tiptap image resizing extension for React, Vue, Next, and VanillaJS. Additionally, it can align the image position.",
"main": "dist/index.js",
Expand Down

0 comments on commit 293c8b6

Please sign in to comment.