Skip to content

utils/app-utils

function closeOnOutsideClick(eventTarget: EventTarget, additionalCheck?: (target: Element) => boolean): void

Defined in: studiocms/packages/studiocms_devapps/src/utils/app-utils.ts:27

Attaches an event listener to the specified event target that listens for the ‘app-toggled’ event. When the ‘app-toggled’ event is triggered, it adds or removes a click event listener on the document based on the state provided in the event’s detail.

The click event listener will dispatch a ‘toggle-app’ event with state: false if the click occurs outside of the specified elements or does not pass the additional check.

EventTarget

The target to which the ‘app-toggled’ event listener is attached.

(target: Element) => boolean

An optional function that takes an Element and returns a boolean. If provided, the click event listener will not dispatch the ‘toggle-app’ event if this function returns true for the clicked target.

void


function createWindowElement(content: string): DevToolbarWindow

Defined in: studiocms/packages/studiocms_devapps/src/utils/app-utils.ts:7

Creates a new window element with the specified content.

string

The HTML content to be inserted into the window element.

DevToolbarWindow

The newly created window element with the specified content.