pub struct RichTextEditorProps {
pub name: String,
pub value: Option<String>,
pub formats: Vec<String>,
pub placeholder: Option<String>,
pub theme: String,
pub label: Option<String>,
pub error: Option<String>,
pub data_path: Option<String>,
pub required: Option<bool>,
}Expand description
Props for Component::RichTextEditor.
Renders a <div data-rich-text-editor> host whose runtime IIFE attaches a
Quill 2.0.3 (Snow theme) editor. On form submit the IIFE writes two hidden
inputs — {name}_delta (canonical Delta JSON, lossless) and {name}_html
(sanitized HTML, rendering input). The formats allowlist is the single
source of truth: it constrains both the Quill toolbar (init time) and the
HTML post-process (submit time). Image / video / HTML-paste paths are not
reachable through the prop surface.
Quill JS+CSS are loaded once per page from jsDelivr, SHA-384 SRI-pinned via
the RichTextEditorPlugin asset adapter. Multiple editor instances on the
same page deduplicate the asset to a single load.
Fields§
§name: StringBase form field name. The IIFE emits two hidden inputs on submit:
{name}_delta (Delta JSON) and {name}_html (sanitized HTML).
Must be unique within the page (not just within the form). The
renderer uses name as the DOM id of the editor host and the error
element (err-{name}). Two editors with the same name on one page
produce duplicate DOM ids, which breaks label association and the
error-element selector.
value: Option<String>Initial editor content. Auto-detected at runtime: parses as JSON
(Delta) when the string has an ops array; otherwise loaded as HTML
via clipboard.dangerouslyPasteHTML filtered by the formats
allowlist.
formats: Vec<String>Toolbar/allowlist whitelist. Drives both Quill’s toolbar config and
the HTML post-process. Default: ["bold", "italic", "underline", "list", "header", "link"] (D-18).
placeholder: Option<String>Optional placeholder shown by Quill when the editor is empty.
theme: StringQuill theme — only "snow" is supported in v1. Defaults to "snow".
label: Option<String>Optional visible label rendered above the editor host.
error: Option<String>Validation error message rendered below the editor with destructive token styling.
data_path: Option<String>JSON pointer for pre-fill at render time. Resolved value is passed as
the initial editor body (after html_escape). When both value and
data_path are set, value wins.
required: Option<bool>When true, the IIFE installs a guard that calls event.preventDefault
on form submit if quill.getText().trim().length === 0, surfacing the
destructive-token error region with a “Required” message.
Trait Implementations§
Source§impl Clone for RichTextEditorProps
impl Clone for RichTextEditorProps
Source§fn clone(&self) -> RichTextEditorProps
fn clone(&self) -> RichTextEditorProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RichTextEditorProps
impl Debug for RichTextEditorProps
Source§impl<'de> Deserialize<'de> for RichTextEditorProps
impl<'de> Deserialize<'de> for RichTextEditorProps
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RichTextEditorProps
impl JsonSchema for RichTextEditorProps
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RichTextEditorProps
impl PartialEq for RichTextEditorProps
Source§fn eq(&self, other: &RichTextEditorProps) -> bool
fn eq(&self, other: &RichTextEditorProps) -> bool
self and other values to be equal, and is used by ==.