Only allow resizing textarea vertically

Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
This commit is contained in:
Maximilian Krög 2023-04-01 18:41:30 +02:00
parent 3f26fa5cd0
commit d67b1391ce
No known key found for this signature in database
GPG Key ID: 3C00897BB53AAB9C
5 changed files with 14 additions and 30 deletions

View File

@ -374,9 +374,10 @@ const DatabaseEvents = {
* the Definition textarea.
*/
var $elm = $('textarea[name=item_definition]').last();
var linterOptions = {};
linterOptions.eventEditor = true;
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
var linterOptions = {
eventEditor: true,
};
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
}); // end $.get()
},

View File

@ -30,7 +30,7 @@ AJAX.registerTeardown('database/multi_table_query.js', function () {
});
AJAX.registerOnload('database/multi_table_query.js', function () {
var editor = Functions.getSqlEditor($('#MultiSqlquery'), {}, 'both');
var editor = Functions.getSqlEditor($('#MultiSqlquery'), {}, 'vertical');
$('.CodeMirror-line').css('text-align', 'left');
editor.setSize(-1, 50);

View File

@ -391,9 +391,10 @@ const DatabaseRoutines = {
* the Definition textarea.
*/
var $elm = $('textarea[name=item_definition]').last();
var linterOptions = {};
linterOptions.routineEditor = true;
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
var linterOptions = {
routineEditor: true,
};
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
// Execute item-specific code
that.postDialogShow(data);

View File

@ -382,9 +382,10 @@ const DatabaseTriggers = {
* the Definition textarea.
*/
var $elm = $('textarea[name=item_definition]').last();
var linterOptions = {};
linterOptions.triggerEditor = true;
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
var linterOptions = {
triggerEditor: true,
};
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
}); // end $.get()
},

View File

@ -256,27 +256,8 @@ function getSqlEditor ($textarea, options, resize, lintOptions) {
resizeType = 'vertical';
}
var handles = '';
if (resizeType === 'vertical') {
handles = 's';
}
if (resizeType === 'both') {
handles = 'all';
}
if (resizeType === 'horizontal') {
handles = 'e, w';
}
$(codemirrorEditor.getWrapperElement())
.css('resize', resizeType)
.resizable({
handles: handles,
resize: function () {
codemirrorEditor.setSize($(this).width(), $(this).height());
}
});
.css('resize', resizeType);
// enable autocomplete
codemirrorEditor.on('inputRead', Functions.codeMirrorAutoCompleteOnInputRead);