(core) Fix sizing of tracebacks in formula errors, to make it scrollable

Summary: When traceback is present, give it 64px, or more if available, or less if less is needed. If less space is available than needed, the traceback will scroll within its allocated area.

Test Plan: The test FieldEditorSizing which tests basic sizing still passes; details with different size of formula and traceback were tested manually.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3531
This commit is contained in:
Dmitry S
2022-07-20 19:40:22 -04:00
parent dd8d2e18f5
commit 4e805a4d9c
4 changed files with 56 additions and 18 deletions

View File

@@ -234,11 +234,17 @@ AceEditor.prototype._setup = function() {
AceEditor.prototype.resize = function() {
var wrap = this.session.getUseWrapMode();
var contentWidth = wrap ? 0 : this._getContentWidth();
var contentHeight = this._getContentHeight();
var desiredSize = {
width: wrap ? 0 : contentWidth + this.textPadding,
height: this._getContentHeight()
height: contentHeight,
};
var size = this.calcSize(this._fullDom, desiredSize);
if (size.height < contentHeight) {
// Editor will show a vertical scrollbar, so recalculate to make space for it.
desiredSize.width += 20;
size = this.calcSize(this._fullDom, desiredSize);
}
if (size.width < contentWidth) {
// Editor will show a horizontal scrollbar, so recalculate to make space for it.
desiredSize.height += 20;