Constructor
new SettingsMetadata(…categories)
Create a collection of settings categories
Parameters
-
categories
Array.<SettingsCategoryMetadata>
<repeatable>
the categories in this settings collection, in the order they should be shown to the user when editing settings
Source
Classes
Methods
control() → {Object}
Whenever this collection needs to be presented to the user in the UI, this function will be called to create JSON data representing the collection, which will be the body of a dialog, as exemplified here: https://www.tiny.cloud/docs/tinymce/6/dialog-components/#dialog-instance-api-methods
Returns
-
Object
an object representing the body of a dialog that would let the user edit this collection of settings
Source
defaultSettings() → {Object}
For all settings in this collection, look up their default values and return the result as an object mapping setting names to those default values.
Returns
-
Object
a set of key-value pairs mapping names of settings to their default values for all settings in this collection
Source
keys() → {Array.<String>}
Creates an ordered list of all the names of all the settings in this collection. (The "name" of each setting is used as the "key" in any key-value dictionary representing settings, hence the term "keys.")
Returns
-
Array.<String>
the keys in the order they appear in this collection
Source
metadataFor(key) → {SettingMetadata}
Given a setting's name, we can look up its metadata and return the appropriate SettingMetadata instance, if one with that name exists in this collection. Otherwise, we return undefined.
Parameters
-
key
String
the name of the setting whose metadata we should look up
Returns
-
SettingMetadata
the metadata in question, or undefined if no such metadata exists in this collection
Source
validate()
Validate all the settings in all the categories and return all their error messages concatenated into a single array. If there were no error messages (which is the default) then the result will be an empty list, indicating that the data passes validation. See validate() for details.