diff --git a/content/docs/reference/addon-api/addon.tab/_index.md b/content/docs/reference/addon-api/addon.tab/_index.md index 111ee180e..c775f5d82 100644 --- a/content/docs/reference/addon-api/addon.tab/_index.md +++ b/content/docs/reference/addon-api/addon.tab/_index.md @@ -348,6 +348,229 @@ Internally uses `window.django.gettext` or `window._messages`. See [addon.tab.appendToSharedSpace](addon.tab.appendtosharedspace). +### `addon.tab.createModal` + + + + + + + + + + + + + + + + + + + +
ParameterTypeRequiredDescription
titlestringYesThe title of the modal.
optionsobjectNo + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterTypeDefaultDescription
isOpenBooleanfalseWhether to open the modal by default.
useEditorClassesBooleanfalseIf in the editor, whether to apply the editor styles instead of the scratch-www ones.
useSizesClassBooleanfalseIf on scratch-www, whether to add the modal-sizes class.
+
+ + + + + + +
Return valueObject
+ +Returns a blank modal using Scratch's styles. The modal's properties are listed below. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyTypeDescription
containerHTMLElementThe container element.
contentHTMLElementWhere the content should be appended.
backdropHTMLElementThe modal overlay.
closeButtonHTMLElementThe close (X) button on the header.
openFunctionOpens the modal.
closeFunctionCloses the modal.
removeFunctionRemoves the modal, making it no longer usable.
+ +### `addon.tab.confirm` + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterTypeRequiredDescription
titlestringYesThe title of the modal.
messagestringYesThe message displayed in the modal.
optionsobjectNo + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterTypeDefaultDescription
useEditorClassesBooleanfalseIf in the editor, whether to apply the editor styles instead of the scratch-www ones.
okButtonLabelstring"OK"The label of the button for approving the confirmation.
cancelButtonLabelstring"Cancel"The label of the button for rejecting the confirmation.
+
+ + + + + + +
Return valuePromise<Boolean>
+ +Similar to `window.confirm`, except it's asynchronous and uses Scratch's styles. + +### `addon.tab.prompt` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterTypeRequiredDescription
titlestringYesThe title of the modal.
messagestringYesThe message displayed in the modal.
defaultValuestringNoThe initial value of the text box.
optionsobjectNo + + + + + + + + + + + + + +
ParameterTypeDefaultDescription
useEditorClassesBooleanfalseIf in the editor, whether to apply the editor styles instead of the scratch-www ones.
+
+ + + + + + +
Return valuePromise<string | null>
+ +Similar to `window.prompt`, except it's asynchronous and uses Scratch's styles. + ### `addon.tab.createBlockContextMenu`