diff --git a/pages/index.vue b/pages/index.vue
index 501be50c..82788ad0 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -68,7 +68,7 @@
-
+
@@ -379,6 +379,31 @@
},
removeRequestBodyParam(index) {
this.bodyParams.splice(index, 1)
+ },
+ formatRawParams(event) {
+ if ((event.which !== 13 && event.which !== 9)) {
+ console.log('not not returning');
+ return
+ }
+
+ const textBody = event.target.value;
+ const textBeforeCursor = textBody.substring(0, event.target.selectionStart);
+ const textAfterCursor = textBody.substring(event.target.selectionEnd);
+
+ if (event.which === 13) {
+ const lastLine = textBody.split('\n').slice(-1)[0];
+ const rightPadding = lastLine.match(/([\s\t]*).*/)[1] || "";
+ setTimeout(() => event.target.value = textBeforeCursor + '\n' + rightPadding + textAfterCursor, 1);
+ }
+ else if (event.which === 9) {
+ event.preventDefault();
+ const oldSelectionStart = event.target.selectionStart;
+ const oldSelectionEnd = event.target.selectionEnd;
+ event.target.value = textBeforeCursor + '\xa0\xa0' + textAfterCursor;
+ debugger;
+ event.target.selectionStart = event.target.selectionEnd = oldSelectionStart + 2;
+ return false;
+ }
}
}
}