diff --git a/src/main/html/index.html b/src/main/html/index.html index d95471a1247..4a5ae241d25 100644 --- a/src/main/html/index.html +++ b/src/main/html/index.html @@ -68,6 +68,8 @@ } addApiKeyAuthorization(); + + multilinable('input.parameter', 'body-textarea'); }, onFailure: function(data) { log("Unable to Load SwaggerUI"); @@ -79,6 +81,27 @@ showRequestHeaders: false }); + function multilinable(q, cls) { + $('').insertAfter($(q)); + $(q).keypress(function (e) { + if (e.ctrlKey && e.keyCode == 13) { + var $el = $(e.target); + var $ta = $(document.createElement('textarea')); + var attributes = $el.prop("attributes"); + $.each(attributes, function() { + $ta.attr(this.name, this.value); + }); + var v = $el.val(); + if (v) v = v + '\n'; + $ta.val(v); + $ta.addClass(cls); + $el.replaceWith($ta); + $ta.focus(); + return false; + } + }); + } + function addApiKeyAuthorization(){ var key = encodeURIComponent($('#input_apiKey')[0].value); if(key && key.trim() != "") {