mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure CodeMirror always has a non-zero font size. Fixes #3480
This commit is contained in:
committed by
Dave Page
parent
3b862bd70b
commit
2b9c0a63fb
@@ -1,6 +1,3 @@
|
|||||||
:root {
|
|
||||||
--codemirror-font-size : 1em;
|
|
||||||
}
|
|
||||||
/* Styles for the main browser */
|
/* Styles for the main browser */
|
||||||
.browser-pane-container {
|
.browser-pane-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -71,5 +68,5 @@ samp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror {
|
.CodeMirror {
|
||||||
font-size: var(--codemirror-font-size, '1em');
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,12 +65,15 @@ _.extend(pgBrowser, {
|
|||||||
preferences[preference.name] = preference.value;
|
preferences[preference.name] = preference.value;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
if(Object.keys(preferences).length > 0) {
|
||||||
return preferences;
|
return preferences;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Get preference of an id, id is numeric */
|
/* Get preference of an id, id is numeric */
|
||||||
get_preference_for_id : function(id) {
|
get_preference_for_id : function(id) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
/* findWhere returns undefined if not found */
|
||||||
return _.findWhere(self.preferences_cache, {'id': id});
|
return _.findWhere(self.preferences_cache, {'id': id});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -188,11 +188,12 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
|
|||||||
|
|
||||||
calcFontSize: function(fontSize) {
|
calcFontSize: function(fontSize) {
|
||||||
if(fontSize) {
|
if(fontSize) {
|
||||||
return Number((Math.round(fontSize + 'e+2') + 'e-2')) + 'em';
|
let rounded = Number((Math.round(fontSize + 'e+2') + 'e-2'));
|
||||||
|
if(rounded > 0) {
|
||||||
|
return rounded + 'em';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return '0em';
|
|
||||||
}
|
}
|
||||||
|
return '1em';
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
return sqlEditorUtils;
|
return sqlEditorUtils;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function (SqlEditorUtils) {
|
|||||||
describe('Calculate font size of input number passed', function () {
|
describe('Calculate font size of input number passed', function () {
|
||||||
it('calcFontSize', function () {
|
it('calcFontSize', function () {
|
||||||
expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
|
expect(SqlEditorUtils.calcFontSize(1.456)).toEqual('1.46em');
|
||||||
expect(SqlEditorUtils.calcFontSize()).toEqual('0em');
|
expect(SqlEditorUtils.calcFontSize()).toEqual('1em');
|
||||||
expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
|
expect(SqlEditorUtils.calcFontSize(2)).toEqual('2em');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user