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

Image plugin extensible #6294

Closed
kaluginserg opened this issue Feb 20, 2020 · 2 comments
Closed

Image plugin extensible #6294

kaluginserg opened this issue Feb 20, 2020 · 2 comments
Labels
type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@kaluginserg
Copy link

Image plugin - sometimes can be not fit for custom purpose.
For example: adding custom tags inside figuge tag, or custom attibutes to img tag.
It is often tasks.
And best approach for that case - extend logic with micro custom plugins. And CKE5 architecture provides api for extending Image with other custom plugins...

But currently Image-plugin in some places in source code - blocking that.
Downcast logic in source code in several places:

const imgView = figureView.getChild( 0 )

It found here: src/image/utils.js and src/imageupload/imageuploadediting.jsand here src/imageupload/imageuploadprogress.js.
But if we want to extend Image... this code will cause for strange behaviour (for example if we are inserting some tags before the img tag).

In next place there is better approach, that provide ability to extending:

// Find an image element inside the figure element.
const viewImage = Array.from( data.viewItem.getChildren() ).find( viewChild => viewChild.is( 'img' ) );

Found here: https://github.com/ckeditor/ckeditor5-image/blob/0a6902af1d58c192aaccd432ffbb05a5ef1b5675/src/image/converters.js#L38

I offer update Image plugin in several places with last approach. It can solve many problems (in our cases) with extending Image.


If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@kaluginserg kaluginserg added the type:improvement This issue reports a possible enhancement of an existing feature. label Feb 20, 2020
@jodator
Copy link
Contributor

jodator commented Feb 20, 2020

Hi @kaluginserg you get this right and your PR looks also OK - it only needs tests for that change (we can talk about this in the PR).

However, as we just started the release process it will not be included in upcoming release.

@kaluginserg
Copy link
Author

@jodator - ok, i understood.
About release, maybe you can add this changes into.. let's say minor release: [email protected] ... ? It would be nice)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

No branches or pull requests

2 participants