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.
selection : Selection | DocumentSelection
The selection based on which the insertion position should be calculated.
The optimal position.
isImageType( file ) → Boolean
Checks if a given file is an image.
file : File