Module

image/image/utils

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

module

Filtering

Functions

  • createImageViewElement( writer, imageType ) → ContainerElement

    protected

    Creates a view element representing the image of provided image type.

    An 'imageBlock' type (block image):

    <figure class="image"><img></img></figure>
    

    An 'imageInline' type (inline image):

    <span class="image-inline"><img></img></span>
    

    Note that alt and src attributes are converted separately, so they are not included.

    Parameters

    writer : DowncastWriter
    imageType : 'imageBlock' | 'imageInline'

    The type of created image.

    Returns

    ContainerElement
  • determineImageTypeForInsertionAtSelection( schema, selection ) → 'imageBlock' | 'imageInline'

    protected

    Considering the current model selection, it returns the name of the model image element ('imageBlock' or 'imageInline') that will make most sense from the UX perspective if a new image was inserted (also: uploaded, dropped, pasted) at that selection.

    The assumption is that inserting images into empty blocks or on other block widgets should produce block images. Inline images should be inserted in other cases, e.g. in paragraphs that already contain some text.

    Parameters

    schema : Schema
    selection : Selection | DocumentSelection

    Returns

    'imageBlock' | 'imageInline'
  • getImageTypeMatcher( editor, matchImageType ) → MatcherPattern

    protected

    A function returning a MatcherPattern for a particular type of View images.

    Parameters

    editor : Editor
    matchImageType : 'imageBlock' | 'imageInline'

    The type of created image.

    Returns

    MatcherPattern