Constructor
new SettingsCategoryMetadata(name, …contents)
Create a new metadata item for a category of settings
Parameters
-
name
String
the name of the category, used as a title in the user interface when presenting this category to the user for editing
-
contents
Array.<SettingMetadata>
<repeatable>
the metadata for each setting in this catyegory, in the order they should be shown to the user when editing
See
Source
Classes
Methods
control() → {Object}
Whenever this category needs to be presented to the user in the UI, this function will be called to create JSON data representing the category, which will be a tab for use in a tabbed dialog, as documented here: https://www.tiny.cloud/docs/tinymce/6/dialog-components/#tabpanel
Returns
-
Object
an object representing the UI tab for this category of settings
Source
defaultSettings() → {Object}
For all settings in this category, 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 category
Source
keys() → {Array.<String>}
Creates an ordered list of all the names of all the settings in this category. (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 category
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 category. 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 category
Source
validate()
Validate all the settings in this category 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.