upload/utils
@ckeditor/ckeditor5-upload/src/utils
Filtering
Functions
-
findOptimalInsertionPosition( selection ) → Positionstatic
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 | DocumentSelectionThe selection based on which the insertion position should be calculated.
Returns
PositionThe optimal position.
-
isImageType( file ) → Booleanstatic
Checks if a given file is an image.
Parameters
file : File
Returns
Boolean