Skip to content

Commit

Permalink
docs: add new files to API docs and fix mentioned issues
Browse files Browse the repository at this point in the history
  • Loading branch information
devvaannsh authored and abose committed Oct 30, 2024
1 parent 4443de2 commit 16e2eae
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 31 deletions.
56 changes: 56 additions & 0 deletions docs/API-Reference/widgets/DefaultDialogs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
### Import :
```js
const DefaultDialogs = brackets.getModule("widgets/DefaultDialogs")
```

<a name="module_DefaultDialogs"></a>

## DefaultDialogs
Constants representing dialog IDs
These IDs are used to identify different types of dialogs


* [DefaultDialogs](#module_DefaultDialogs)
* [.DIALOG_ID_ERROR](#module_DefaultDialogs.DIALOG_ID_ERROR) : <code>string</code>
* [.DIALOG_ID_INFO](#module_DefaultDialogs.DIALOG_ID_INFO) : <code>string</code>
* [.DIALOG_ID_SAVE_CLOSE](#module_DefaultDialogs.DIALOG_ID_SAVE_CLOSE) : <code>string</code>
* [.DIALOG_ID_EXT_CHANGED](#module_DefaultDialogs.DIALOG_ID_EXT_CHANGED) : <code>string</code>
* [.DIALOG_ID_EXT_DELETED](#module_DefaultDialogs.DIALOG_ID_EXT_DELETED) : <code>string</code>
* [.DIALOG_ID_CHANGE_EXTENSIONS](#module_DefaultDialogs.DIALOG_ID_CHANGE_EXTENSIONS) : <code>string</code>

<a name="module_DefaultDialogs.DIALOG_ID_ERROR"></a>

### DefaultDialogs.DIALOG\_ID\_ERROR : <code>string</code>
ID for error dialog

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
<a name="module_DefaultDialogs.DIALOG_ID_INFO"></a>

### DefaultDialogs.DIALOG\_ID\_INFO : <code>string</code>
ID for information dialog (currently uses the same template as DIALOG_ID_ERROR)

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
<a name="module_DefaultDialogs.DIALOG_ID_SAVE_CLOSE"></a>

### DefaultDialogs.DIALOG\_ID\_SAVE\_CLOSE : <code>string</code>
ID for save and close dialog

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
<a name="module_DefaultDialogs.DIALOG_ID_EXT_CHANGED"></a>

### DefaultDialogs.DIALOG\_ID\_EXT\_CHANGED : <code>string</code>
ID for `external change detected` dialog

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
<a name="module_DefaultDialogs.DIALOG_ID_EXT_DELETED"></a>

### DefaultDialogs.DIALOG\_ID\_EXT\_DELETED : <code>string</code>
ID for `external deletion detected` dialog

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
<a name="module_DefaultDialogs.DIALOG_ID_CHANGE_EXTENSIONS"></a>

### DefaultDialogs.DIALOG\_ID\_CHANGE\_EXTENSIONS : <code>string</code>
ID for `change extensions` dialog

**Kind**: static constant of [<code>DefaultDialogs</code>](#module_DefaultDialogs)
154 changes: 154 additions & 0 deletions docs/API-Reference/widgets/Dialogs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
### Import :
```js
const Dialogs = brackets.getModule("widgets/Dialogs")
```

<a name="DIALOG_BTN_CANCEL"></a>

## DIALOG\_BTN\_CANCEL : <code>string</code>
`CANCEL` dialog button ID

**Kind**: global constant
<a name="DIALOG_BTN_OK"></a>

## DIALOG\_BTN\_OK : <code>string</code>
`OK` dialog button ID

**Kind**: global constant
<a name="DIALOG_BTN_DONTSAVE"></a>

## DIALOG\_BTN\_DONTSAVE : <code>string</code>
`DONT SAVE` dialog button ID

**Kind**: global constant
<a name="DIALOG_BTN_SAVE_AS"></a>

## DIALOG\_BTN\_SAVE\_AS : <code>string</code>
`SAVE AS` dialog button ID

**Kind**: global constant
<a name="DIALOG_CANCELED"></a>

## DIALOG\_CANCELED : <code>string</code>
`CANCELED` dialog button ID

**Kind**: global constant
<a name="DIALOG_BTN_DOWNLOAD"></a>

## DIALOG\_BTN\_DOWNLOAD : <code>string</code>
`DOWNLOAD` dialog button ID

**Kind**: global constant
<a name="DIALOG_BTN_CLASS_PRIMARY"></a>

## DIALOG\_BTN\_CLASS\_PRIMARY : <code>string</code>
Primary button class name

**Kind**: global constant
<a name="DIALOG_BTN_CLASS_NORMAL"></a>

## DIALOG\_BTN\_CLASS\_NORMAL : <code>string</code>
Normal button class name

**Kind**: global constant
<a name="DIALOG_BTN_CLASS_LEFT"></a>

## DIALOG\_BTN\_CLASS\_LEFT : <code>string</code>
Left-aligned button class name

**Kind**: global constant
<a name="showModalDialogUsingTemplate"></a>

## showModalDialogUsingTemplate(template, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new)
Creates a new modal dialog from a given template.
The template can either be a string or a jQuery object representing a DOM node that is *not* in the current DOM.

**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
| template | <code>string</code> | A string template or jQuery object to use as the dialog HTML. |
| [autoDismiss] | <code>boolean</code> | Whether to automatically dismiss the dialog when one of the buttons is clicked. Default true. If false, you'll need to manually handle button clicks and the Esc key, and dismiss the dialog yourself when ready by calling `close()` on the returned dialog. |

<a name="showModalDialog"></a>

## showModalDialog(dlgClass, [title], [message], [buttons], [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new)
Creates a new general purpose modal dialog using the default template and the template variables given
as parameters as described.

**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
| dlgClass | <code>string</code> | A class name identifier for the dialog. Typically one of DefaultDialogs.* |
| [title] | <code>string</code> | The title of the dialog. Can contain HTML markup. Defaults to "". |
| [message] | <code>string</code> | The message to display in the dialog. Can contain HTML markup. Defaults to "". |
| [buttons] | <code>Array.&lt;{className: string, id: string, text: string, tooltip:string}&gt;</code> | An array of buttons where each button has a class, id tooltip, and text property. The id is used in "data-button-id". Defaults to a single Ok button. Typically className is one of DIALOG_BTN_CLASS_*, id is one of DIALOG_BTN_* |
| [autoDismiss] | <code>boolean</code> | Whether to automatically dismiss the dialog when one of the buttons is clicked. Default true. If false, you'll need to manually handle button clicks and the Esc key, and dismiss the dialog yourself when ready by calling `close()` on the returned dialog. |

<a name="showConfirmDialog"></a>

## showConfirmDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new)
Display a confirmation dialog with `OK` and `CANCEL` button

**Kind**: global function
**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance

| Param | Type | Description |
| --- | --- | --- |
| title | <code>string</code> | dialog title |
| message | <code>string</code> | message to display in the dialog |
| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not |

<a name="showInfoDialog"></a>

## showInfoDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new)
Display information dialog

**Kind**: global function
**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance

| Param | Type | Description |
| --- | --- | --- |
| title | <code>string</code> | dialog title |
| message | <code>string</code> | message to display in the dialog |
| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not |

<a name="showErrorDialog"></a>

## showErrorDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new)
Display error dialog

**Kind**: global function
**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance

| Param | Type | Description |
| --- | --- | --- |
| title | <code>string</code> | dialog title |
| message | <code>string</code> | message to display in the dialog |
| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not |

<a name="cancelModalDialogIfOpen"></a>

## cancelModalDialogIfOpen(dlgClass, [buttonId])
Immediately closes any dialog instances with the given class. The dialog callback for each instance will
be called with the special buttonId DIALOG_CANCELED (note: callback is run asynchronously).

**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
| dlgClass | <code>string</code> | The class name identifier for the dialog. |
| [buttonId] | <code>string</code> | The button id to use when closing the dialog. Defaults to DIALOG_CANCELED |

<a name="addLinkTooltips"></a>

## addLinkTooltips(elementOrDialog)
Ensures that all <a> tags with a URL have a tooltip showing the same URL

**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
| elementOrDialog | <code>jQueryObject</code> \| [<code>Dialog</code>](#new_Dialog_new) | Dialog intance, or root of other DOM tree to add tooltips to |

14 changes: 14 additions & 0 deletions docs/API-Reference/widgets/DropdownButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ DropdownButton dispatches the following events:
* [DropdownButton(label, items, [itemRenderer], [options])](#DropdownButton)
* [.items](#DropdownButton+items) : <code>Array.&lt;\*&gt;</code>
* [.itemsSearchFilterText](#DropdownButton+itemsSearchFilterText) : <code>null</code>
* [.$button](#DropdownButton+$button) : <code>jQueryObject</code>
* [.$dropdown](#DropdownButton+$dropdown) : <code>jQueryObject</code>
* [.dropdownExtraClasses](#DropdownButton+dropdownExtraClasses) : <code>string</code>
* [.setButtonLabel(label)](#DropdownButton+setButtonLabel)
* [.isOpen()](#DropdownButton+isOpen)
Expand All @@ -75,6 +77,18 @@ Items in dropdown list - may be changed any time dropdown isn't open
This is filter text corresponding to each items. it will be used to filter the items based on
the keyboard key presses the user does to enter search filter in popup.

**Kind**: instance property of [<code>DropdownButton</code>](#DropdownButton)
<a name="DropdownButton+$button"></a>

### dropdownButton.$button : <code>jQueryObject</code>
The clickable button. Available as soon as the DropdownButton is constructed.

**Kind**: instance property of [<code>DropdownButton</code>](#DropdownButton)
<a name="DropdownButton+$dropdown"></a>

### dropdownButton.$dropdown : <code>jQueryObject</code>
The dropdown element. Only non-null while open.

**Kind**: instance property of [<code>DropdownButton</code>](#DropdownButton)
<a name="DropdownButton+dropdownExtraClasses"></a>

Expand Down
30 changes: 24 additions & 6 deletions docs/API-Reference/widgets/NotificationUI.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ The `createFromTemplate` API can be configured with numerous options. See API op

* [widgets/NotificationUI](#module_widgets/NotificationUI)
* [.API](#module_widgets/NotificationUI..API)
* [.NOTIFICATION_STYLES_CSS_CLASS](#module_widgets/NotificationUI..NOTIFICATION_STYLES_CSS_CLASS) : <code>object</code>
* [.CLOSE_REASON](#module_widgets/NotificationUI..CLOSE_REASON) : <code>object</code>
* [.NOTIFICATION_STYLES_CSS_CLASS](#module_widgets/NotificationUI..NOTIFICATION_STYLES_CSS_CLASS) : <code>enum</code>
* [.CLOSE_REASON](#module_widgets/NotificationUI..CLOSE_REASON) : <code>enum</code>
* [.createFromTemplate(template, [elementID], [options])](#module_widgets/NotificationUI..createFromTemplate) ⇒ <code>Notification</code>
* [.createToastFromTemplate(title, template, [options])](#module_widgets/NotificationUI..createToastFromTemplate) ⇒ <code>Notification</code>

Expand All @@ -59,16 +59,34 @@ This section outlines the properties and methods available in this module
**Kind**: inner property of [<code>widgets/NotificationUI</code>](#module_widgets/NotificationUI)
<a name="module_widgets/NotificationUI..NOTIFICATION_STYLES_CSS_CLASS"></a>

### widgets/NotificationUI.NOTIFICATION\_STYLES\_CSS\_CLASS : <code>object</code>
### widgets/NotificationUI.NOTIFICATION\_STYLES\_CSS\_CLASS : <code>enum</code>
CSS class names for notification styles.

**Kind**: inner constant of [<code>widgets/NotificationUI</code>](#module_widgets/NotificationUI)
**Kind**: inner enum of [<code>widgets/NotificationUI</code>](#module_widgets/NotificationUI)
**Properties**

| Name | Type | Default |
| --- | --- | --- |
| INFO | <code>string</code> | <code>&quot;style-info&quot;</code> |
| WARNING | <code>string</code> | <code>&quot;style-warning&quot;</code> |
| SUCCESS | <code>string</code> | <code>&quot;style-success&quot;</code> |
| ERROR | <code>string</code> | <code>&quot;style-error&quot;</code> |
| DANGER | <code>string</code> | <code>&quot;style-danger&quot;</code> |

<a name="module_widgets/NotificationUI..CLOSE_REASON"></a>

### widgets/NotificationUI.CLOSE\_REASON : <code>object</code>
### widgets/NotificationUI.CLOSE\_REASON : <code>enum</code>
Closing notification reason.

**Kind**: inner constant of [<code>widgets/NotificationUI</code>](#module_widgets/NotificationUI)
**Kind**: inner enum of [<code>widgets/NotificationUI</code>](#module_widgets/NotificationUI)
**Properties**

| Name | Type | Default |
| --- | --- | --- |
| TIMEOUT | <code>string</code> | <code>&quot;closeTimeout&quot;</code> |
| CLICK_DISMISS | <code>string</code> | <code>&quot;clickDismiss&quot;</code> |
| CLOSE_BTN_CLICK | <code>string</code> | <code>&quot;closeBtnClick&quot;</code> |

<a name="module_widgets/NotificationUI..createFromTemplate"></a>

### widgets/NotificationUI.createFromTemplate(template, [elementID], [options]) ⇒ <code>Notification</code>
Expand Down
46 changes: 40 additions & 6 deletions src/widgets/DefaultDialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,50 @@
*
*/

// @INCLUDE_IN_API_DOCS

define(function (require, exports, module) {

/**
* Constants representing dialog IDs
* These IDs are used to identify different types of dialogs
*
* @module DefaultDialogs
*/

/**
* ID for error dialog
* @constant {string}
*/
exports.DIALOG_ID_ERROR = "error-dialog";

/**
* ID for information dialog (currently uses the same template as DIALOG_ID_ERROR)
* @constant {string}
*/
exports.DIALOG_ID_INFO = "error-dialog"; // uses the same template for now--could be different in future

/**
* ID for save and close dialog
* @constant {string}
*/
exports.DIALOG_ID_SAVE_CLOSE = "save-close-dialog";

/**
* ID for `external change detected` dialog
* @constant {string}
*/
exports.DIALOG_ID_EXT_CHANGED = "ext-changed-dialog";

/**
* ID for `external deletion detected` dialog
* @constant {string}
*/
exports.DIALOG_ID_EXT_DELETED = "ext-deleted-dialog";

/**
* List of constants for the default dialogs IDs.
* ID for `change extensions` dialog
* @constant {string}
*/
exports.DIALOG_ID_ERROR = "error-dialog";
exports.DIALOG_ID_INFO = "error-dialog"; // uses the same template for now--could be different in future
exports.DIALOG_ID_SAVE_CLOSE = "save-close-dialog";
exports.DIALOG_ID_EXT_CHANGED = "ext-changed-dialog";
exports.DIALOG_ID_EXT_DELETED = "ext-deleted-dialog";
exports.DIALOG_ID_CHANGE_EXTENSIONS = "change-marked-extensions";
});
Loading

0 comments on commit 16e2eae

Please sign in to comment.