API
Demo
@alinea/input.richtext
/**
Create a rich text field configuration
*/
export function
createRichText
<
T
,
Q
=
TextDoc
<
T
>
>
(
label
:
Label
,
options
:
RichTextOptions
<
T
,
Q
>
)
:
RichTextField
<
T
,
Q
>
/**
Create a rich text field configuration
*/
export function
richText
<
T
,
Q
=
TextDoc
<
T
>
>
(
label
:
Label
,
options
:
RichTextOptions
<
T
,
Q
>
)
:
RichTextField
<
T
,
Q
>
/**
Internal representation of a rich text field
*/
export interface
RichTextField
<
T
,
Q
=
TextDoc
<
T
>
>
extends
Text
<
T
,
Q
>
{
label
:
Label
options
:
RichTextOptions
<
T
,
Q
>
shape
:
Shape
<
TextDoc
<
T
>
,
RichTextMutator
<
T
>
>
view
:
FieldRenderer
<
TextDoc
<
T
>
,
RichTextMutator
<
T
>
,
Field
<
TextDoc
<
T
>
,
RichTextMutator
<
T
>
,
Q
>
>
query
<
P
>
(
field
:
Expr
<
V
>
,
pages
:
Pages
<
P
>
)
:
undefined
|
Expr
<
Q
>
}
/**
Optional settings to configure a rich text field
*/
export type
RichTextOptions
<
T
,
Q
>
=
{
/**
Allow these blocks to be created between text fragments
*/
blocks
:
SchemaConfig
<
T
>
/**
Add instructional text to a field
*/
help
:
Label
/**
A default value
*/
initialValue
:
string
/**
Display a minimal version
*/
inline
:
boolean
/**
Field is optional
*/
optional
:
boolean
/**
Modify value returned when queried through `Pages`
*/
query
<
P
>
(
field
:
Expr
<
TextDoc
<
T
>
>
,
pages
:
Pages
<
P
>
)
:
undefined
|
Expr
<
Q
>
}