upload/utils
@ckeditor/ckeditor5-upload/src/utils
Filtering
Functions
-
findOptimalInsertionPosition( selection ) → Position
static
Returns a model position which is optimal (in terms of UX) for inserting an image.
For instance, if a selection is in the middle of a paragraph, the position before this paragraph will be returned so that it is not split. If the selection is at the end of a paragraph, the position after this paragraph will be returned.
Note: If the selection is placed in an empty block, that block will be returned. If that position is then passed to
insertContent
, the block will be fully replaced by the image.Parameters
selection : Selection | DocumentSelection
The selection based on which the insertion position should be calculated.
Returns
Position
The optimal position.
-
isImageType( file ) → Boolean
static
Checks if a given file is an image.
Parameters
file : File
Returns
Boolean