Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bare <img> to be converted to model #5032

Closed
szymonkups opened this issue Nov 14, 2016 · 5 comments · Fixed by ckeditor/ckeditor5-image#97
Closed

Allow bare <img> to be converted to model #5032

szymonkups opened this issue Nov 14, 2016 · 5 comments · Fixed by ckeditor/ckeditor5-image#97
Assignees
Labels
package:image type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@szymonkups
Copy link
Contributor

Right now conversion for from view in data pipeline is very strict and only converts images represented by:

<figure class="image">
    <img src="..." alt="..." />
</figure>

We should allow single <img> (not wrapped in a <figure> element) to be converted to model image.

@szymonkups
Copy link
Contributor Author

Also, it might be worth checking if view to model conversion could not be simplified by using view converter builder, and if not - propose a solution to possibly extend builder with missing functionalities.

@Reinmar
Copy link
Member

Reinmar commented Nov 28, 2016

I also mentioned another case in https://github.com/ckeditor/ckeditor5-image/issues/11 where a containing block will need to be split upon conversion to model.

@Reinmar
Copy link
Member

Reinmar commented Nov 28, 2016

Also, it must also accept images inside e.g. <p>. I'm not sure how this should be handled upon conversion to the model, but it seems that the needs to be split.

So in the view we've got (let's assume it was pasted):

<p>x<img>x</p>

In the model paragraph cannot contain an image. By default, in such situation, we're filtering out the content which is not allowed in its parent. But in this specific situation, most likely, we'll want to preserve the image. So the block must be split.

The idea that @scofalik and @pjasiun proposed is to first convert the image into the <paragraph> element in the model (against schema's rules) and then, in a late <paragraph> converter post-fix this. This will be a special rule for a special case, cause, as I mentioned, in majority of cases, we're interested in filtering out disallowed stuff.

@Reinmar Reinmar changed the title Allow single <img> to be converted to model Allow bare <img> to be converted to model Dec 19, 2016
@Reinmar
Copy link
Member

Reinmar commented Dec 19, 2016

@scofalik scofalik self-assigned this Apr 11, 2017
@scofalik
Copy link
Contributor

PR adding conversion of bare <img> elements.

ckeditor/ckeditor5-image#97

I feel that <p>x<img>x</p> is a different problem and I will create a new issue for it.

Reinmar referenced this issue in ckeditor/ckeditor5-image Apr 24, 2017
Fix: Bare `<img>` (not wrapped with `<figure class="image">`) can now be pasted into the editor. Closes #8.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-image Oct 9, 2019
@mlewand mlewand added this to the iteration 10 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:image labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants