setBlockData EDITOR

setBlockData API is used to change meta data of any content block in INK Editor.

Syntax

setBlockData(data : Object, path : Array<Number>)

Example

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

INKAPI.ready(() => {

  const EDITOR = INKAPI.editor;

  const data = {
    title: "my favorite cat",
    caption: "This is a picture of my favorite cat",
    alt: "Cat Playing",
  };

  EDITOR.setBlockData(data, [3]);

});

Parameters

Name

Type

Description

options

Object

Required. data to be implemented on block.

path

Array<Number>

Required. Path of the block.

options

Name

Type

Description

file

String

sets src url for the image block.

type

String

this option can change block type. Valid block types are: heading-two, heading-three, heading-four, numbered-list, bulleted-list, list-item, paragraph, quote.

title

String

sets title for the image block.

caption

String

sets caption text for the image block.

alt

String

sets alt text for the image block.

size

Number

sets image size range between 20 - 100.

quality

Number

set image quality range between 30 - 100.

align

String

Set alignment for the block. Valid alignments are: left, right, center.

Note

Learn more about how blocks work in INK editor here.