Adds a field to the Common Fields container. Used internally by H5PEditor.processSemanticsChunk
.
Optional
skipAppendTo: booleanSkips appending the common field if set
Bind events to important description
Check if clipboard can be pasted and give reason if not.
Results. {canPaste: boolean, reason: string, description: string}.
Check if any errors have been set. Blocks tab-key on $input if $errors is not empty.
Create HTML wrapper for a boolean field item.
Optional
inputId: stringMakes it easier to add consistent buttons across the editor widget
Typical CSS class format
Human readable format
Action handler when triggered
Optional
displayTitle: booleanShow button with text. Default: false
Create HTML wrapper for a field item. Replacement for createItem()
Optional
inputId: stringCreate the HTML wrapper for field items.
Field type as string (ie. "text", "image", "number")
Label text. Can be HTML
Optional description text for the field. If set, it will be included beneath the field edit form
HTML content for the field as a string. Inserted in the wrapper
since version 1.12 (Jan. 2017, will be removed Jan. 2018). Use createFieldMarkup instead.
Create a label to wrap content in.
Semantics object for the field
Optional
content: stringHTML string for content field
Label as string of HTML
Optional
value: stringInitial value for the text input
Optional
maxLength: numberMaximum number of characters
Optional
placeholder: stringPlaceholder string shown if no value is entered
Optional
id: stringThe input field's id
Optional
describedby: stringaria-describedby
id
Input field as string of HTML
Observe a field to get changes to its params.This is used to track changes within an object during editing in case the change needs to be reflected visually.
An example from H5PEditor.DragQuestion. This observes the "settings/background" property and changes the background of the editor if changed.
The parent object of the field
Relative to the parent object
Gets called for params changes
Generates a consistent and unique field ID for the given field
Alternate the background color of fields
odd
or even
to determine background color of callee
Helper function for detecting field widget
Translates a library object to a library string.
Library object with machineName, majorVersion and minorVersion set
Loads a complete library, with semantics, scripts and CSS from the server. Injects the javascript and stylesheets then returns the semantics object in the callback.
Callback that will be called with the library's semantics when loaded
Recursive processing of the semantics chunks.
Optional
machineName: stringMachine name of library that is being processed
Call remove on the given children
Render common fields of content type with given machine name.
Machine name of content type with common fields
Optional
libraries: H5PLibrary[]Library data for machine name
Attach ancestor of parent's common fields to a new wrapper
Parent content type instance that common fields should be attached to
New wrapper of common fields
Translate text strings
The library name(machineName), or "core"
Translation string identifier
Optional
vars: Record<`:${string}`, string>Placeholders and values to replace in the text
Translated string, or a default text if the translation is missing
Wraps a field with some metadata classes, and adds error field.
Param: TWidgetMachineName
Typically PascalCased - MyWidget
Param: TWidgetName
Typically camelCased - myWidget
Param: TWidget
The widget class
See
https://h5p.org/node/2468