image/image/utils
@ckeditor/ckeditor5-image/src/image/utils
Filtering
Functions
-
getSelectedImageWidget( selection ) → Element | null
Returns an image widget editing view element if one is selected.
-
getViewImgFromWidget( figureView ) → Element
Get view
<img>
element from the view widget (<figure>
). -
insertImage( model, [ attributes ], [ insertPosition ] )
Handles inserting single file. This method unifies image insertion using
findOptimalInsertionPosition
method.insertImage( model, { src: 'path/to/image.jpg' } );
Parameters
model : Model
[ attributes ] : Object
Attributes of inserted image
Defaults to
{}
[ insertPosition ] : Position
Position to insert the image. If not specified, the
findOptimalInsertionPosition
logic will be applied.
-
isImage( modelElement ) → Boolean
Checks if the provided model element is an
image
. -
isImageAllowed( model ) → Boolean
Checks if image can be inserted at current model selection.
-
isImageWidget( viewElement ) → Boolean
Checks if a given view element is an image widget.
-
toImageWidget( viewElement, writer, label ) → Element
Converts a given
Element
to an image widget:- Adds a custom property allowing to recognize the image widget element.
- Calls the
toWidget
function with the proper element's label creator.
Parameters
viewElement : Element
writer : DowncastWriter
An instance of the view writer.
label : String
The element's label. It will be concatenated with the image
alt
attribute if one is present.
Returns