Module

image/imageupload/utils

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

module

Filtering

Functions

  • createImageTypeRegExp( types ) → RegExp

    Creates a regular expression used to test for image files.

    const imageType = createImageTypeRegExp( [ 'png', 'jpeg', 'svg+xml', 'vnd.microsoft.icon' ] );
    
    console.log( 'is supported image', imageType.test( file.type ) );

    Parameters

    types : Array.<String>

    Returns

    RegExp
  • createLabeledInputView( locale ) → LabeledFieldView

    Creates a labeled field view.

    Parameters

    locale : Locale

    The localization services instance.

    Returns

    LabeledFieldView
  • fetchLocalImage( image ) → Promise.<File>

    Creates a promise that fetches the image local source (Base64 or blob) and resolves with a File object.

    Parameters

    image : Element

    Image whose source to fetch.

    Returns

    Promise.<File>

    A promise which resolves when an image source is fetched and converted to a File instance. It resolves with a File object. If there were any errors during file processing, the promise will be rejected.

  • isLocalImage( node ) → Boolean

    Checks whether a given node is an image element with a local source (Base64 or blob).

    Parameters

    node : Node

    The node to check.

    Returns

    Boolean
  • prepareIntegrations( editor ) → Object.<String, View>

    Creates an integrations object that will be passed to the ImageUploadPanelView.

    Parameters

    editor : Editor

    The editor instance.

    Returns

    Object.<String, View>

    The integrations object.