Namespace: modal

modal

Helpers to manage modal windows in the current HTML document. This modal window will appear in the AskiaPortal module and not in the top frame.

 const dialogString = `<div class="dialog-window">
 <h2>Title of the dialog</h2>
 <div class="content">Click me to close</div>
 </div>`;
 const wrapper = document.createElement("div");
 wrapper.innerHTML = dialogString;
 const dialogElement = wrapper.childNodes[0];

 portal.modal.open({
     htmlElement : dialogElement
 }).then(() => {
     dialogElement.addEventListener("click", () => {
         portal.modal.close();
     });
 });
Dependencies:
  • ./css/portal.variables.css
  • ./css/portal.modal.css

Methods

(static) close() → {Promise}

Close the modal window

Returns:

Promise

Type
Promise

(static) open(config) → {Promise}

Open a modal window

Parameters:
Name Type Description
config Object

Configuration of the modal window

Properties
Name Type Attributes Description
htmlElement HTMLElement <optional>

HTML Element to append into the dialog window

Returns:

Promise

Type
Promise