Split messages with newline into multiple messages
This commit is contained in:
parent
cb73039b67
commit
6dd35fa890
|
@ -105,8 +105,10 @@ body {
|
||||||
padding-bottom:70px;
|
padding-bottom:70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input#sendMessage {
|
#sendMessage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 36px;
|
||||||
|
resize: none;
|
||||||
}
|
}
|
||||||
#footer button {
|
#footer button {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
@ -114,7 +116,7 @@ input#sendMessage {
|
||||||
.panel input, .panel .input-group {
|
.panel input, .panel .input-group {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
input[type=text], input[type=password], .badge {
|
input[type=text], input[type=password], #sendMessage, .badge {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
color: #ccc;
|
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">
|
<div class="input-group">
|
||||||
<input id="sendMessage" type="text" class="form-control monospace" autocomplete="off" ng-model="command" autofocus>
|
<textarea id="sendMessage" class="form-control monospace" ng-trim="false" rows="1" autocomplete="off" ng-model="command" autofocus>
|
||||||
|
</textarea>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default btn-primary">Send</button>
|
<button class="btn btn-default btn-primary">Send</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -731,7 +731,11 @@ weechat.directive('inputBar', function() {
|
||||||
|
|
||||||
// Send the message to the websocket
|
// Send the message to the websocket
|
||||||
$scope.sendMessage = function() {
|
$scope.sendMessage = function() {
|
||||||
connection.sendMessage($scope.command);
|
// Split the command into multiple commands based on line breaks
|
||||||
|
var commands = $scope.command.split(/\r?\n/);
|
||||||
|
commands.forEach(function(c) {
|
||||||
|
connection.sendMessage(c);
|
||||||
|
});
|
||||||
$scope.command = "";
|
$scope.command = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +812,15 @@ weechat.directive('inputBar', function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enter to submit, shift-enter for newline
|
||||||
|
if (code == 13 && !$event.shiftKey) {
|
||||||
|
$event.preventDefault();
|
||||||
|
// Prevent inprog
|
||||||
|
setTimeout(function() {$('#inputform').submit();},0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue