From 7c9969e2bf8486fc7e5b3933862f6392850bdd75 Mon Sep 17 00:00:00 2001 From: Johannes Lerch Date: Tue, 20 Mar 2018 08:21:10 +0100 Subject: [PATCH 1/2] Support to paste multiple commands --- css/explaingit.css | 11 ++++++++--- js/controlbox.js | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/css/explaingit.css b/css/explaingit.css index 13f9b22..b434b33 100644 --- a/css/explaingit.css +++ b/css/explaingit.css @@ -159,7 +159,7 @@ span.cmd { text-indent: -15px; } -.control-box .log, .control-box input[type="text"], .control-box .input { +.control-box .log, .control-box textarea, .control-box .input { font-family: Courier New; font-size: 14px; } @@ -171,10 +171,15 @@ span.cmd { background: url(../images/prompt.gif) no-repeat left top black; } -.control-box input[type="text"] { +.control-box textarea { position: absolute; bottom: 0; padding-left: 15px; + padding-top: 2px; + padding-right: 0px; + padding-bottom: 2px; + overflow: hidden; + resize: none; color: #FFF; line-height: 14px; background: url(../images/prompt.gif) no-repeat left center black; @@ -193,7 +198,7 @@ span.cmd { color: #FCC; } -.control-box input[type="text"] { +.control-box textarea { width: 235px; border: none; } diff --git a/js/controlbox.js b/js/controlbox.js index c9761bf..67c5d04 100644 --- a/js/controlbox.js +++ b/js/controlbox.js @@ -132,8 +132,8 @@ function(_yargs, d3, demos) { log = cBoxContainer.append('div') .classed('log', true); - input = cBoxContainer.append('input') - .attr('type', 'text') + input = cBoxContainer.append('textarea') + .attr('rows', '1') .classed('input', true) .attr('placeholder', 'enter git command'); @@ -147,12 +147,32 @@ function(_yargs, d3, demos) { input.node().focus() }) + input.on('paste', function() { + setTimeout(function() { + if (input.node().value.trim() === '' || cBox.locked) { + return; + } + var lines = input.node().value.split(/\r?\n/); + + for(var i=0; i Date: Thu, 29 Mar 2018 07:48:58 +0200 Subject: [PATCH 2/2] disable line wrapping (CSS) --- css/explaingit.css | 1 + 1 file changed, 1 insertion(+) diff --git a/css/explaingit.css b/css/explaingit.css index b434b33..7247390 100644 --- a/css/explaingit.css +++ b/css/explaingit.css @@ -183,6 +183,7 @@ span.cmd { color: #FFF; line-height: 14px; background: url(../images/prompt.gif) no-repeat left center black; + white-space: nowrap; } .control-box .log .info, .control-box .log .error {