Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Fix image rendering #1377

Closed
flarnie opened this issue Sep 9, 2017 · 2 comments
Closed

Fix image rendering #1377

flarnie opened this issue Sep 9, 2017 · 2 comments
Assignees
Labels

Comments

@flarnie
Copy link
Contributor

flarnie commented Sep 9, 2017

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
In Firefox and Chrome (haven't tested other browsers) since 0b22d71 we don't get the image blocks when using convertFromHTMLToContentBlocks.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/stopachka/m6z0xn4r/.

You can see this in the examples/draft-0-10-0/convertFromHTML/convert.html file.

What is the expected behavior?

It should render an image.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?

Unreleased version of Draft.js, is only on master.

@flarnie flarnie added the bug label Sep 9, 2017
@flarnie flarnie self-assigned this Sep 9, 2017
@flarnie flarnie changed the title Fix image rendering in Firefox Fix image rendering Sep 9, 2017
flarnie added a commit to flarnie/draft-js that referenced this issue Sep 10, 2017
**what is the change?:**
We don't allow pasting whitespace-only blocks - see facebookarchive#231

In the past we set the 'src' as the text content of an 'img' block when
pasting/converting HTML, but sometimes the 'src' is really long and can
even crash the editor. Plus that's not really what users expect when
they paste an image.

An empty string as a default would be better but the code in
`convertFromHTML` needs refactored and for now I don't want to touch it.
The camera emoji is a cute and easy fix.

**why make this change?:**
Right now images are being dropped by `convertFromHTML

**test plan:**
Manual testing with examples/draft-0-10-0/convertFromHTML/convert.html

We should do a follow-up change to add a test that catches this.

**issue:**
facebookarchive#1377
facebook-github-bot pushed a commit that referenced this issue Sep 11, 2017
Summary:
**what is the change?:**
We don't allow pasting whitespace-only blocks - see #231

In the past we set the 'src' as the text content of an 'img' block when
pasting/converting HTML, but sometimes the 'src' is really long and can
even crash the editor. Plus that's not really what users expect when
they paste an image.

An empty string as a default would be better but the code in
`convertFromHTML` needs refactored and for now I don't want to touch it.
The camera emoji is a cute and easy fix.

**why make this change?:**
Right now images are being dropped by `convertFromHTML

**test plan:**
Manual testing with examples/draft-0-10-0/convertFromHTML/convert.html

We should do a follow-up change to add a test that catches this.

**issue:**
#1377

*Before* submitting a pull request, please make sure the following is done...

1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure that:
  * The test suite passes (`npm test`)
  * Your code lints (`npm run lint`) and passes Flow (`npm run flow`)
  * You have followed the [testing guidelines](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests)
5. If you haven't already, complete the [CLA](https://code.facebook.com/cla).

Please use the simple form below as a guideline for describing your pull request.

Thanks for contributing to Draft.js!

-

**Summary**

[...]

**Test Plan**

[...]
Closes #1378

Differential Revision: D5804382

fbshipit-source-id: f465a1a92155b02c5650acb9622e27e4e3714492
@flarnie
Copy link
Contributor Author

flarnie commented Oct 20, 2017

This should have been fixed. :)

@flarnie flarnie closed this as completed Oct 20, 2017
@michelson
Copy link

michelson commented Dec 18, 2018

Hi @flarnie , in which version this is fixed ? Using 0.10.5 we've hit this behavior .

midas19910709 added a commit to midas19910709/draft-js that referenced this issue Mar 30, 2022
Summary:
**what is the change?:**
We don't allow pasting whitespace-only blocks - see facebookarchive/draft-js#231

In the past we set the 'src' as the text content of an 'img' block when
pasting/converting HTML, but sometimes the 'src' is really long and can
even crash the editor. Plus that's not really what users expect when
they paste an image.

An empty string as a default would be better but the code in
`convertFromHTML` needs refactored and for now I don't want to touch it.
The camera emoji is a cute and easy fix.

**why make this change?:**
Right now images are being dropped by `convertFromHTML

**test plan:**
Manual testing with examples/draft-0-10-0/convertFromHTML/convert.html

We should do a follow-up change to add a test that catches this.

**issue:**
facebookarchive/draft-js#1377

*Before* submitting a pull request, please make sure the following is done...

1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure that:
  * The test suite passes (`npm test`)
  * Your code lints (`npm run lint`) and passes Flow (`npm run flow`)
  * You have followed the [testing guidelines](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests)
5. If you haven't already, complete the [CLA](https://code.facebook.com/cla).

Please use the simple form below as a guideline for describing your pull request.

Thanks for contributing to Draft.js!

-

**Summary**

[...]

**Test Plan**

[...]
Closes facebookarchive/draft-js#1378

Differential Revision: D5804382

fbshipit-source-id: f465a1a92155b02c5650acb9622e27e4e3714492
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants