(core) Fixing scrollbars on ace editor for windows users.

Summary: Fixing formula editor scrollbars for windows users.

Test Plan: Manual

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D3087
This commit is contained in:
Jarosław Sadziński 2021-10-24 23:56:46 +02:00
parent e5beafb256
commit 8eeeae7fbf
2 changed files with 11 additions and 2 deletions

View File

@ -245,8 +245,14 @@ AceEditor.prototype.resize = function() {
size = this.calcSize(this._fullDom, desiredSize); size = this.calcSize(this._fullDom, desiredSize);
} }
this.editorDom.style.width = size.width ? size.width + 'px' : 'auto'; // Setting height or width to number like 100.00000005 won't work (it will be truncated).
this.editorDom.style.height = size.height + 'px'; // Unfortunately ace editor will do the same math we do, and will expect the height or width
// of the container to be 100.0000005, and when it finds out that it is only 100px will show
// scrollbars. To fix this issue we will make the container a little bit bigger.
// This won't help for zooming (where the same problem occurs but in many more places), but will
// help for Windows users who have different pixel ratio.
this.editorDom.style.width = size.width ? Math.ceil(size.width) + 'px' : 'auto';
this.editorDom.style.height = Math.ceil(size.height) + 'px';
this.editor.resize(); this.editor.resize();
}; };

View File

@ -33,10 +33,13 @@
} }
/* Make overflow hidden, since editor might be 1 pixel bigger due to fix for devices
* with different pixel ratio */
.formula_editor { .formula_editor {
background-color: white; background-color: white;
padding: 4px 0 2px 21px; padding: 4px 0 2px 21px;
z-index: 10; z-index: 10;
overflow: hidden;
} }
/* styles specific to the formula editor in the side panel */ /* styles specific to the formula editor in the side panel */