Skip to content

Commit 569878b

Browse files
committed
Fix the ACE editor resizing
1 parent 0a3c747 commit 569878b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

system/config/ace.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@
104104
}
105105
});
106106

107-
// Disable command conflicts with AltGr (see #5792)
108-
editor.commands.bindKey('Ctrl-alt-a|Ctrl-alt-e|Ctrl-alt-h|Ctrl-alt-l|Ctrl-alt-s', null)
109-
110-
var updateTextarea = function() {
107+
editor.getSession().on('change', function() {
111108
ta.value = editor.getValue();
112-
};
109+
});
113110

114-
editor.getSession().on('change', updateTextarea);
111+
// Disable command conflicts with AltGr (see #5792)
112+
editor.commands.bindKey('Ctrl-alt-a|Ctrl-alt-e|Ctrl-alt-h|Ctrl-alt-l|Ctrl-alt-s', null)
115113

116114
var updateHeight = function() {
117115
var newHeight
118116
= editor.getSession().getScreenLength()
119117
* editor.renderer.lineHeight
118+
- editor.renderer.$padding - 2
120119
+ editor.renderer.scrollBar.getWidth();
121-
var setHeight = Math.max(newHeight, editor.container.getStyle('height'));
122-
editor.container.setStyle('height', setHeight.toString() + 'px');
120+
var minHeight = editor.renderer.lineHeight - editor.renderer.$padding - 2;
121+
if (newHeight < minHeight) newHeight = minHeight;
122+
editor.container.setStyle('height', newHeight + 'px');
123123
editor.resize();
124124
};
125125

0 commit comments

Comments
 (0)