|
| 1 | +### Import : |
| 2 | +```js |
| 3 | +const Dialogs = brackets.getModule("widgets/Dialogs") |
| 4 | +``` |
| 5 | + |
| 6 | +<a name="DIALOG_BTN_CANCEL"></a> |
| 7 | + |
| 8 | +## DIALOG\_BTN\_CANCEL : <code>string</code> |
| 9 | +`CANCEL` dialog button ID |
| 10 | + |
| 11 | +**Kind**: global constant |
| 12 | +<a name="DIALOG_BTN_OK"></a> |
| 13 | + |
| 14 | +## DIALOG\_BTN\_OK : <code>string</code> |
| 15 | +`OK` dialog button ID |
| 16 | + |
| 17 | +**Kind**: global constant |
| 18 | +<a name="DIALOG_BTN_DONTSAVE"></a> |
| 19 | + |
| 20 | +## DIALOG\_BTN\_DONTSAVE : <code>string</code> |
| 21 | +`DONT SAVE` dialog button ID |
| 22 | + |
| 23 | +**Kind**: global constant |
| 24 | +<a name="DIALOG_BTN_SAVE_AS"></a> |
| 25 | + |
| 26 | +## DIALOG\_BTN\_SAVE\_AS : <code>string</code> |
| 27 | +`SAVE AS` dialog button ID |
| 28 | + |
| 29 | +**Kind**: global constant |
| 30 | +<a name="DIALOG_CANCELED"></a> |
| 31 | + |
| 32 | +## DIALOG\_CANCELED : <code>string</code> |
| 33 | +`CANCELED` dialog button ID |
| 34 | + |
| 35 | +**Kind**: global constant |
| 36 | +<a name="DIALOG_BTN_DOWNLOAD"></a> |
| 37 | + |
| 38 | +## DIALOG\_BTN\_DOWNLOAD : <code>string</code> |
| 39 | +`DOWNLOAD` dialog button ID |
| 40 | + |
| 41 | +**Kind**: global constant |
| 42 | +<a name="DIALOG_BTN_CLASS_PRIMARY"></a> |
| 43 | + |
| 44 | +## DIALOG\_BTN\_CLASS\_PRIMARY : <code>string</code> |
| 45 | +Primary button class name |
| 46 | + |
| 47 | +**Kind**: global constant |
| 48 | +<a name="DIALOG_BTN_CLASS_NORMAL"></a> |
| 49 | + |
| 50 | +## DIALOG\_BTN\_CLASS\_NORMAL : <code>string</code> |
| 51 | +Normal button class name |
| 52 | + |
| 53 | +**Kind**: global constant |
| 54 | +<a name="DIALOG_BTN_CLASS_LEFT"></a> |
| 55 | + |
| 56 | +## DIALOG\_BTN\_CLASS\_LEFT : <code>string</code> |
| 57 | +Left-aligned button class name |
| 58 | + |
| 59 | +**Kind**: global constant |
| 60 | +<a name="showModalDialogUsingTemplate"></a> |
| 61 | + |
| 62 | +## showModalDialogUsingTemplate(template, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new) |
| 63 | +Creates a new modal dialog from a given template. |
| 64 | +The template can either be a string or a jQuery object representing a DOM node that is *not* in the current DOM. |
| 65 | + |
| 66 | +**Kind**: global function |
| 67 | + |
| 68 | +| Param | Type | Description | |
| 69 | +| --- | --- | --- | |
| 70 | +| template | <code>string</code> | A string template or jQuery object to use as the dialog HTML. | |
| 71 | +| [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. | |
| 72 | + |
| 73 | +<a name="showModalDialog"></a> |
| 74 | + |
| 75 | +## showModalDialog(dlgClass, [title], [message], [buttons], [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new) |
| 76 | +Creates a new general purpose modal dialog using the default template and the template variables given |
| 77 | +as parameters as described. |
| 78 | + |
| 79 | +**Kind**: global function |
| 80 | + |
| 81 | +| Param | Type | Description | |
| 82 | +| --- | --- | --- | |
| 83 | +| dlgClass | <code>string</code> | A class name identifier for the dialog. Typically one of DefaultDialogs.* | |
| 84 | +| [title] | <code>string</code> | The title of the dialog. Can contain HTML markup. Defaults to "". | |
| 85 | +| [message] | <code>string</code> | The message to display in the dialog. Can contain HTML markup. Defaults to "". | |
| 86 | +| [buttons] | <code>Array.<{className: string, id: string, text: string, tooltip:string}></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_* | |
| 87 | +| [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. | |
| 88 | + |
| 89 | +<a name="showConfirmDialog"></a> |
| 90 | + |
| 91 | +## showConfirmDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new) |
| 92 | +Display a confirmation dialog with `OK` and `CANCEL` button |
| 93 | + |
| 94 | +**Kind**: global function |
| 95 | +**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance |
| 96 | + |
| 97 | +| Param | Type | Description | |
| 98 | +| --- | --- | --- | |
| 99 | +| title | <code>string</code> | dialog title | |
| 100 | +| message | <code>string</code> | message to display in the dialog | |
| 101 | +| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not | |
| 102 | + |
| 103 | +<a name="showInfoDialog"></a> |
| 104 | + |
| 105 | +## showInfoDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new) |
| 106 | +Display information dialog |
| 107 | + |
| 108 | +**Kind**: global function |
| 109 | +**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance |
| 110 | + |
| 111 | +| Param | Type | Description | |
| 112 | +| --- | --- | --- | |
| 113 | +| title | <code>string</code> | dialog title | |
| 114 | +| message | <code>string</code> | message to display in the dialog | |
| 115 | +| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not | |
| 116 | + |
| 117 | +<a name="showErrorDialog"></a> |
| 118 | + |
| 119 | +## showErrorDialog(title, message, [autoDismiss]) ⇒ [<code>Dialog</code>](#new_Dialog_new) |
| 120 | +Display error dialog |
| 121 | + |
| 122 | +**Kind**: global function |
| 123 | +**Returns**: [<code>Dialog</code>](#new_Dialog_new) - the created dialog instance |
| 124 | + |
| 125 | +| Param | Type | Description | |
| 126 | +| --- | --- | --- | |
| 127 | +| title | <code>string</code> | dialog title | |
| 128 | +| message | <code>string</code> | message to display in the dialog | |
| 129 | +| [autoDismiss] | <code>boolean</code> | whether to automatically dismiss the dialog or not | |
| 130 | + |
| 131 | +<a name="cancelModalDialogIfOpen"></a> |
| 132 | + |
| 133 | +## cancelModalDialogIfOpen(dlgClass, [buttonId]) |
| 134 | +Immediately closes any dialog instances with the given class. The dialog callback for each instance will |
| 135 | +be called with the special buttonId DIALOG_CANCELED (note: callback is run asynchronously). |
| 136 | + |
| 137 | +**Kind**: global function |
| 138 | + |
| 139 | +| Param | Type | Description | |
| 140 | +| --- | --- | --- | |
| 141 | +| dlgClass | <code>string</code> | The class name identifier for the dialog. | |
| 142 | +| [buttonId] | <code>string</code> | The button id to use when closing the dialog. Defaults to DIALOG_CANCELED | |
| 143 | + |
| 144 | +<a name="addLinkTooltips"></a> |
| 145 | + |
| 146 | +## addLinkTooltips(elementOrDialog) |
| 147 | +Ensures that all <a> tags with a URL have a tooltip showing the same URL |
| 148 | + |
| 149 | +**Kind**: global function |
| 150 | + |
| 151 | +| Param | Type | Description | |
| 152 | +| --- | --- | --- | |
| 153 | +| elementOrDialog | <code>jQueryObject</code> \| [<code>Dialog</code>](#new_Dialog_new) | Dialog intance, or root of other DOM tree to add tooltips to | |
| 154 | + |
0 commit comments