From 8f4a9e7b33acb40f0403acee89dc789646325763 Mon Sep 17 00:00:00 2001 From: bae-sh Date: Sat, 1 Jun 2024 23:21:40 +0900 Subject: [PATCH] fix: modify size 100% bug --- lib/imageResize.ts | 7 +++---- package.json | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/imageResize.ts b/lib/imageResize.ts index 0f1ce1e..7aff8f9 100644 --- a/lib/imageResize.ts +++ b/lib/imageResize.ts @@ -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: { diff --git a/package.json b/package.json index f99c019..0406658 100644 --- a/package.json +++ b/package.json @@ -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",