IClassicRenderProps interface
đ Descriptionâ
Interface that specifies the props for the block renderer. Used when creating custom blocks.
đ Type declarationâ
interface IClassicRenderProps { id: string;Readonly l10n: L10n.Namespace;Readonly styles: IClassicStyles;Readonly attachments: IRunnerAttachments | undefined;Readonly view: "live" | "test" | "preview";Readonly name: JSX.Element | undefined;Readonly description: JSX.Element | undefined;Readonly explanation: JSX.Element | undefined;Readonly label: JSX.Element | undefined;Readonly placeholder: string;Readonly tabIndex: number;Readonly isFailed: boolean;Readonly isPage: boolean;Readonly ariaDescribedBy: string | undefined;Readonly ariaDescription: JSX.Element | undefined;Readonly focus: (e: FocusEvent) => void;Function blur: (e: FocusEvent) => void;Function autoFocus: (element: HTMLElement | null) => void;Function onSubmit: (() => void) | undefined;Function markdownifyToJSX: (md: string, lineBreaks?: boolean) => JSX.Element;Function markdownifyToURL: (md: string) => string;Function markdownifyToImage: (md: string) => string;Function markdownifyToString: (md: string) => string;Function }
đī¸ Propertiesâ
đˇī¸ ariaDescribedBy
â
Contains a aria-describedby
identifier when there is an ariaDescription
set for the block.
Typeâ
string
đˇī¸ ariaDescription
â
Contains an automatic generated aria description for the elements labeled with the ariaDescribedBy
identifier.
Typeâ
JSX.Element | undefined
đˇī¸ attachments
â
Reference to the attachments handler for processing file uploads.
Typeâ
Have a look at the Handling file uploads guide to learn how to use this feature.
đˇī¸ description
â
Contains the description of the block as a JSX.Element
. Any markdown used in the description is already processed. Most blocks implement this property and store the description of the block in it.
Typeâ
JSX.Element
| undefined
đˇī¸ explanation
â
Contains the explanation of the block as a JSX.Element
. Any markdown used in the explanation is already processed. Most blocks implement this property and store the explanation of the block in it.
Typeâ
JSX.Element
| undefined
đˇī¸ id
â
Contains a unique id (key) for the block.
Typeâ
string
đˇī¸ isFailed
â
Contains if the block validation has failed.
Typeâ
boolean
đˇī¸ isPage
â
Contains if the runner is in page mode.
Typeâ
boolean
đˇī¸ l10n
â
Contains a reference to the l10n (translation) namespace. This namespace contains the gettext functions for translating text.
Typeâ
Exampleâ
l10n._("Text to be translated");
l10n._n("1 car", "%1 cars", 10);
đˇī¸ label
â
Contains the label of the block as a JSX.Element
. Any markdown used in the label is already processed.
Typeâ
JSX.Element
| undefined
đˇī¸ name
â
Contains the name of the block as a JSX.Element
. Any markdown used in the name is already processed. Most blocks implement this property and store the name or title of the block in it.
Typeâ
JSX.Element
| undefined
đˇī¸ placeholder
â
Contains the placeholder of the block.
Typeâ
string
đˇī¸ styles
â
Reference to the styles of the runner.
Typeâ
đˇī¸ tabIndex
â
Retrieves a tab index value used for sequential keyboard navigation (usually with the Tab
key, hence the name). Each time this property is retrieved, it is incremented by 1.
Typeâ
number
đˇī¸ view
â
Contains the current view mode of the runner. It can be one of the following values:
live
: The form is running in normal (production) mode;test
: The form is running in test mode;preview
: The form is running in preview mode.
Typeâ
"live" | "test" | "preview"
âļī¸ Functionsâ
đ§ autoFocus
â
This function should be invoked to indicate that an element is able to receive auto focus. A reference to the element should be provided.
Signatureâ
(element: HTMLElement | null) => void
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
element | HTMLElement | undefined | No | Reference to an element that is able to gain input focus. |
đ§ blur
â
This function should be invoked to indicate that an element in the block lost focus. This is usually attached to the blur
event of input elements used in the block.
Signatureâ
(e: FocusEvent) => void
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
e | FocusEvent | No | Reference to the event interface. |
đ§ focus
â
This function should be invoked to indicate that an element in the block gained focus. This is usually attached to the focus
event of input elements used in the block.
Signatureâ
(e: FocusEvent) => void
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
e | FocusEvent | No | Reference to the event interface. |
đ§ markdownifyToImage
â
Parses a markdown string to a valid image URL.
Signatureâ
(md: string) => string
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the image URL.
đ§ markdownifyToJSX
â
Parses a markdown string to formatted JSX.
Signatureâ
(md: string, lineBreaks?: boolean) => JSX.Element
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
md | string | No | Specifies the markdown string to process. |
lineBreaks | boolean | Yes | Specifies if line breaks are supported or not (default is true ). |
Return valueâ
Returns the markdown JSX.Element
.
đ§ markdownifyToString
â
Parses a markdown string to a plain string.
Signatureâ
(md: string) => string
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the parsed string.
đ§ markdownifyToURL
â
Parses a markdown string to a valid URL.
Signatureâ
(md: string) => string
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the parsed URL.
đ§ onSubmit
â
This function should be invoked when a control wants to submit its value.
Signatureâ
() => void