Revert the revertion of multiline and clean it up for new directive.
This commit is contained in:
parent
8cb6fc623e
commit
20a8289072
|
@ -100,8 +100,10 @@ body {
|
|||
padding-bottom:70px;
|
||||
}
|
||||
|
||||
input#sendMessage {
|
||||
#sendMessage {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
resize: none;
|
||||
}
|
||||
#footer button {
|
||||
border-radius: 0;
|
||||
|
@ -109,7 +111,7 @@ input#sendMessage {
|
|||
.panel input, .panel .input-group {
|
||||
max-width: 300px;
|
||||
}
|
||||
input[type=text], input[type=password], .badge {
|
||||
input[type=text], input[type=password], #sendMessage, .badge {
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
color: #ccc;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<form class="form form-horizontal" ng-submit="sendMessage()">
|
||||
<form class="form form-horizontal" id="inputform" ng-submit="sendMessage()">
|
||||
<div class="input-group">
|
||||
<input id="{{inputId}}" type="text" class="form-control monospace" autocomplete="off" >
|
||||
<textarea id="{{inputId}}" class="form-control monospace" ng-trim="false" rows="1" autocomplete="off" ng-model="command">
|
||||
</textarea>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary">Send</button>
|
||||
</span>
|
||||
|
|
|
@ -1217,7 +1217,10 @@ weechat.directive('inputBar', function() {
|
|||
* Returns the input element
|
||||
*/
|
||||
$scope.getInputNode = function() {
|
||||
return $element.find('input')[0];
|
||||
return $element.find('#'+$scope.inputId)[0];
|
||||
};
|
||||
$scope.getForm = function() {
|
||||
return $element.find('form')[0];
|
||||
};
|
||||
|
||||
$scope.completeNick = function() {
|
||||
|
@ -1253,8 +1256,11 @@ weechat.directive('inputBar', function() {
|
|||
$scope.sendMessage = function() {
|
||||
|
||||
var input = $scope.getInputNode();
|
||||
connection.sendMessage(input.value);
|
||||
models.getActiveBuffer().addToHistory(input.value); // log to buffer history
|
||||
// Split the command into multiple commands based on line breaks
|
||||
_.each($scope.command.split(/\r?\n/), function(line) {
|
||||
connection.sendMessage(line);
|
||||
});
|
||||
input.value = '';
|
||||
};
|
||||
|
||||
|
@ -1363,6 +1369,14 @@ weechat.directive('inputBar', function() {
|
|||
// We don't need to set the cursor to the rightmost position here, the browser does that for us
|
||||
return true;
|
||||
}
|
||||
|
||||
// Enter to submit, shift-enter for newline
|
||||
//
|
||||
if (code == 13 && !$event.shiftKey) {
|
||||
$event.preventDefault();
|
||||
$scope.sendMessage();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue