Skip to content

Commit

Permalink
fix: modify size 100% bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bae-sh committed Jun 1, 2024
1 parent 38aeff3 commit 8f4a9e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/imageResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ export const ImageResize = Image.extend({
default: 'width: 100%; height: auto; cursor: pointer;',
parseHTML: element => {
const width = element.getAttribute('width');
if (!width || isNaN(Number(width))) {
return;
}
return `width: ${width}px; height: auto; cursor: pointer;`;
return width
? `width: ${width}px; height: auto; cursor: pointer;`
: `${element.style.cssText}`;
},
},
title: {
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.5",
"version": "1.1.6",
"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 8f4a9e7

Please sign in to comment.