react-draft-wysiwyg icon indicating copy to clipboard operation
react-draft-wysiwyg copied to clipboard

Feature request: user-friendly removal of images from editor

Open tgus opened this issue 8 years ago • 2 comments

It looks like there is no user-friendly way to remove images from the editor after they are uploaded and added to the editor. A user can highlight the image and click delete/backspace and the image will be removed but that does not work consistently as in some cases the image markup/HTML may still persist inside the editor even though it appears to be removed to the user.

Perhaps the remove option could be included along with the existing alignment options?

diff --git a/src/renderer/Image/index.js b/src/renderer/Image/index.js
index f7e7a3d..07c048f 100644
--- a/src/renderer/Image/index.js
+++ b/src/renderer/Image/index.js
@@ -75,6 +75,12 @@ const getImageComponent = config => class Image extends Component {
         >
           R
         </Option>
+        <Option
+          onClick={this.removeEntity}
+          className="rdw-image-remove-option"
+        >
+          Remove
+        </Option>
       </div>
     );
   }

tgus avatar Jan 31 '18 01:01 tgus

I've added a pull request with a optional button to remove the image. Thanks to your idea, @tgus. PR: https://github.com/jpuri/react-draft-wysiwyg/pull/629

Huespal avatar Mar 15 '18 10:03 Huespal

Please add this feature, will be very useful

sahiljaidka224 avatar Jan 06 '20 04:01 sahiljaidka224