Adds a field to the Common Fields container. Used internally by H5PEditor.processSemanticsChunk.
OptionalskipAppendTo: boolean
Skips appending the common field if set
Show a toast message. Alias for H5P.attachToastTo.
Optionalconfig: unknownBind events to important description
Check if clipboard can be pasted and give reason if not.
Results. {canPaste: boolean, reason: string, description: string}.
Confirm replace if there is content selected
Create HTML wrapper for a boolean field item.
OptionalinputId: stringMakes it easier to add consistent buttons across the editor widget
Typical CSS class format
Human readable format
Action handler when triggered
OptionaldisplayTitle: boolean
Show button with text. Default: false
Generate markup for the copy and paste buttons
Create a description
OptionalinputId: stringCreate an error paragraph with the given message
Error message to display
Message wrapped in
-tags
Create HTML wrapper for a field item. Replacement for createItem()
OptionalinputId: 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
Optionalcontent: string
HTML string for content field
Label as string of HTML
Create HTML for select options.
The value of the option
The text for the option
Optionalselected: boolean
If set, the option is set as selected
Option as string of HTML
Optionalvalue: string
Initial value for the text input
OptionalmaxLength: number
Maximum number of characters
Optionalplaceholder: string
Placeholder string shown if no value is entered
Optionalid: string
The input field's id
Optionaldescribedby: string
aria-describedby id
Input field as string of HTML
Check if the current library is entitled for the metadata button. True by default.
Current library.
True, if form should have the metadata button.
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
Get the ajax URL for the given action.
Optionalparameters: Record<string, string | number>Helps generating a consistent description ID across fields
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
Mimics a simple version of PHP htmlspecialchars. Basically replaces brackets and quotes with corresponding HTML entities.
String to replace special chars
Initialize the H5P editor.
The form to submit the content through
Radio group for choosing between upload and create
The upload widget
The create widget
Element the editor should be created in
Hidden input containing the selected library
Hidden input containing the JSON params
Hidden input for the max score
Input for the title
OptionalcancelSubmitCallback: () => boolean
Optionally prevent form submission
Joins an array of strings if they are defined and non empty
Optionalseparator: string
Default: " "
Translates a library object to a library string.
Library object with machineName, majorVersion and minorVersion set
Help load JavaScripts, prevents double loading
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.
OptionalmachineName: string
Machine name of library that is being processed
Render common fields of content type with given machine name.
Machine name of content type with common fields
Optionallibraries: H5PLibrary[]
Library data for machine name
Reset loaded libraries - i.e removes CSS added previously
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
Optionalvars: 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