Documentation
¶
Overview ¶
Package text provides a w-text rich-text editor custom element for wings.
w-text is a pluggable contenteditable editor whose every write passes through the epubhtml content policy (package epubhtml), so forbidden markup cannot exist in its content by construction. The editing engine lives in package wtext; this package is the widget shell: the w-input family anatomy (label/field/feedback, sizes, form participation), a toolbar rendered from the active profile with wings' own widgets, and the i18n/a11y wiring.
Dependencies ¶
The toolbar renders w-button and w-combobox elements, so an app using w-text must also register those widgets (widget/button, widget/combobox). A profile with InputItem controls (StyleToolbar, for one) also renders w-input (widget/input) inside the item's popover.
Usage in parent template ¶
<w-text label="Biography" profile="basic"
helper="Tell readers about yourself."
&value="{{bio}}">
</w-text>
value binds a wings.FieldCodec (e.g. field.NewText()); the codec's String seeds the editor and Get reads it back on blur. A plain string value works too (read-only-ish: replaced wholesale on external change).
Attributes ¶
- label — label text (or slot="label" for rich content)
- profile — registered wtext profile name (default: "basic")
- placeholder — shown while the editor is empty
- helper — helper text below the field (or slot="helper")
- error — error message (or slot="error")
- required — "true" shows the required mark
- disabled — standard HTML; makes the surface non-editable
Events fired to parent ¶
@change — fires on blur after the two-way write-back, so a bound
FieldCodec/Validator has already run; args[0] = epub-html string
@input — fires (coalesced) as content changes; args[0] = epub-html string
Native form participation ¶
w-text is form-associated: its serialized content is submitted under the host name, a bound Validator gates submission, form.reset() restores the initial content and clears undo history, and an ancestor <fieldset disabled> disables the surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var G goose.Alert
G is the logger for this module.
Functions ¶
This section is empty.
Types ¶
type Text ¶
type Text struct{}
Text implements wings.PranaMod and wings.Customizable for w-text.
func (*Text) ReplaceCSS ¶
ReplaceCSS replaces a CSS part and updates live instances.