diff --git a/src/Settings/ToolbarSettingsModal.ts b/src/Settings/ToolbarSettingsModal.ts index 0c6a02a8..3b936398 100644 --- a/src/Settings/ToolbarSettingsModal.ts +++ b/src/Settings/ToolbarSettingsModal.ts @@ -18,10 +18,16 @@ export default class ToolbarSettingsModal extends Modal { this.toolbar = toolbar; } + /** + * Displays the toolbar item's settings within the modal window. + */ onOpen() { this.display(); } + /** + * Removes modal window and refreshes the parent settings window. + */ onClose() { const { contentEl } = this; contentEl.empty(); @@ -33,7 +39,7 @@ export default class ToolbarSettingsModal extends Modal { *************************************************************************/ /** - * + * Displays the toolbar item's settings. */ public display() { @@ -60,8 +66,8 @@ export default class ToolbarSettingsModal extends Modal { } /** - * - * @param settingsDiv HTMLElement to add the settings to. + * Displays the Name setting. + * @param settingsDiv HTMLElement to add the setting to. */ displayNameSetting(settingsDiv: HTMLElement) { @@ -94,7 +100,7 @@ export default class ToolbarSettingsModal extends Modal { } /** - * + * Displays the list of toolbar items for editing. * @param settingsDiv HTMLElement to add the settings to. */ displayItemList(settingsDiv: HTMLElement) { @@ -274,7 +280,7 @@ export default class ToolbarSettingsModal extends Modal { } /** - * + * Displays the Style settings. * @param settingsDiv HTMLElement to add the settings to. */ displayStyleSetting(settingsDiv: HTMLElement) { @@ -427,7 +433,7 @@ export default class ToolbarSettingsModal extends Modal { } /** - * + * Displays the Delete button. * @param settingsDiv HTMLElement to add the settings to. */ displayDeleteButton(settingsDiv: HTMLElement) { @@ -454,8 +460,14 @@ export default class ToolbarSettingsModal extends Modal { * UTILITIES *************************************************************************/ - getValueForKey(styleDict: {[key: string]: string}[], key: string): string { - const option = styleDict.find(option => key in option); + /** + * Returns the value for the provided key from the provided dictionary. + * @param dict key-value dictionary + * @param key string key + * @returns value from the dictionary + */ + getValueForKey(dict: {[key: string]: string}[], key: string): string { + const option = dict.find(option => key in option); return option ? Object.values(option)[0] : 'INVALID OPTION'; }