From d156d0e0b01d081b5efc37c9efc6e9267359a1aa Mon Sep 17 00:00:00 2001 From: Stefan Forsgren <33832077+steff-o@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:02:46 +0200 Subject: [PATCH] Made modal draggable (#1822) Co-authored-by: Stefan Forsgren --- src/ui/modal.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/modal.js b/src/ui/modal.js index 3c01c1e53..6ab2a3952 100644 --- a/src/ui/modal.js +++ b/src/ui/modal.js @@ -2,6 +2,7 @@ import Component from './component'; import Element from './element'; import Button from './button'; import { html } from './dom/dom'; +import utils from '../utils'; /** * Creates a modal and displays it. The modal is created as a div tag that is attached to the DOM as a child of the options.target element. @@ -93,7 +94,7 @@ export default function Modal(options = {}) { headerCmps.push(closeButton); headerEl = Element({ - cls: 'flex row justify-end grey-lightest', + cls: 'flex row justify-end grey-lightest draggable', components: headerCmps }); const elOptions = { cls: 'o-modal-content' }; @@ -121,6 +122,8 @@ export default function Modal(options = {}) { }, onRender() { modal = document.getElementById(this.getId()); + const modalBox = modal.getElementsByClassName('o-modal')[0]; + utils.makeElementDraggable(modalBox); document.getElementById(screenEl.getId()).addEventListener('click', () => { if (!isStatic) { closeButton.dispatch('click');