Fixed codemirror black screen issue on OSX.

This commit is contained in:
Nikhil Mohite 2021-02-19 11:14:27 +05:30 committed by Akshay Joshi
parent aeb42b1059
commit f65eb546b7
2 changed files with 29 additions and 0 deletions

View File

@ -1869,6 +1869,7 @@ define([
}).done(function(res) { }).done(function(res) {
self.sqlCtrl.clearHistory(); self.sqlCtrl.clearHistory();
self.sqlCtrl.setValue(res.data); self.sqlCtrl.setValue(res.data);
self.setCodeMirrorHeight(obj);
}).fail(function() { }).fail(function() {
self.model.trigger('pgadmin-view:msql:error', self.method, node, arguments); self.model.trigger('pgadmin-view:msql:error', self.method, node, arguments);
}).always(function() { }).always(function() {
@ -1884,6 +1885,7 @@ define([
} }
this.sqlCtrl.refresh.apply(this.sqlCtrl); this.sqlCtrl.refresh.apply(this.sqlCtrl);
} }
this.setCodeMirrorHeight(obj);
}, },
onPanelResized: function(o) { onPanelResized: function(o) {
if (o && o.container) { if (o && o.container) {
@ -1900,6 +1902,7 @@ define([
); );
} }
} }
this.sqlCtrl.setSize($tabContent.width() + 'px', $tabContent.height() + 'px');
}, },
remove: function() { remove: function() {
if (this.sqlCtrl) { if (this.sqlCtrl) {
@ -1914,6 +1917,25 @@ define([
Backform.Control.__super__.remove.apply(this, arguments); Backform.Control.__super__.remove.apply(this, arguments);
}, },
setCodeMirrorHeight: function(obj) {
// Fix for mac os code-mirror showing black screen.
var txtArea = $('.pgadmin-controls .pg-el-sm-12 .SQL > .CodeMirror > div > textarea').first();
txtArea.css('z-index', -1);
var $tabContent = $('.backform-tab > .tab-content').first();
var $sqlPane = $tabContent.find('.CodeMirror > div > textarea');
for(let i=0; i<$sqlPane.length; i++) {$($sqlPane[i]).css('z-index', -1);}
$tabContent = $('.backform-tab > .tab-content').first();
$sqlPane = $tabContent.find('div[role=tabpanel].tab-pane.' + obj.tab.innerText);
// Set height to CodeMirror.
if ($sqlPane.hasClass('active')) {
$sqlPane.find('.CodeMirror').css(
'cssText',
'height: ' + ($tabContent.height()) + 'px !important;'
);
}
}
}); });
/* /*
* Numeric input Control functionality just like backgrid * Numeric input Control functionality just like backgrid

View File

@ -179,10 +179,12 @@
.CodeMirror-simplescroll-horizontal { .CodeMirror-simplescroll-horizontal {
height: $scrollbar-width; height: $scrollbar-width;
z-index: 1;
} }
.CodeMirror-simplescroll-vertical { .CodeMirror-simplescroll-vertical {
width: $scrollbar-width; width: $scrollbar-width;
z-index: 1;
} }
.CodeMirror-scrollbar-filler, .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { .CodeMirror-scrollbar-filler, .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
@ -206,3 +208,8 @@
.bg-gray-lighter { .bg-gray-lighter {
background-color: $sql-editor-disable-bg !important; background-color: $sql-editor-disable-bg !important;
} }
// Set z-index of scroll less than CodeMirror editor
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
z-index:1;
}