"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.insertObject = insertObject; var _insert = require("./insert"); var _specialCharacters = require("./special-characters"); /** * Internal dependencies */ /** @typedef {import('./types').RichTextValue} RichTextValue */ /** @typedef {import('./types').RichTextFormat} RichTextFormat */ /** * Insert a format as an object into a Rich Text value at the given * `startIndex`. Any content between `startIndex` and `endIndex` will be * removed. Indices are retrieved from the selection if none are provided. * * @param {RichTextValue} value Value to modify. * @param {RichTextFormat} formatToInsert Format to insert as object. * @param {number} [startIndex] Start index. * @param {number} [endIndex] End index. * * @return {RichTextValue} A new value with the object inserted. */ function insertObject(value, formatToInsert, startIndex, endIndex) { const valueToInsert = { formats: [,], replacements: [formatToInsert], text: _specialCharacters.OBJECT_REPLACEMENT_CHARACTER }; return (0, _insert.insert)(value, valueToInsert, startIndex, endIndex); } //# sourceMappingURL=insert-object.js.map