RichText
{ tagName, className, allowedFormats, onChange, placeholder, name*, attributes*, setAttributes* }
/**
* @param {string} [tagName] - HTML tag name to use for the rich text element.
* @param {string} [className] - CSS class name for styling the rich text element.
* @param {Array} [allowedFormats] - Array of allowed text formats.
* @param {function} [onChange] - Callback called when the value changes.
* @param {string} [placeholder] - Placeholder text for the rich text element.
* @param {string} name - Attribute name identifying the rich text content.
* @param {object} attributes - Object containing block attributes.
* @param {function} setAttributes - Function to set new block attribute values.
*/
block.json
"testRichText": {
"type": "string",
"default": ""
},
index.js
import {
TwebBlockRichText,
} from '@tigriweb/components/controls';
index.js | edit()
<TwebBlockRichText
tagName="h2"
className="custom-class"
placeholder={ __('BlockControls...', 'your-theme-name') }
name="testRichText"
{...{ attributes, setAttributes }}
/>
TwebBlockRichText.Content
{ tagName, className, value* }
/**
* @param {string} [tagName] - HTML tag name to use for the rich text element.
* @param {string} [className] - CSS class name for styling the rich text element.
* @param {object} value - Current value of the rich text.
*/
index.js | save()
<TwebBlockRichText.Content
tagName="h2"
className="custom-class"
value={ attributes.testRichText }
/>
Last updated