iobroker.webui 1.34.2 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- export function moveElementToNewBrowserWindow(element, params) {
1
+ export function moveElementToNewBrowserWindow(panelContainer, params) {
2
+ const element = panelContainer.resolvedElementContent;
2
3
  const rect = element.getBoundingClientRect();
3
4
  const newWindowBounds = { x: rect.x + 24, y: rect.y + 60, width: rect.width, height: rect.height };
4
5
  const win = window.open('about:blank', undefined, `popup=yes,left=${newWindowBounds.x},top=${newWindowBounds.y},width=${newWindowBounds.width},height=${newWindowBounds.height}`);
@@ -48,6 +49,8 @@ export function moveElementToNewBrowserWindow(element, params) {
48
49
  e[0].shadowRoot.adoptedStyleSheets = e[1];
49
50
  }
50
51
  params.closeCallback();
52
+ panelContainer.dockManager.notifyOnNewWindow(panelContainer, win);
53
+ return win;
51
54
  }
52
55
  function cloneStyleSheet(window, stylesheet, cache) {
53
56
  const existingCopy = cache.get(stylesheet);
@@ -650,6 +650,14 @@ export class DockManager {
650
650
  }
651
651
  }
652
652
  }
653
+ notifyOnNewWindow(panel, win) {
654
+ this._checkShowBackgroundContext();
655
+ this.layoutEventListeners.forEach((listener) => {
656
+ if (listener.onNewWindow) {
657
+ listener.onNewWindow(this, panel, win);
658
+ }
659
+ });
660
+ }
653
661
  saveState() {
654
662
  let serializer = new DockGraphSerializer();
655
663
  return serializer.serialize(this.context.model);
@@ -475,7 +475,7 @@ export class PanelContainer {
475
475
  this.close();
476
476
  }
477
477
  undockToBrowserDialog() {
478
- moveElementToNewBrowserWindow(this.resolvedElementContent, {
478
+ moveElementToNewBrowserWindow(this, {
479
479
  title: this.elementTitleText.textContent,
480
480
  closeCallback: () => {
481
481
  this.undockedToNewBrowserWindow = true;