Skip to content

Commit

Permalink
LPS-111979 Center CKEditor dialogs
Browse files Browse the repository at this point in the history
The goal of this fix is to "center" CKEditor's dialogs.

Since our recent change to use CKEditor in more places, CKEditor dialogs
are now aligned in the top left corner instead of being centered.

The only previous commit I could find concerning this file is in
[https://github.com/liferay/liferay-portal/commit/a4df2c65a8fb39c139e0e9781078b2092c868f68](https://github.com/liferay/liferay-portal/commit/a4df2c65a8fb39c139e0e9781078b2092c868f68),
when the file was initially added.
  • Loading branch information
Julien Castelain committed May 4, 2020
1 parent a2cae1b commit 379087f
Showing 1 changed file with 22 additions and 24 deletions.
Expand Up @@ -23,30 +23,28 @@ CKEDITOR.on('dialogDefinition', (event) => {
onShow.apply(this, arguments);
}

if (window.top != window.self) {
var editorElement = this.getParentEditor().container;

var documentPosition = editorElement
.getLast()
.getDocumentPosition();

var dialogSize = this.getSize();

var x =
documentPosition.x +
((editorElement.getLast().getSize('width', true) -
dialogSize.width) /
2 -
window.scrollX);
var y =
documentPosition.y +
((editorElement.getLast().getSize('height', true) -
dialogSize.height) /
2 -
window.scrollY);

this.move(x, y, false);
}
var editorElement = this.getParentEditor().container;

var documentPosition = editorElement
.getLast()
.getDocumentPosition();

var dialogSize = this.getSize();

var x =
documentPosition.x +
((editorElement.getLast().getSize('width', true) -
dialogSize.width) /
2 -
window.scrollX);
var y =
documentPosition.y +
((editorElement.getLast().getSize('height', true) -
dialogSize.height) /
2 -
window.scrollY);

this.move(x, y, false);
};
}
});

0 comments on commit 379087f

Please sign in to comment.