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}.
Confirm replace if there is content selected
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
Generate markup for the copy and paste buttons
Create a description
Optional
inputId: 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()
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
Create HTML for select options.
The value of the option
The text for the option
Optional
selected: booleanIf set, the option is set as selected
Option 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
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
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
Joins an array of strings if they are defined and non empty
Optional
separator: stringDefault: " "
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.
Optional
machineName: stringMachine 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
Optional
libraries: 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
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