From a0062e3100da3d41f915efd42f191d6ae3e0d671 Mon Sep 17 00:00:00 2001 From: Niharika Kohli Date: Mon, 6 Nov 2017 15:42:05 -0800 Subject: [PATCH] Make textbox height flexible with CodeMirror Bug: T170906 Bug: T176449 (hopefully) Change-Id: Ic0ac663c413db5c29ae786d3c17f7396ad620226 --- extension.json | 3 ++- resources/ext.CodeMirror.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/extension.json b/extension.json index 51b67fed..3f259bbf 100644 --- a/extension.json +++ b/extension.json @@ -33,7 +33,8 @@ "mediawiki.user", "user.options", "oojs-ui-widgets", - "mediawiki.storage" + "mediawiki.storage", + "jquery.ui.resizable" ], "scripts": [ "ext.CodeMirror.js" diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js index aedb1b6f..4fa862f9 100644 --- a/resources/ext.CodeMirror.js +++ b/resources/ext.CodeMirror.js @@ -324,6 +324,13 @@ $codeMirror = $( codeMirror.getWrapperElement() ); + $codeMirror.resizable( { + handles: 'se', + resize: function ( event, ui ) { + ui.size.width = ui.originalSize.width; + } + } ); + codeMirror.doc.setSelection( codeMirror.doc.posFromIndex( selectionEnd ), codeMirror.doc.posFromIndex( selectionStart ) ); codeMirror.scrollTo( null, scrollTop );