From fcf30f6674da2cd2be893212ffa9e552d9f75493 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 9 Sep 2023 12:01:18 +0200 Subject: [PATCH] Add the import statement to the dialog examples --- docs/javascript/components_confirmation.md | 2 ++ docs/javascript/components_dialog.md | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/docs/javascript/components_confirmation.md b/docs/javascript/components_confirmation.md index 14eaaa38..ea9efd56 100644 --- a/docs/javascript/components_confirmation.md +++ b/docs/javascript/components_confirmation.md @@ -8,6 +8,8 @@ You can exclude extra information or form elements in confirmation dialogs, but ## Example ```ts +import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation"; + const result = await confirmationFactory() .custom("Do you want a cookie?") .withoutMessage(); diff --git a/docs/javascript/components_dialog.md b/docs/javascript/components_dialog.md index 3dd85bb5..297d77ad 100644 --- a/docs/javascript/components_dialog.md +++ b/docs/javascript/components_dialog.md @@ -21,6 +21,8 @@ Dialogs may contain just an explanation or extra information that should be pres The dialog can be closed via the “X” button or by clicking the modal backdrop. ```ts +import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog"; + const dialog = dialogFactory().fromHtml("

Hello World

").withoutControls(); dialog.show("Greetings from my dialog"); ``` @@ -43,6 +45,8 @@ An alert will only provide a single button to acknowledge the dialog and must no The dialog itself will be limited to a width of 500px, the title can wrap into multiple lines and there will be no “X” button to close the dialog. ```ts +import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog"; + const dialog = dialogFactory() .fromHtml("

ERROR: Something went wrong!

") .asAlert(); @@ -106,6 +110,8 @@ A possible use case for an “extra” button would be a dialog that includes an ``` ```ts +import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog"; + document.getElementById("showMyDialog")!.addEventListener("click", () => { const dialog = dialogFactory().fromId("myDialog").asPrompt(); -- 2.20.1