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

* fixed position of the dialog at the top of the page
  • Loading branch information
oanalavinia committed Feb 24, 2020
1 parent 29e60ab commit 214f5a3
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,26 @@
return config;
};

// 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';
};

// If a diagram is inserted in a page with a lot of content before it, then PrintDialog won't be visible, since the
// top of the dialog is computed to consider a page that only holds the diagram.
var originalShowDialog = EditorUi.prototype.showDialog;
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);
}));
}
};

$.fn.viewDiagram = function(configOverride) {
return this.each(function() {
var fromStorage = false;
Expand Down

0 comments on commit 214f5a3

Please sign in to comment.