@astl/editor
The editor-agnostic authoring kit: createAuthoring, the insert menu, inspector, issues and preview elements, and the textarea adapter.
Classes
Section titled “Classes”AstlInsertMenu
Section titled “AstlInsertMenu”<astl-insert-menu>: what authors can add, in named groups (groups): "Components" (each type with its default
template), "Exercises" (the types' named starters, when any) and "Content" ("Picture", which asks for the picture in a
dialog, the help for students, "Check button", one Check for the questions above it, and "Page break" when the editor
can split pages, EditorAdapter.splitPage). Each entry shows its icon, its
name and a one-line description, which together name its button; a press inserts at the cursor. The descriptions of
types with menuMessages load when the menu is first shown (inside a popover: when that opens).
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlInsertMenu(): AstlInsertMenu;Returns
Section titled “Returns”Overrides
Section titled “Overrides”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
adapter |
EditorAdapter | null |
- |
authoring |
Authoring | null |
- |
dialog |
| AstlPictureDialog | null |
The picture dialog to ask with; null (default): this element's own. |
filter |
string |
Shows only the entries whose label or description holds this text (any case, accents ignored), and a note when none does. Default '': every entry. |
groups |
readonly InsertGroup[] |
The groups shown, in their own order. Default: all of them. A lone group's title is for screen readers only: the place that shows the menu names it (the toolbar's "Templates"). |
picking |
boolean |
Whether the table picker shows, after "Table" was pressed: beside the list, or in its place in a toolbar narrower than 30rem (a phone). Reflected as the picking attribute; a search or the popover the menu is in closing ends it. |
Methods
Section titled “Methods”add(tag, template?): Promise<string | null>;What a press on a component or exercise entry does: inserts it (insert), after asking for its picture when the
type needs one. Resolves with the inserted HTML, or null when cancelled.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
template? |
string |
Returns
Section titled “Returns”Promise<string | null>
addCheck()
Section titled “addCheck()”addCheck(): string | null;Inserts a Check element (astl-check) at the cursor (insertCheck): after the block the cursor is in, its for
the questions of the run of text right above it, selected; its card lists its page's questions to tick. Returns
its HTML, or null without an editor.
Returns
Section titled “Returns”string | null
addHelp()
Section titled “addHelp()”addHelp(kind): Promise<string | null>;Adds a hint, the explanation or a feedback text to the graded element at the cursor (the inspector's help form shows it, focused), or else to the page at the cursor. Resolves with the HTML put on the page, '' when the element got it, or null without an editor.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
kind |
HelpKind |
Returns
Section titled “Returns”Promise<string | null>
insert()
Section titled “insert()”insert( tag, template?, picture?): string | null;Inserts a new element of tag at the cursor: its default template, or the named starter template; with
picture, the element takes it (a type whose zones or pins sit on a picture: its picture field's address, its
alt text and size). An element whose companion its page lacks brings it at the end of the page (the word bank of
a first gap there); the cursor stays on the new element. Returns its source HTML, or null without authoring or
adapter.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
template? |
string |
picture? |
PictureFields |
Returns
Section titled “Returns”string | null
insertBadge()
Section titled “insertBadge()”insertBadge(): string | null;Inserts a badge at the cursor (insertBadge), selected for its card. Returns its HTML, or null without an editor.
Returns
Section titled “Returns”string | null
insertFrame()
Section titled “insertFrame()”insertFrame(): string | null;Inserts a frame at the cursor (EditorStyles.insertLayout), the cursor in its title. Returns its HTML, or null
without an editor or one that cannot.
Returns
Section titled “Returns”string | null
insertLayout()
Section titled “insertLayout()”insertLayout(name): Promise<string | null>;Inserts a layout at the cursor (EditorStyles.insertLayout), the cursor in its first empty block. Beside a picture
it asks for the picture first, as "Picture" does, and cancelling inserts nothing. Resolves with its HTML, or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
LayoutName |
Returns
Section titled “Returns”Promise<string | null>
insertPageBreak()
Section titled “insertPageBreak()”insertPageBreak(): string | null;Inserts a page break at the cursor (EditorAdapter.splitPage): the new page's id, or null.
Returns
Section titled “Returns”string | null
insertPicture()
Section titled “insertPicture()”insertPicture(): Promise<string | null>;Asks for a picture in the dialog and inserts it at the cursor. Resolves with its HTML, or null when cancelled.
Returns
Section titled “Returns”Promise<string | null>
insertRule()
Section titled “insertRule()”insertRule(): string | null;Inserts a horizontal rule (<hr>) as insert puts a block: after the block the cursor is in, or in the place of an
empty line. Returns its HTML, or null without an editor.
Returns
Section titled “Returns”string | null
insertTable()
Section titled “insertTable()”insertTable(shape?): string | null;Inserts an empty table at the cursor (EditorStyles.insertLayout, tableHtml), the cursor in its first cell: the
picker's shape, or shape's values in its place. Returns its HTML, or null without an editor or one that cannot.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
shape? |
Partial<TableShape> |
Returns
Section titled “Returns”string | null
insertTask()
Section titled “insertTask()”insertTask(): string | null;Inserts a task at the cursor (insertTask), with a fresh id, the cursor in its instruction. Returns its HTML, or null
without an editor or one that cannot.
Returns
Section titled “Returns”string | null
pickTable()
Section titled “pickTable()”pickTable(): Promise<void>;Shows the table picker (picking), its grid focused, or its first counter on a phone: a size, a header row (on by
default) and a header column, then Enter, a click on the grid or "Insert table" inserts it (insertTable).
Returns
Section titled “Returns”Promise<void>
AstlInspector
Section titled “AstlInspector”<astl-inspector>: a form for the component at the cursor (answers, alternatives, correct options, whether each
statement is true, the category of each card, scoring, points, variant, look), or, with the cursor outside every
component, the document's own settings (its look). Every edit goes through authoring.update and the adapter
(replaceElement, or setSource for the document), so the editor stays the source of truth. A block component's
head has "Move up", "Move down" and "Delete" (EditorAdapter.moveBlock, removeBlock, at getCursor), each left
out when the adapter cannot do it; at its page's start or end, a move is unavailable (aria-disabled). The head
shows the type's icon and name and the element's id in a chip; under it, the element's own issues, as banners. The
custom property --astl-inspector-columns (default 1) sets the form's columns: with 2, selects, numbers and short
texts sit side by side and every other field spans the row.
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlInspector(): AstlInspector;Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type |
|---|---|
adapter |
EditorAdapter | null |
authoring |
Authoring | null |
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get model(): InspectorModel | null;The inspector model on screen (a component's, or the document's), or null.
Returns
Section titled “Returns”InspectorModel | null
Methods
Section titled “Methods”openHelp()
Section titled “openHelp()”openHelp(part): Promise<void>;Opens the help for students of the graded element at the cursor at part, as a tag on its frame asks
(astl-help-open): the section opens and the part's first field takes the focus (a hint's, or "Add a hint" without
one; the first feedback text the element has). Nothing without a graded element at the cursor.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
part |
HelpPart |
Returns
Section titled “Returns”Promise<void>
AstlIssues
Section titled “AstlIssues”<astl-issues>: live validation of the whole document in the UI locale, errors first. Selecting an issue moves the
editor's cursor to its element (adapter.select).
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlIssues(): AstlIssues;Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type |
|---|---|
adapter |
EditorAdapter | null |
authoring |
Authoring | null |
Accessors
Section titled “Accessors”issues
Section titled “issues”Get Signature
Section titled “Get Signature”get issues(): readonly Issue[] | null;The issues on screen (null before the first validation).
Returns
Section titled “Returns”readonly Issue[] | null
Methods
Section titled “Methods”validate()
Section titled “validate()”validate(): void;Validates now instead of waiting for the debounce.
Returns
Section titled “Returns”void
AstlPictureDialog
Section titled “AstlPictureDialog”<astl-picture-dialog>: asks for a picture in a modal dialog: a file, uploaded with the host's uploadAsset, one
from the host's library (pickPicture), or an address (the only way without either, as it says); the alt text,
required unless the picture is decorative (alt=""); and, for a new picture, an optional caption. The address must
pass the authoring's URL policy, an uploaded or picked one too. ask resolves with the fields, or null when the
author cancels. While the library is open the dialog steps aside: it closes and keeps every field, so a modal of
the host's own, outside the top layer, takes the pointer and the keys; it opens again when the library settles.
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlPictureDialog(): AstlPictureDialog;Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type |
|---|---|
adapter |
EditorAdapter | null |
authoring |
Authoring | null |
Methods
Section titled “Methods”ask(request?): Promise<PictureFields | null>;Opens the dialog. Resolves with the picture's fields, or null when the author cancels.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request? |
PictureRequest |
Returns
Section titled “Returns”Promise<PictureFields | null>
AstlPictureField
Section titled “AstlPictureField”<astl-picture-field>: the inspector's picture-regions and picture-points fields. The picture (by address,
uploaded with the host's uploadAsset or chosen from its library, pickPicture) with its zones or pins drawn on
it in palette colours and numbered; drag on it to draw a zone, click to place a pin; and every value in number
fields, so nothing needs a pointer. Changes go to the inspector as astl-field-change events.
Extends
Section titled “Extends”LitElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlPictureField(): AstlPictureField;Returns
Section titled “Returns”Overrides
Section titled “Overrides”LitElement.constructorProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
authoring |
Authoring | null |
- |
element |
string | null |
The source id of the element the field belongs to (the inspector sets it). |
field |
Field | null |
- |
AstlPreview
Section titled “AstlPreview”<astl-preview>: a button that compiles the current source with a throw-away salt and plays it in <astl-player>
with local grading and the authoring's style templates, the way a student sees it, under policy. Invalid sources
show their errors instead. Tokens set on the preview reach the player; the player's events stay inside.
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlPreview(): AstlPreview;Returns
Section titled “Returns”Overrides
Section titled “Overrides”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
adapter |
EditorAdapter | null |
- |
authoring |
Authoring | null |
- |
hintPosition |
HintPosition |
Where the player puts a question's hint (hint-position), as on <astl-player>: row, in its help row after its Check (the default), or top, at the top of the question; another value is row. Set it as the host's students' player has it. A change applies at once. |
pageNav |
PageNav |
How the player shows a view of several pages (page-nav), as on <astl-player>: bar (the default) or contents, a table of contents. Set it as the host's students' player has it. A change applies at once. |
policy |
AttemptPolicy |
The policy the preview plays and grades under, the one the host's students get (default PRACTICE_POLICY). A change plays the preview again, once it has been shown. |
Accessors
Section titled “Accessors”player
Section titled “player”Get Signature
Section titled “Get Signature”get player(): AstlPlayer | null;The player, once the first preview started.
Returns
Section titled “Returns”AstlPlayer | null
Get Signature
Section titled “Get Signature”get state(): PreviewState;idle, loading, ready, invalid (errors shown) or failed.
Returns
Section titled “Returns”PreviewState
Methods
Section titled “Methods”refresh()
Section titled “refresh()”refresh(): Promise<void>;Compiles the current source and plays it. Resolves when the player is ready or the errors are shown.
Returns
Section titled “Returns”Promise<void>
AstlToolbar
Section titled “AstlToolbar”<astl-toolbar>: a word processor's toolbar for the editor in adapter, one row while it fits. By default, in order:
the text style (a menu: paragraph, heading, subheading), bold, italic, underline, link, the two lists; the host's
featured inserts as buttons, "Elements" (every component and content insert) and "Templates" (the named starters),
menus with a search over one <astl-insert-menu>; the types' commands on the selection (EditorDescriptor.wrap,
"Mark word"); the view switch (views, two or more: a segmented control of radios); undo and redo at the end.
layout names the items and their order. Controls the adapter has no capability for are left out (format, undo,
wrap). One tab stop: the arrow keys, Home and End move along it. Format buttons show the state at the cursor:
pressed, or unavailable (aria-disabled, still focusable). A press never moves the editor's cursor: a pointer's
leaves the focus in the editor, and a key's gives it back. Each button is a part, button button-<name>. The host's
elements in the slots start and end sit at the bar's ends, each with its own tab stop.
Extends
Section titled “Extends”AuthoringElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AstlToolbar(): AstlToolbar;Returns
Section titled “Returns”Overrides
Section titled “Overrides”AuthoringElement.constructorProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
adapter |
EditorAdapter | null |
- |
authoring |
Authoring | null |
- |
featured |
readonly string[] |
The inserts shown as buttons, in order: component tags (their default template), tag:template for a named starter, and the kit items text (an empty paragraph after the cursor's block), picture and page-break. Unknown names are skipped. Default: none (everything is under "Elements" and "Templates"). |
layout |
ToolbarLayout |
The items and their order: groups of item names (TOOLBAR_ITEMS), a rule between groups. An item that is not named is not drawn; an unknown name is skipped, a name given twice shows at its first place, and the view switch is a group of its own. Default: DEFAULT_TOOLBAR_LAYOUT. |
view |
string |
The name of the current view. |
views |
readonly ToolbarView[] |
The views of the view switch, in order; the first is the one the adapter edits, and in any other only the switch works. A pick fires astl-toolbar-view (bubbles, composed) with the view's name in detail.view; the host then sets view. Fewer than two (default: none): no switch. |
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get menu(): AstlInsertMenu | null;The insert menu of "Elements" and "Templates": insert from it as a host would from <astl-insert-menu>.
Returns
Section titled “Returns”AstlInsertMenu | null
popupOpen
Section titled “popupOpen”Get Signature
Section titled “Get Signature”get popupOpen(): boolean;Whether one of the toolbar's popups is open: the style menu, the link dialog, an insert menu, a style popup or the style panel. An Escape that closes one goes no further than the toolbar's root, so a keydown listener on an editor around it never hears it.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”openMenu()
Section titled “openMenu()”openMenu(menu): Promise<void>;Opens "Elements", "Templates" or "Layout" with its search, as its button does.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
menu |
InsertMenu |
Returns
Section titled “Returns”Promise<void>
openStyle()
Section titled “openStyle()”openStyle(target): Promise<void>;Asks for the style form of a target at the cursor, or the rules, as the style menu does: fires astl-style-open,
and unless a host cancels it, shows them in a popup (they load now).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
target |
| EditorStyleTargetKind | "rules" |
Returns
Section titled “Returns”Promise<void>
UploadRefused
Section titled “UploadRefused”What a host's uploadAsset or pickPicture rejects with to tell the author why: its message, already in the
editor's locale, is shown as it is, instead of the generic failure text.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UploadRefused(message, options?): UploadRefused;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message |
string |
options? |
ErrorOptions |
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructorInterfaces
Section titled “Interfaces”AstlHelpForm
Section titled “AstlHelpForm”Extends
Section titled “Extends”AuthoringElement
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
adapter |
EditorAdapter | null |
- |
authoring |
Authoring | null |
- |
element |
string | null |
Source id of the element whose help this is. |
inline |
boolean |
The element sits in a line of text: its help holds text, not paragraphs. |
AstlStyleForm
Section titled “AstlStyleForm”<astl-style-form>: the style of an element at the cursor (target, or what the cursor is innermost in), or of a
rule of the document (rule): text, background and border, spacing, size and position, the named style, and "Own
CSS", which says what the allow-list refused and why. "Save as a style" makes the element's own style a named one.
Each commit of a field (a change) is one undo step, and the focus stays in the form. The adapter's style
(EditorStyles) does the work; without it the form says so. Comes with loadStyleElements, on first use.
Extends
Section titled “Extends”AuthoringElement
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
adapter |
EditorAdapter | null |
- |
authoring |
Authoring | null |
- |
rule |
| Pick<EditorStyleRule, "name" | "for"> | null |
A rule to edit in place of an element: by its name, or for a tag. |
target |
| EditorStyleTargetKind | null |
What the form styles, of what the cursor is in; null: the innermost. |
AstlStyleRules
Section titled “AstlStyleRules”<astl-style-rules>: the document's rules, each opening the form that edits it. "Text styles" holds a rule per tag
(every paragraph, every heading of the exercise), "My styles" the named ones: add, rename, edit, delete. A deleted
style leaves no class behind. Everything is one undo step, undone here or in the editor. A host places it (a view of
its own, a card), with authoring and adapter, after loadStyleElements; the toolbar's style menu opens it in a
popup otherwise.
Extends
Section titled “Extends”AuthoringElement
Properties
Section titled “Properties”| Property | Type |
|---|---|
adapter |
EditorAdapter | null |
authoring |
Authoring | null |
Authoring
Section titled “Authoring”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
descriptors |
readonly |
readonly EditorDescriptor[] |
- |
elements |
readonly |
readonly ElementEntry[] |
- |
engine |
readonly |
Engine |
- |
fonts |
readonly |
readonly EditorFont[] |
The fonts the style controls offer, each stack in the allow-list's normal form. |
locale |
readonly |
string |
- |
pickPicture |
readonly |
PickPicture | null |
The host's picture library, or null. |
styles |
readonly |
readonly (EditorStylePreset & object)[] |
The ready styles the style menu and the style form offer, each style in the allow-list's normal form and each with its label: the host's, else the kit's message style.preset.<name> in the authoring locale, else the name. |
styleTemplates |
readonly |
readonly StyleTemplate[] |
- |
uploadAsset |
readonly |
UploadAsset | null |
The host's upload, or null: files are added by address only. |
urlPolicy |
readonly |
UrlPolicy |
- |
Methods
Section titled “Methods”addMessages()
Section titled “addMessages()”addMessages(catalogs): void;Adds the catalogs of a part of the kit that loads later, under the host's catalogs, which may override them; t
has them at once. Adding the same ones again does nothing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
catalogs |
readonly MessageCatalog[] |
Returns
Section titled “Returns”void
assignIds()
Section titled “assignIds()”assignIds(source): string;source with fresh ids on pages, components and Check elements that lack one (or have an empty one).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”string
describe()
Section titled “describe()”describe( issue, source?, options?): string;An issue as a sentence in the authoring locale. With the document it is about (source), a component's issue
names the component as the author sees it, never by its id (the id stays in issue.at for "Show"): a block
component by the number of its block on its page, as its card's head shows it ("Question 2 on page 1" for block 2),
a component in text by its number among the components of its type on its page ("Gap 3 on page 1"); with
page: false, without its page ("Question 2").
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
issue |
Issue |
source? |
string |
options? |
DescribeOptions |
Returns
Section titled “Returns”string
descriptor()
Section titled “descriptor()”descriptor(tag): EditorDescriptor | null;The descriptor of a component tag, or null.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
Returns
Section titled “Returns”EditorDescriptor | null
inspect()
Section titled “inspect()”inspect(elementHtml, source?): InspectorModel | null;The inspector model of one component element (source HTML), or of a Check element (astl-check: its button's text
and a check-targets field), or null for elements it does not know. With the whole document (source), fields
offer what other elements hold (the words of the bank a drop takes its words from, the questions of a check's page)
and a question a Check element checks says which (checkedBy); without it they show the attribute's own control.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
elementHtml |
string |
source? |
string |
Returns
Section titled “Returns”InspectorModel | null
inspectDocument()
Section titled “inspectDocument()”inspectDocument(source): InspectorModel | null;The document's own settings (its style template) as an inspector model for <astl-doc>, or null when the source
has no <astl-doc> root or there is nothing to set. Apply its changes with update(source, change): the first
element of the source is the document, so only its start tag changes.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”InspectorModel | null
instantiate()
Section titled “instantiate()”instantiate( tag, source, templateId?, selection?): string;The descriptor's template, or its named starter templateId, ready to insert into source: {{id}} becomes
<idPrefix>-<n> with the smallest n whose id source does not use, {{selection}} the escaped selection (the
text the author selected, EditorAdapter.selectedText; default ''), {{t:key}} an escaped message of the
manifest namespace, and other components written without an id get fresh ones too. An element of a type with a
companion and an empty attribute names the first such element of the template, else of source, else the one
withCompanion adds. Throws for a tag without a descriptor or an unknown starter.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
source |
string |
templateId? |
string |
selection? |
string |
Returns
Section titled “Returns”string
loadMenuMessages()
Section titled “loadMenuMessages()”loadMenuMessages(): Promise<void>;Loads the menuMessages option's catalogs (what only insert menus show) once; t has them when it resolves. A
failed load resolves too, and the next call tries again.
Returns
Section titled “Returns”Promise<void>
outline()
Section titled “outline()”outline(source): Outline;Pages, their blocks and components, points and issue counts.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”preview()
Section titled “preview()”preview(source, options?): Promise<PreviewResult>;Compiles with a random per-session salt and grades locally, under options.policy (default PRACTICE_POLICY). The
source is not stored anywhere.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
options? |
PreviewOptions |
Returns
Section titled “Returns”Promise<PreviewResult>
setPageCheck()
Section titled “setPageCheck()”setPageCheck( source, check, page?): string;source with check set (check: true) or cleared on the page page, or on every page when it is left out: a
page's own Check in practice. A document without pages becomes one page with a fresh id (page-<n>) and check;
clearing keeps the pages as they are (a document that became one page stays one). Byte-identical when nothing
changes. In an editor, EditorAdapter.setPageCheck does the same as one undo step.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
check |
boolean |
page? |
string |
Returns
Section titled “Returns”string
t( namespace, key, params?): string;A message in the authoring locale: kit (astl.editor), descriptor, engine and extra catalogs.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
namespace |
string |
key |
string |
params? |
Readonly<Record<string, string | number>> |
Returns
Section titled “Returns”string
templates()
Section titled “templates()”templates(tag): readonly EditorTemplate[];The named starters of a component tag (EditorDescriptor.templates); none without a descriptor.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
Returns
Section titled “Returns”readonly EditorTemplate[]
update()
Section titled “update()”update(elementHtml, change): string;The element HTML with one inspector change applied; everything else stays byte-identical.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
elementHtml |
string |
change |
InspectorChange |
Returns
Section titled “Returns”string
validate()
Section titled “validate()”validate(source): ValidationReport;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”withCompanion()
Section titled “withCompanion()”withCompanion( tag, source, id?): string | null;source (with an inserted tag element) where that element, the one with the id id (default: the first whose
companion attribute names none on its page), names a companion element of its own page, as pages play one at a
time: the first one there, else the descriptor's companion template, added at the end of that page (of the
document, without pages). Null when nothing changes: the type has no companion, or the element names one of its
page already.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
source |
string |
id? |
string |
Returns
Section titled “Returns”string | null
AuthoringOptions
Section titled “AuthoringOptions”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
catalogs? |
readonly |
readonly MessageCatalog[] |
More or overriding catalogs (any namespace), e.g. another UI locale. |
descriptors |
readonly |
readonly EditorDescriptor[] |
One per component type authors can insert and inspect. Each tag must be registered in the engine. |
elements? |
readonly |
readonly ElementEntry[] |
Player elements for <astl-preview>, eager or lazy. |
engine |
readonly |
Engine |
- |
fonts? |
readonly |
readonly EditorFont[] |
The fonts the style controls offer, in order. Default DEFAULT_FONTS, stacks every system has. A stack the style allow-list refuses throws. |
locale |
readonly |
string |
The author's UI locale: labels, issues, template texts. |
menuMessages? |
readonly |
() => Promise<MessageCatalog[]> |
Catalogs only insert menus show (the one-line descriptions), loaded when a menu first opens rather than with the editor (loadMenuMessages): the built-ins' are the components package's builtInMenuMessages. The host's catalogs override them. |
pickPicture? |
readonly |
PickPicture |
Opens the host's own picture library: the picture dialog and picture fields offer it beside the upload. The address it gives must pass urlPolicy. The picture dialog closes while the library is open, keeping what the author typed, so a modal of the host's own takes the pointer and the keys; it opens again when the library settles. Reject with UploadRefused to tell the author why. |
styles? |
readonly |
readonly EditorStylePreset[] |
The ready styles the style menu and the style form offer, in order; []: none. Default DEFAULT_STYLES. A name isStyleName refuses, a declaration the style allow-list refuses, or a name given twice throws. |
styleTemplates? |
readonly |
readonly StyleTemplate[] |
Style templates authors can pick (register the same ones with the engine and the player): the inspector offers them per component and for the whole document, labelled from their catalogs; <astl-preview> renders them. |
uploadAsset? |
readonly |
UploadAsset |
Stores a picture file and returns its address (and size): the host's upload, used by the picture dialog, by pictures pasted or dropped into the editor and by picture fields; also by url fields with accept (a video, its captions). The address must pass urlPolicy. Without it, files are added by address only (pictures also from pickPicture). signal aborts when the author cancels or picks another file. The file's type is the browser's guess: check type and size on the server, and serve SVG with nosniff. Reject with UploadRefused to tell the author why. |
urlPolicy? |
readonly |
UrlPolicy |
The engine's URL policy (createEngine({ urlPolicy })): the preview's player cleans with it and editors check picture addresses with it before they show them. Default isSafeUrl. |
CheckboxFieldModel
Section titled “CheckboxFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”CheckTargetModel
Section titled “CheckTargetModel”A question a Check element can check, in its check-targets field.
Properties
Section titled “Properties”CheckTargetsFieldModel
Section titled “CheckTargetsFieldModel”The questions a Check element checks (for): the graded questions of its page in order, each ticked when it checks
it; one another Check element has says which. A change writes for with the ticked ones in this order (empty for
none: it then checks nothing).
Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"check-targets" |
- |
label |
readonly |
string |
Translated label. |
name |
readonly |
string |
The attribute it writes: for. |
targets |
readonly |
readonly CheckTargetModel[] |
- |
ChildChoiceFieldModel
Section titled “ChildChoiceFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
attribute |
readonly |
string |
- |
children |
readonly |
readonly ChildChoiceModel[] |
- |
control |
readonly |
"select" | "radios" |
Radios for the enum values of the attribute, a select for the ids of other children (options). |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"child-choice" |
- |
label |
readonly |
string |
Translated label. |
tag |
readonly |
string |
- |
ChildChoiceModel
Section titled “ChildChoiceModel”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
id |
readonly |
string | null |
- |
index |
readonly |
number |
Position among the children with this tag, from 0 (what child-choice changes use). |
label |
readonly |
string |
The child's text, or a placeholder when it is empty. |
options |
readonly |
readonly InspectorOption[] |
The choices of this child. Enum source: the attribute's values, the same for every child (an absent or unknown value matches none). Child source: each option child's id with its text, plus the "not set" option when the value is absent and the written value itself when it names no option (so the control shows what the source says). |
value |
readonly |
string |
The written value; '' when absent. |
ChildFlagFieldModel
Section titled “ChildFlagFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
attribute |
readonly |
string |
- |
children |
readonly |
readonly ChildFlagModel[] |
- |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"child-flag" |
- |
label |
readonly |
string |
Translated label. |
tag |
readonly |
string |
- |
ChildFlagModel
Section titled “ChildFlagModel”Properties
Section titled “Properties”ChildTextFieldModel
Section titled “ChildTextFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
attribute |
readonly |
string |
- |
children |
readonly |
readonly ChildTextModel[] |
- |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"child-text" |
- |
label |
readonly |
string |
Translated label. |
tag |
readonly |
string |
- |
ChildTextModel
Section titled “ChildTextModel”Properties
Section titled “Properties”ContentTextFieldModel
Section titled “ContentTextFieldModel”The element's own plain text, on one line (a badge's): a change replaces its whole content (kind: 'text').
Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”DescribeOptions
Section titled “DescribeOptions”How Authoring.describe names a component.
Properties
Section titled “Properties”EditorFont
Section titled “EditorFont”A font a host offers (defineEditor({ fonts })): its name in the menus, and its CSS stack.
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
name |
readonly |
string |
stack |
readonly |
string |
EditorStylePreset
Section titled “EditorStylePreset”A ready style a host offers (defineEditor({ styles })), as a word processor has its built-in ones. Picked, it is
written into the document as a named style (<astl-style>), which the exercise then owns like any other.
Properties
Section titled “Properties”FieldChange
Section titled “FieldChange”A change of the field, and the source id of the element it is for (an upload may end after the cursor moved).
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
change |
readonly |
InspectorChange |
element |
readonly |
string | null |
HelpOpen
Section titled “HelpOpen”What astl-help-open asks for.
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
element |
readonly |
string |
part |
readonly |
HelpPart |
InspectorModel
Section titled “InspectorModel”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
checkedBy? |
readonly |
| { id: string; name: string; } | null |
The Check element that checks this question (OutlineComponent.check): its source id and its name ("Check button 1"); absent or null when none does, or without the document (Authoring.inspect without source). |
fields |
readonly |
readonly InspectorFieldModel[] |
- |
icon |
readonly |
string | null |
Icon name from the descriptor. |
id |
readonly |
string | null |
- |
label |
readonly |
string |
Translated menu label of the type (the tag when there is no descriptor). |
tag |
readonly |
string |
- |
InspectorOption
Section titled “InspectorOption”Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
label |
readonly |
string |
value |
readonly |
string |
NumberFieldModel
Section titled “NumberFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”Outline
Section titled “Outline”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
errors |
readonly |
number |
Every issue of the document. |
pages |
readonly |
readonly OutlinePage[] |
- |
points |
readonly |
number | null |
The sum of its pages' points, or null when nothing is graded. |
warnings |
readonly |
number |
- |
OutlineBlock
Section titled “OutlineBlock”One block of a page (EditorBlockPlace): a block component directly on the page, a Check element (astl-check), or
the content between two of them (paragraphs, headings, lists, quotes, pictures, with the inline components in their
text).
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
components |
readonly |
readonly OutlineComponent[] |
Its component, or the components in its text, in document order; none for a Check element. |
errors |
readonly |
number |
Issues located on its components, or on the Check element. |
id |
readonly |
string | null |
The component's or the Check element's source id (null when it has none), or null for a text block. |
kind |
readonly |
"text" | "component" | "check" |
- |
label |
readonly |
string |
The block's type: the component's label, block.check ("Check button") for a Check element, else block.gap ("Gap") for text that holds a graded component and block.text ("Text") for the rest. |
points |
readonly |
number | null |
The sum of its components' points, or null when none of them is graded. |
tag |
readonly |
string | null |
The component's tag (astl-check for a Check element), or null for a text block. |
warnings |
readonly |
number |
- |
OutlineCheck
Section titled “OutlineCheck”A Check element of a page (<astl-check>): the questions it checks, as the engine and the player take them.
Properties
Section titled “Properties”OutlineComponent
Section titled “OutlineComponent”Properties
Section titled “Properties”OutlinePage
Section titled “OutlinePage”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
automatic |
readonly |
readonly (readonly string[])[] |
Its automatic Checks, where practice checks one question at a time: the source ids of the graded questions of each run of text that no Check element has, when there are two or more, in order. The player puts one Check after the last of them that checks them at once; a question alone keeps its own. |
blocks |
readonly |
readonly OutlineBlock[] |
Its content as blocks, in order. |
check |
readonly |
boolean |
Whether the page has check: its own Check in practice ("Check this page"). False for the implicit page, which cannot carry it (setPageCheck makes it a page that does). |
checks |
readonly |
readonly OutlineCheck[] |
Its Check elements, in reading order (in its layouts' columns too). |
components |
readonly |
readonly OutlineComponent[] |
- |
errors |
readonly |
number |
Issues located on the page, its content and its components. |
id |
readonly |
string | null |
null for the implicit page of a document without pages. |
label |
readonly |
string | null |
- |
points |
readonly |
number | null |
The sum of its blocks' points, or null when nothing on it is graded. |
warnings |
readonly |
number |
- |
PictureFields
Section titled “PictureFields”A picture as the picture dialog asks for it: alt is '' for a decorative picture.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
alt |
readonly |
string |
- |
caption? |
readonly |
string |
A caption makes the picture a figure. |
height? |
readonly |
number |
- |
src |
readonly |
string |
- |
width? |
readonly |
number |
- |
PicturePointModel
Section titled “PicturePointModel”One pin of a picture-points field, in percent of the picture.
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
id |
readonly |
string |
index |
readonly |
number |
label |
readonly |
string |
x |
readonly |
number |
y |
readonly |
number |
PicturePointsFieldModel
Section titled “PicturePointsFieldModel”Extends
Section titled “Extends”PictureFieldBase
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
alt |
readonly |
string |
- |
altAttribute |
readonly |
string | null |
The element's attribute with the picture's alt text, which a picture from the host fills in while it is empty (null: none), and its value ('' when absent). |
elementTag |
readonly |
string |
The tag of the element with the picture: the URL policy is asked for its srcAttribute, as the engine does. |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"picture-points" |
- |
label |
readonly |
string |
Translated label. |
points |
readonly |
readonly PicturePointModel[] |
- |
src |
readonly |
string |
- |
srcAttribute |
readonly |
string |
The element's attribute with the picture's address, and its value ('' when absent). |
tag |
readonly |
string |
- |
PictureRegionModel
Section titled “PictureRegionModel”One zone of a picture-regions field, in percent of the picture (absent or invalid numbers read as 0).
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
flagged |
readonly |
boolean |
Whether the zone has the field's flag (a right place): drawn solid, the others dashed. |
height |
readonly |
number |
- |
id |
readonly |
string |
- |
index |
readonly |
number |
Position among the children with the field's tag, from 0 (what child-* changes use). |
label |
readonly |
string |
- |
points |
readonly |
readonly (readonly [number, number])[] |
- |
r |
readonly |
number |
- |
shape |
readonly |
PictureShape |
- |
width |
readonly |
number |
- |
x |
readonly |
number |
- |
y |
readonly |
number |
- |
PictureRegionsFieldModel
Section titled “PictureRegionsFieldModel”Extends
Section titled “Extends”PictureFieldBase
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
alt |
readonly |
string |
- |
altAttribute |
readonly |
string | null |
The element's attribute with the picture's alt text, which a picture from the host fills in while it is empty (null: none), and its value ('' when absent). |
elementTag |
readonly |
string |
The tag of the element with the picture: the URL policy is asked for its srcAttribute, as the engine does. |
flag |
readonly |
string | null |
The boolean attribute of a child-flag field on the same child tag (a hotspot's right places), whose zones are drawn solid and the others dashed; null without one (every zone solid). |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"picture-regions" |
- |
label |
readonly |
string |
Translated label. |
regions |
readonly |
readonly PictureRegionModel[] |
- |
shapes |
readonly |
readonly PictureShape[] |
The shapes a zone may take: the values of the child's shape enum, or rectangles only when it has no shape (then no shape is written). |
src |
readonly |
string |
- |
srcAttribute |
readonly |
string |
The element's attribute with the picture's address, and its value ('' when absent). |
tag |
readonly |
string |
- |
PictureRequest
Section titled “PictureRequest”What ask opens the dialog with.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
altRequired? |
readonly |
boolean |
The picture carries the task (a component's): its alt text is required, with no decorative choice. |
caption? |
readonly |
boolean |
Whether to ask for a caption (a new picture). Default: true for a new picture, false for an edit. |
current? |
readonly |
PictureFields |
A picture to edit: its address, alt text and size. Absent: a new picture. |
decorative? |
readonly |
boolean |
Whether current is decorative; default: when its alt text is empty. |
file? |
readonly |
File |
A file to upload first (pasted or dropped), through the authoring's uploadAsset. |
target? |
readonly |
object |
The element and attribute the address is for, as the URL policy is asked; default img and src. |
target.attribute |
readonly |
string |
- |
target.tag |
readonly |
string |
- |
PreviewOptions
Section titled “PreviewOptions”How Authoring.preview grades.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
policy? |
readonly |
AttemptPolicy |
The policy of the local grading, the one the host plays the result under: a host whose students get less help than practice offers (no hints, no check of one interaction) previews with that. Default PRACTICE_POLICY. |
ScannedElement
Section titled “ScannedElement”A page or a component found by scanElements. Offsets index into the scanned string.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
end |
readonly |
number |
- |
id |
readonly |
string | null |
The id attribute (entities decoded), or null when absent. |
start |
readonly |
number |
- |
tag |
readonly |
string |
- |
SelectFieldModel
Section titled “SelectFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
control |
readonly |
"select" |
- |
help |
readonly |
string | null |
Translated help text, or null. |
kind |
readonly |
"attribute" |
- |
label |
readonly |
string |
Translated label. |
name |
readonly |
string |
- |
options |
readonly |
readonly InspectorOption[] |
- |
value |
readonly |
string |
The written value, else the default; '' (the "not set" option) when neither. |
StyleOpen
Section titled “StyleOpen”What astl-style-open asks for.
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
target |
readonly |
| EditorStyleTargetKind | "rules" |
TableShape
Section titled “TableShape”The shape of a new table (the insert menu's "Table"): its columns, its body rows, and its headers.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
columns |
readonly |
number |
- |
headerColumn |
readonly |
boolean |
- |
headerRow |
readonly |
boolean |
- |
rows |
readonly |
number |
The rows of its body; a header row comes on top of them. |
TextareaAdapter
Section titled “TextareaAdapter”What a WYSIWYG integration must provide so the authoring kit can drive it. Everything is in source HTML
(the <astl-doc> format), so an adapter is free to use any internal model.
Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
editsSource? |
readonly |
boolean |
True when the editor shows and edits the source HTML as text (the textarea adapter, a code editor): <astl-editor> then names its view "HTML" and offers no HTML view of its own, which would show the same text. Absent: a visual editor. |
style? |
readonly |
EditorStyles |
Styles at the cursor, named styles and layouts. Absent: an editor of source text (the textarea), no controls. |
Methods
Section titled “Methods”addPage()
Section titled “addPage()”addPage(after?): string;An empty page after the page after, in the source text (EditorAdapter.addPage).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
after? |
string |
Returns
Section titled “Returns”string
Overrides
Section titled “Overrides”destroy()
Section titled “destroy()”destroy(): void;Removes the textarea listeners and every subscription.
Returns
Section titled “Returns”void
focus()?
Section titled “focus()?”optional focus(): void;Focuses the editor, its cursor where it was (after a toolbar press from the keyboard). An editor that has the focus is left as it is, so a click there a moment before keeps its cursor.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”format()?
Section titled “format()?”optional format(format, href?): boolean;Toggles a format on the selection and focuses the editor; returns whether the document changed. A mark goes on
all of the selected text, or off when all of it has it; link with an href links the selected text (or changes
the link at the cursor) and without one removes the link at the cursor; a text style sets the blocks of the
selection to it (heading or subheading again sets paragraph); a list wraps them in that list, turns the
other list into it, or lifts them out of it. One undo step. Absent (with formatState): no formatting commands.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
format |
EditorFormat |
href? |
string |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”formatState()?
Section titled “formatState()?”optional formatState(): EditorFormatState;The formats at the cursor and whether undo or redo can run. Present with format.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”getCursor()?
Section titled “getCursor()?”optional getCursor(): EditorBlockPlace | null;The block holding the cursor (in a document without pages: page null), or null while the editor has no cursor
in content. A host follows it to show the page being edited.
Returns
Section titled “Returns”EditorBlockPlace | null
Inherited from
Section titled “Inherited from”getElement()
Section titled “getElement()”getElement(id): string | null;Source HTML of one component element, or null when the id is not in the document.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”string | null
Inherited from
Section titled “Inherited from”getSelection()
Section titled “getSelection()”getSelection(): EditorSelection | null;The component at the cursor, or null.
Returns
Section titled “Returns”EditorSelection | null
Inherited from
Section titled “Inherited from”getSource()
Section titled “getSource()”getSource(): string;The whole document as source HTML.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”insert()
Section titled “insert()”insert(html, options?): void;Inserts a source snippet (an instantiated template) at the cursor, never into a component: after the component the
cursor is in. With replaceSelection, an inline snippet takes the place of the selected text. A rich-text editor
keeps the text whole: a snippet of blocks (a block component, a paragraph) goes after the element the cursor is in
directly on its page or column (a paragraph, a heading, a list), or in the place of that element when it is an
empty paragraph; a layout goes after the layout the cursor is in, as layouts do not nest. A source editor (the
textarea adapter) puts any snippet at the caret, as the author would type it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
html |
string |
options? |
EditorInsertOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”mergePage()
Section titled “mergePage()”mergePage(id): boolean;The page id joined to the page before it, in the source text (EditorAdapter.mergePage).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”moveBlock()?
Section titled “moveBlock()?”optional moveBlock(block, direction): boolean;Moves a block one place up or down within its page, the cursor with it; returns false, changing nothing, at the page's start or end or for a place that holds no block. One undo step. Absent: blocks do not move. A block in a column stays in its column; a block directly on the page moves past a whole layout, which itself never moves. A block next to a frame moves into it (its last place going up, its first going down), and a frame's first or last block out of it; a frame itself never moves.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
block |
EditorBlockPlace |
direction |
"up" | "down" |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”onChange()
Section titled “onChange()”onChange(listener): () => void;Subscribe to document changes. Returns an unsubscribe function.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
() => void |
Returns
Section titled “Returns”() => void
Inherited from
Section titled “Inherited from”onCursorChange()?
Section titled “onCursorChange()?”optional onCursorChange(listener): () => void;Subscribe to every move of the cursor and every change of the document or its history: what getCursor and
formatState return may have changed. Returns an unsubscribe function. Present with either.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
() => void |
Returns
Section titled “Returns”() => void
Inherited from
Section titled “Inherited from”onSelectionChange()
Section titled “onSelectionChange()”onSelectionChange(listener): () => void;Subscribe to selection changes. Returns an unsubscribe function.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
(selection) => void |
Returns
Section titled “Returns”() => void
Inherited from
Section titled “Inherited from”EditorAdapter.onSelectionChange
redo()?
Section titled “redo()?”optional redo(): boolean;Redoes the last undone step and focuses the editor; returns whether the document changed.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”removeBlock()?
Section titled “removeBlock()?”optional removeBlock(block): boolean;Deletes a block: its component, or all of its text; a page, a column or a frame left without content keeps one empty paragraph. Returns false, changing nothing, for a place that holds no block. One undo step.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
block |
EditorBlockPlace |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”removePage()?
Section titled “removePage()?”optional removePage(id): boolean;Deletes the page id and everything on it. The cursor goes to the start of the page before it, or of the next
page when it was the first. Returns false, changing nothing, for the only page or an id that is not a page's. One
undo step.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”replaceElement()
Section titled “replaceElement()”replaceElement(id, html): void;Replaces one component element in place (inspector edits); the rest of the document is untouched. A cursor inside the element stays inside it: the inspector follows the element at the cursor while it writes.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
html |
string |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”select()
Section titled “select()”select(id): void;Moves the cursor to an element by source id (a component or a page) and focuses the editor.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”selectedText()?
Section titled “selectedText()?”optional selectedText(): string;The plain text of the selection when it lies within one text block (trimmed), else ''. A template's
{{selection}} takes it, and insert with replaceSelection puts the snippet in its place. Absent: ''.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”setPageCheck()
Section titled “setPageCheck()”setPageCheck(check, page?): boolean;check set or cleared on a page or on every page, in the source text (EditorAdapter.setPageCheck).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
check |
boolean |
page? |
string |
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”setSource()
Section titled “setSource()”setSource(source): void;Replaces the whole document.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”splitPage()
Section titled “splitPage()”splitPage(): string | null;A page break at the caret, in the source text (EditorAdapter.splitPage).
Returns
Section titled “Returns”string | null
Overrides
Section titled “Overrides”undo()?
Section titled “undo()?”optional undo(): boolean;Undoes the last step and focuses the editor; returns whether the document changed. Absent: no history.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”wrap()?
Section titled “wrap()?”optional wrap(tag): boolean;Runs the wrap command of the type tag (EditorDescriptor.wrap) on the selection and focuses the editor;
returns whether the document changed. Absent: the editor offers no such command.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tag |
string |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”TextFieldModel
Section titled “TextFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”TextListFieldModel
Section titled “TextListFieldModel”Extends
Section titled “Extends”FieldTexts
Properties
Section titled “Properties”ToolbarView
Section titled “ToolbarView”A view the toolbar's view switch offers (AstlToolbar.views).
Properties
Section titled “Properties”UploadedAsset
Section titled “UploadedAsset”A stored picture, as uploadAsset and pickPicture give it: its address, its size in pixels when known, and the
alt text the host suggests for it (its library's, say). The picture dialog and the picture fields fill that alt text
in where theirs is empty, and the author may change it there: it is the document's own copy from then on.
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
alt? |
readonly |
string |
height? |
readonly |
number |
src |
readonly |
string |
width? |
readonly |
number |
Type Aliases
Section titled “Type Aliases”HelpKind
Section titled “HelpKind”type HelpKind = "hint" | "explanation" | "feedback";What the insert menu adds: a hint, the explanation, or the next feedback text the element lacks.
HelpPart
Section titled “HelpPart”type HelpPart = "hints" | "explanation" | "feedback";A part of a graded element's help for students: its hints, its explanation, its feedback texts.
InsertGroup
Section titled “InsertGroup”type InsertGroup = "components" | "exercises" | "content" | "layouts";The groups of <astl-insert-menu>, in the order it shows them.
InsertMenu
Section titled “InsertMenu”type InsertMenu = "elements" | "templates" | "layouts";The toolbar's insert menus: every component and content insert, the named starters, or the layouts.
InspectorChange
Section titled “InspectorChange”type InspectorChange = | { kind: "attribute"; name: string; value: string | boolean | null;} | { kind: "text-list"; tag: string; values: readonly string[];} | { attribute: string; index: number; kind: "child-flag"; tag: string; value: boolean;} | { attribute: string; index: number; kind: "child-choice"; tag: string; value: string | null;} | { attributes: Readonly<Record<string, string | null>>; index: number; kind: "child-attributes"; tag: string;} | { attributes: Readonly<Record<string, string>>; kind: "child-add"; tag: string;} | { index: number; kind: "child-remove"; tag: string;} | { kind: "text"; value: string;};What an inspector control changes. Indexes count children with the same tag, from 0.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ kind: "attribute"; name: string; value: string | boolean | null;}| Name | Type | Description |
|---|---|---|
kind |
"attribute" |
- |
name |
string |
- |
value |
string | boolean | null |
A string sets the value, true writes a bare boolean attribute, false or null removes it. |
Type Literal
Section titled “Type Literal”{ kind: "text-list"; tag: string; values: readonly string[];}Type Literal
Section titled “Type Literal”{ attribute: string; index: number; kind: "child-flag"; tag: string; value: boolean;}Type Literal
Section titled “Type Literal”{ attribute: string; index: number; kind: "child-choice"; tag: string; value: string | null;}| Name | Type | Description |
|---|---|---|
attribute |
string |
- |
index |
number |
- |
kind |
"child-choice" |
- |
tag |
string |
- |
value |
string | null |
The value to write; null removes the attribute. |
Type Literal
Section titled “Type Literal”{ attributes: Readonly<Record<string, string | null>>; index: number; kind: "child-attributes"; tag: string;}| Name | Type | Description |
|---|---|---|
attributes |
Readonly<Record<string, string | null>> |
- |
index |
number |
- |
kind |
"child-attributes" |
Several attributes of one child (a zone's shape and coordinates): a string sets one, null removes it. |
tag |
string |
- |
Type Literal
Section titled “Type Literal”{ attributes: Readonly<Record<string, string>>; kind: "child-add"; tag: string;}A new empty child with these attributes, after the last child of its tag (or at the end).
Type Literal
Section titled “Type Literal”{ index: number; kind: "child-remove"; tag: string;}Removes one child, its content included.
Type Literal
Section titled “Type Literal”{ kind: "text"; value: string;}The element's whole content as this plain text (a badge's).
InspectorFieldModel
Section titled “InspectorFieldModel”type InspectorFieldModel = | TextFieldModel | ContentTextFieldModel | NumberFieldModel | CheckboxFieldModel | SelectFieldModel | TextListFieldModel | ChildFlagFieldModel | ChildTextFieldModel | ChildChoiceFieldModel | ChildTableFieldModel | PictureRegionsFieldModel | PicturePointsFieldModel | CheckTargetsFieldModel;LayoutName
Section titled “LayoutName”type LayoutName = | EditorLayoutShape | "picture-text";The layouts of the insert menu's "Layout" group.
PickPicture
Section titled “PickPicture”type PickPicture = (options) => Promise<UploadedAsset | null>;Opens the host's own picture library and resolves with the chosen picture (its address, and its size when known),
or null when the author closes it without one. The address must pass urlPolicy. Settle once the library has
closed: the picture dialog and the picture fields then give the focus back themselves. signal aborts when the
editor no longer waits for it (the picture dialog was asked for another picture or left the page, the picture field
started another upload or pick): the host should then close its library.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
{ signal: AbortSignal; } |
options.signal |
AbortSignal |
Returns
Section titled “Returns”Promise<UploadedAsset | null>
PicturePosition
Section titled “PicturePosition”type PicturePosition = Placement;PictureShape
Section titled “PictureShape”type PictureShape = "rect" | "circle" | "polygon";Placement
Section titled “Placement”type Placement = "inline" | "start" | "end" | "center" | "full";Where a picture, a figure or a component sits: in the line, floating at either side with text beside it, centred, or filling.
PreviewResult
Section titled “PreviewResult”type PreviewResult = | { checker: LocalChecker; issues: readonly Issue[]; ok: true; view: string;} | { issues: readonly Issue[]; ok: false;};Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ checker: LocalChecker; issues: readonly Issue[]; ok: true; view: string;}| Name | Type | Description |
|---|---|---|
checker |
LocalChecker |
Local grading for this preview, under its policy (PreviewOptions.policy, practice by default). |
issues |
readonly Issue[] |
Warnings. |
ok |
true |
- |
view |
string |
- |
Type Literal
Section titled “Type Literal”{ issues: readonly Issue[]; ok: false;}ToolbarItem
Section titled “ToolbarItem”type ToolbarItem = | "style" | "font" | "size" | "bold" | "italic" | "underline" | "link" | "color" | "highlight" | "align" | "spacing" | "bulleted" | "numbered" | "clear" | "featured" | "elements" | "templates" | "layouts" | "wraps" | "views" | "undo" | "redo";A name of the toolbar's items, for its layout (ToolbarLayout). featured stands for the featured inserts in their
order, wraps for the types' commands on the selection ("Mark word") and views for the view switch.
ToolbarLayout
Section titled “ToolbarLayout”type ToolbarLayout = readonly (readonly ToolbarItem[])[];The toolbar's groups of items, in order: a rule parts each group from the one before.
UploadAsset
Section titled “UploadAsset”type UploadAsset = (file, options) => Promise<UploadedAsset>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
file |
File |
options |
{ signal: AbortSignal; } |
options.signal |
AbortSignal |
Returns
Section titled “Returns”Promise<UploadedAsset>
Variables
Section titled “Variables”DEFAULT_FONTS
Section titled “DEFAULT_FONTS”const DEFAULT_FONTS: readonly EditorFont[];The default list: stacks every system has, nothing to download or license.
DEFAULT_STYLES
Section titled “DEFAULT_STYLES”const DEFAULT_STYLES: readonly EditorStylePreset[];The default ready styles: boxes for a note, a tip, a warning, a definition, an example and a quote, then two for
words. Their text reads at 4.5:1 on what is behind it, in the light theme and as the player paints them in the dark
one (styled.browser.test.ts). A style of words holds no padding and no margin: on a phone the player gives
whatever has a padding its own (styled.ts), which would pad a word inside its sentence.
DEFAULT_TOOLBAR_LAYOUT
Section titled “DEFAULT_TOOLBAR_LAYOUT”const DEFAULT_TOOLBAR_LAYOUT: ToolbarLayout;The toolbar's own layout: the text style; font and size; the marks and link; the colours; alignment and spacing; the lists and clear formatting; the inserts; the types' commands; the view switch; undo and redo.
EDITOR_NAMESPACE
Section titled “EDITOR_NAMESPACE”const EDITOR_NAMESPACE: "astl.editor" = 'astl.editor';i18n namespace of the authoring kit's own UI (insert menu, inspector, issues, preview).
editorMessages
Section titled “editorMessages”const editorMessages: readonly MessageCatalog[];FEATURED_ITEMS
Section titled “FEATURED_ITEMS”const FEATURED_ITEMS: readonly string[];Kit items a host can feature besides component tags (tag) and starters (tag:template).
FIELD_CHANGE
Section titled “FIELD_CHANGE”const FIELD_CHANGE: "astl-field-change" = 'astl-field-change';Fired with a FieldChange for the inspector to apply.
FRAME_SOURCE
Section titled “FRAME_SOURCE”const FRAME_SOURCE: "<astl-box><astl-box-title></astl-box-title><p></p></astl-box>" = '<astl-box><astl-box-title></astl-box-title><p></p></astl-box>';The source of a new frame (astl-box, the insert menu's "Frame"): its look by default, an empty title for the author
to write and an empty paragraph under it.
GLYPHS
Section titled “GLYPHS”const GLYPHS: Readonly<Record<"inline" | "block" | "picture" | "page" | "columns", SVGTemplateResult>>;Generic glyphs by display, for pictures and for a page break: shapes only, stroked by the .icon rule of the element
showing them (hosts restyle ::part(icon); data-icon carries the icon name).
HELP_OPEN
Section titled “HELP_OPEN”const HELP_OPEN: "astl-help-open" = 'astl-help-open';The event of a request for a graded element's help for students (detail: the element's id and a part), from a tag
on its frame on the surface; the cursor is in the element by then. It bubbles, is composed and can be cancelled: a
host that shows its own inspector calls preventDefault, shows it and calls its openHelp(part). Otherwise
<astl-editor> opens it in its own inspector.
INSERTED
Section titled “INSERTED”const INSERTED: "astl-inserted" = 'astl-inserted';The event <astl-insert-menu> fires after it inserted something; detail.html is what it inserted.
issueStyles
Section titled “issueStyles”const issueStyles: CSSResult;LAYOUT_COLUMNS
Section titled “LAYOUT_COLUMNS”const LAYOUT_COLUMNS: Readonly<Record<EditorLayoutShape, readonly (number | null)[]>>;Each shape's columns by their flex-grow: null for an equal share.
LAYOUT_SHAPES
Section titled “LAYOUT_SHAPES”const LAYOUT_SHAPES: readonly EditorLayoutShape[];The shapes a layout can be changed to (EditorStyles.editLayout), in the menu's order.
LAYOUTS
Section titled “LAYOUTS”const LAYOUTS: readonly LayoutName[];PICTURE_POSITIONS
Section titled “PICTURE_POSITIONS”const PICTURE_POSITIONS: readonly Placement[] = PLACEMENTS;PLACEMENTS
Section titled “PLACEMENTS”const PLACEMENTS: readonly Placement[];STYLE_OPEN
Section titled “STYLE_OPEN”const STYLE_OPEN: "astl-style-open" = 'astl-style-open';The event of a request for a style form or the rules (detail.target: the target at the cursor, or rules). It
bubbles, is composed and can be cancelled: a host that shows them itself calls preventDefault, and the element that
was asked shows nothing. Otherwise that element shows its default: the toolbar a popup, the inspector a form in place.
TOOLBAR_ITEMS
Section titled “TOOLBAR_ITEMS”const TOOLBAR_ITEMS: readonly ToolbarItem[];Every item of the toolbar, by name, in the default layout's order: the formats, then the actions.
TYPE_GLYPHS
Section titled “TYPE_GLYPHS”const TYPE_GLYPHS: ReadonlyMap<string, SVGTemplateResult>;Glyphs of their own for the block types that toolbars feature by default (a choice, an ordering task, sorting into
groups), by their descriptor's icon name, so featured buttons side by side differ; other types get their display's.
VIEW_PICKED
Section titled “VIEW_PICKED”const VIEW_PICKED: "astl-toolbar-view" = 'astl-toolbar-view';The event the view switch fires when an author picks a view; detail.view is its name.
Functions
Section titled “Functions”createAuthoring()
Section titled “createAuthoring()”function createAuthoring(options): Authoring;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
AuthoringOptions |
Returns
Section titled “Returns”createTextareaAdapter()
Section titled “createTextareaAdapter()”function createTextareaAdapter(textarea): TextareaAdapter;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
textarea |
HTMLTextAreaElement |
Returns
Section titled “Returns”defineAuthoringElements()
Section titled “defineAuthoringElements()”function defineAuthoringElements(registry?): void;Defines <astl-toolbar>, <astl-insert-menu>, <astl-inspector>, <astl-issues> and <astl-preview>, and the
two they use for pictures, <astl-picture-dialog> and <astl-picture-field> (nothing is defined on import;
<astl-style-form> and <astl-style-rules> come with loadStyleElements, on first use). Safe to call again; a
tag already defined by another class throws, as two copies of the kit would otherwise mix silently.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
registry? |
CustomElementRegistry |
customElements |
Returns
Section titled “Returns”void
insertBadge()
Section titled “insertBadge()”function insertBadge(adapter): string;Inserts a badge (astl-badge) at the cursor, as the insert menu's "Badge" does, for a host's own menu (its label and
line: the kit's messages insert.badge and insert.badge.description): a pill holding "1", with a fresh id
(badge-<n>), where EditorAdapter.insert puts an inline element. The TipTap adapter selects it, so its card shows
its text and look. Returns its source HTML.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
adapter |
EditorAdapter |
Returns
Section titled “Returns”string
insertCheck()
Section titled “insertCheck()”function insertCheck(authoring, adapter): string;Inserts a Check element (astl-check) at the cursor, as the insert menu's "Check button" does, for a host's own menu
(its label and line: the kit's messages insert.check and insert.check.description). It goes where
EditorAdapter.insert puts a block, after the block the cursor is in, with a fresh id (check-<n>), and its for
names the questions it takes there: the graded inline questions of the run of text right above it
(OutlineCheck.targets), so moving text later does not change what it checks. The TipTap adapter selects it and
makes the insert one undo step. Returns its source HTML.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
authoring |
Authoring |
adapter |
EditorAdapter |
Returns
Section titled “Returns”string
insertTask()
Section titled “insertTask()”function insertTask(adapter): string | null;Inserts a task (astl-task) at the cursor, as the insert menu's "Task" does, for a host's own menu (its label and
line: the kit's messages insert.task and insert.task.description): with a fresh id (task-<n>), an empty
instruction and an empty line under it, as EditorStyles.insertLayout puts a layout, the cursor in its instruction.
Returns its source HTML, or null with an editor that cannot (no style).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
adapter |
EditorAdapter |
Returns
Section titled “Returns”string | null
layoutHtml()
Section titled “layoutHtml()”function layoutHtml(name, picture?): string;The source of a layout; picture-text takes the source of its picture.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
name |
LayoutName |
undefined |
picture? |
string |
'' |
Returns
Section titled “Returns”string
loadHelpForm()
Section titled “loadHelpForm()”function loadHelpForm(): Promise<__module>;Defines <astl-help-form> (the inspector's help for students) where the kit is defined, and resolves once it is:
a module of its own, outside the editor's first load, like the style elements. The inspector calls this when it shows
a graded element, the insert menu before it adds help.
Returns
Section titled “Returns”Promise<__module>
loadStyleElements()
Section titled “loadStyleElements()”function loadStyleElements(): Promise<void>;Defines <astl-style-form> and <astl-style-rules> where the kit is defined, and resolves once they are. A module of
their own, outside the editor's first load: the toolbar and the inspector call this on first use, a host that places
either element itself calls it first.
Returns
Section titled “Returns”Promise<void>
pictureHtml()
Section titled “pictureHtml()”function pictureHtml(picture): string;The source HTML of a picture: an <img> that sits in text, or with a caption a <figure> that stands on its own.
Every value is read once and escaped, and only the attributes of the content format are written.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
picture |
PictureFields |
Returns
Section titled “Returns”string
pictureSize()
Section titled “pictureSize()”function pictureSize(value): number | undefined;A picture's width or height as the content format takes it: a positive whole number of pixels (a safe integer), from a number or its written form; anything else is no size.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
Returns
Section titled “Returns”number | undefined
positionChanges()
Section titled “positionChanges()”function positionChanges( position, style, figure?): EditorStyleChanges;The changes that put an element whose style is style at position; leaving "full width" lets go of its width. A
figure fills the line unless it has a width, so "centred" would not show on one without it (figure).
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
position |
Placement |
undefined |
style |
string |
undefined |
figure? |
boolean |
false |
Returns
Section titled “Returns”positionOf()
Section titled “positionOf()”function positionOf(style): Placement;The position a style value says, also written by hand, with physical sides or margin: 0 auto.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
style |
string |
Returns
Section titled “Returns”renderIssues()
Section titled “renderIssues()”function renderIssues( issues, authoring, adapter, source?): TemplateResult | typeof nothing;A list of issues, or nothing when empty.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
issues |
readonly Issue[] |
authoring |
Authoring |
adapter |
EditorAdapter | null |
source? |
string |
Returns
Section titled “Returns”TemplateResult | typeof nothing
scanElements()
Section titled “scanElements()”function scanElements(source): ScannedElement[];Pages (astl-page), tasks (astl-task) and components in document order, with offsets into source, for
text-based adapters. A component is any custom element outside another component (so a misspelt tag is found too),
but for the tags of the format: a layout's, a frame's and a task's head and sub-tasks are looked through, named styles
are skipped; custom elements inside a component are its children, and inside a page or a task what they hold.
Tolerant of messy input: comments, quoted > in attributes, any case, unclosed or self-closed elements.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
string |
Returns
Section titled “Returns”splitPlacement()
Section titled “splitPlacement()”function splitPlacement(style): object;A style value in two: what places the element (its position and width) and the rest. A surface that frames an
element draws the first on the frame and the rest inside it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
style |
string |
Returns
Section titled “Returns”object
| Name | Type |
|---|---|
placed |
string |
rest |
string |
styleNameFrom()
Section titled “styleNameFrom()”function styleNameFrom(label, taken): string;A name for a new style from its label: lowercase letters, digits and dashes, the format's grammar, not taken.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
label |
string |
taken |
ReadonlySet<string> |
Returns
Section titled “Returns”string
tableHtml()
Section titled “tableHtml()”function tableHtml(shape): string;The source of a new, empty table: a head of header cells (scope="col") with a header row, then a body whose rows
start with a row header (scope="row") with a header column. Columns and rows within the format's limits.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
shape |
TableShape |
Returns
Section titled “Returns”string
taskHtml()
Section titled “taskHtml()”function taskHtml(id): string;The source of a new task with this id (the insert menu's "Task"): an empty instruction, an empty line.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”string
toolbarButtonParts()
Section titled “toolbarButtonParts()”function toolbarButtonParts(options): string[];The part of every button a toolbar may draw (button-<name>) with these featured inserts, types with a command
(their tags) and views, for an element that holds a toolbar and exports its parts.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
{ featured: readonly string[]; views: readonly string[]; wraps: readonly string[]; } |
options.featured |
readonly string[] |
options.views |
readonly string[] |
options.wraps |
readonly string[] |
Returns
Section titled “Returns”string[]
widthChanges()
Section titled “widthChanges()”function widthChanges(style, percent): EditorStyleChanges;The changes that make an element whose style is style this wide: a handle and a field write the same.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
style |
string |
percent |
number |
Returns
Section titled “Returns”widthPercent()
Section titled “widthPercent()”function widthPercent(style): number | null;The width a style value gives in percent, or null: none, or another unit.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
style |
string |
Returns
Section titled “Returns”number | null