setBlockData ``EDITOR`` ======================= `setBlockData` API is used to change meta data of any content block in INK Editor. Syntax ++++++ .. code-block:: javascript setBlockData(data : Object, path : Array) Example +++++++ .. code-block:: javascript :linenos: 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`` | 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 <../../advanced/INK-Editor-Blocks-Architecture.html>`_.