Skip to content

Commit

Permalink
Diagram print dialog box is attached to the XWiki page and not the di…
Browse files Browse the repository at this point in the history
…agram modal box xwikisas#117

* ovveride Dialog's resizeListener, which is already handled
  • Loading branch information
oanalavinia committed Feb 26, 2020
1 parent 2842918 commit 9ff6bdc
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@
};

// Fix position of a dialog at the top of the window.
var fixDialogPosition = function(editorUi) {
editorUi.dialog.container.style.top = '0px';
editorUi.dialog.container.style.position = 'fixed';
Dialog.prototype.fixDialogPosition = function() {
this.container.style.top = '0px';
this.container.style.position = 'fixed';
};

// If a diagram is inserted in a page with a lot of content before it, then PrintDialog won't be visible, since the
Expand All @@ -262,11 +262,17 @@
EditorUi.prototype.showDialog = function(elt, w, h, modal, closable, onClose, noScroll, transparent, onResize,
ignoreBgClick) {
originalShowDialog.apply(this, arguments);
if ($(this.dialog.container).find("input[name='printZoom']")) {
fixDialogPosition(this);
mxEvent.addListener(window, 'resize', mxUtils.bind(this, function() {
fixDialogPosition(this);
}));
var dialog = this.dialog;
if ($(dialog.container).find("input[name='printZoom']")) {
dialog.fixDialogPosition();
var originalResizeListener = dialog.resizeListener;
dialog.resizeListener = mxUtils.bind(dialog, function() {
originalResizeListener.apply(this, arguments);
this.fixDialogPosition();
});
// Since the listener is already added at construction step, we need to remove it and reattach the new function.
mxEvent.removeListener(window, 'resize', originalResizeListener);
mxEvent.addListener(window, 'resize', dialog.resizeListener);
}
};

Expand Down

0 comments on commit 9ff6bdc

Please sign in to comment.