Skip to content

Commit 35263b4

Browse files
Merge pull request #18311 from MoonE/textarea-resize
Only allow resizing textarea vertically
2 parents e37ff76 + d67b139 commit 35263b4

5 files changed

Lines changed: 14 additions & 30 deletions

File tree

js/src/database/events.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,10 @@ const DatabaseEvents = {
374374
* the Definition textarea.
375375
*/
376376
var $elm = $('textarea[name=item_definition]').last();
377-
var linterOptions = {};
378-
linterOptions.eventEditor = true;
379-
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
377+
var linterOptions = {
378+
eventEditor: true,
379+
};
380+
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
380381
}); // end $.get()
381382
},
382383

js/src/database/multi_table_query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ AJAX.registerTeardown('database/multi_table_query.js', function () {
3030
});
3131

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

js/src/database/routines.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,10 @@ const DatabaseRoutines = {
391391
* the Definition textarea.
392392
*/
393393
var $elm = $('textarea[name=item_definition]').last();
394-
var linterOptions = {};
395-
linterOptions.routineEditor = true;
396-
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
394+
var linterOptions = {
395+
routineEditor: true,
396+
};
397+
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
397398

398399
// Execute item-specific code
399400
that.postDialogShow(data);

js/src/database/triggers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,10 @@ const DatabaseTriggers = {
382382
* the Definition textarea.
383383
*/
384384
var $elm = $('textarea[name=item_definition]').last();
385-
var linterOptions = {};
386-
linterOptions.triggerEditor = true;
387-
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
385+
var linterOptions = {
386+
triggerEditor: true,
387+
};
388+
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'vertical', linterOptions);
388389
}); // end $.get()
389390
},
390391

js/src/modules/functions.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -252,27 +252,8 @@ function getSqlEditor ($textarea, options = undefined, resize = undefined, lintO
252252
resizeType = 'vertical';
253253
}
254254

255-
var handles = '';
256-
if (resizeType === 'vertical') {
257-
handles = 's';
258-
}
259-
260-
if (resizeType === 'both') {
261-
handles = 'all';
262-
}
263-
264-
if (resizeType === 'horizontal') {
265-
handles = 'e, w';
266-
}
267-
268255
$(codemirrorEditor.getWrapperElement())
269-
.css('resize', resizeType)
270-
.resizable({
271-
handles: handles,
272-
resize: function () {
273-
codemirrorEditor.setSize($(this).width(), $(this).height());
274-
}
275-
});
256+
.css('resize', resizeType);
276257

277258
// enable autocomplete
278259
codemirrorEditor.on('inputRead', Functions.codeMirrorAutoCompleteOnInputRead);

0 commit comments

Comments
 (0)