Module

image/imageresize/utils/getselectedimagewidthinunits

@ckeditor/ckeditor5-image/src/imageresize/utils/getselectedimagewidthinunits

module

Filtering

Functions

  • getSelectedImageWidthInUnits( editor, targetUnit ) → DimensionWithUnit | null

    Returns image width in specified units. It is width of image after resize.

    * If image is not selected or command is disabled then `null` will be returned.
    * If image is not fully loaded (and it is impossible to determine its natural size) then `null` will be returned.
    * If `targetUnit` percentage is passed then it will return width percentage of image related to its accessors.
    

    Parameters

    editor : Editor

    Editor instance.

    targetUnit : string

    Unit in which dimension will be returned.

    Returns

    DimensionWithUnit | null

    Parsed image width after resize (with unit).