Merge pull request #18311 from MoonE/textarea-resize

Only allow resizing textarea vertically
This commit is contained in:
Maurício Meneghini Fauth 2023-04-08 15:16:24 -03:00 committed by GitHub
commit 35263b4ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -252,27 +252,8 @@ function getSqlEditor ($textarea, options = undefined, resize = undefined, lintO
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);