insertImage EDITOR

insertImage API is used to insert image into your INK editor content at the position of the cursor.

Syntax

insertImage({ src: String, caption?: String, alt?: String }) : Promise<void>

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import INKAPI from './inkapi.js'

INKAPI.ready(async () => {

  const EDITOR = INKAPI.editor;

  EDITOR.insertImage({
    src: "https://picsum.photos/500/400",
    caption: "Above is a random image",
    alt: "random image"
  });

});

Parameters

Name

Type

Description

options

Object

Required. data for image insertion.

options

Name

Type

Description

src

String

src url for the image.

caption?

String

caption text for the image.

alt?

String

alt text for the image.