ImageTypeCommand: Provide Configuration For "Is Valid Image" (other than default relying on src/uploadId attribute) #15653
Labels
domain:dx
This issue reports a developer experience problem or possible improvement.
domain:integration-dx
This issue reports a problem with the developer experience when integrating CKEditor into a system.
package:image
status:stale
type:improvement
This issue reports a possible enhancement of an existing feature.
📝 Provide a description of the improvement
When it comes to using the
ImageTypeCommand
for images, for example, served from a CMS, the image model representation may miss asrc
attribute depending on the overall design.Having this, image types
ImageInline
andImageBlock
cannot be toggled viaImageTypeCommand
due to its hard-wired restriction to only work on images with validsrc
attribute (or as the only alternative, theuploadId
).See:
ckeditor5/packages/ckeditor5-image/src/image/imagetypecommand.ts
Lines 66 to 71 in b5c31df
Our scenario requires a different approach (similar to the
uploadId
), that may benefit from some redesign to copy with theImageTypeCommand
restrictions, but just to sketch our scenario:Our images are represented by an image element (custom grammar, no HTML; roughly sketched example):
The
xlink:href
denotes the "strategy to retrieve the image BLOB data".In editing view, we load the BLOB lazily (and show a placeholder meanwhile) by eventually setting the
src
attribute to the "resolved BLOB data location". Thissrc
attribute later must not be stored in data layer (we currently prevent it even to appear in the model layer by blocking the corresponding upcast).Thus,
src
is never part of the model, but instead some ID similar touploadId
.💡 Suggestion
As possibly more concrete use-case, remove the hard-wired
uploadId
fromImageTypeCommand
as it is a forward-reference to a possibly not even installed plugin.Instead, let the image upload plugin use some to be specified API to register this "alternative src attribute", so that the
ImageTypeCommand
may respect it.This API then could also be used by other image architectures like ours.
📃 Other details
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: