Make image uploadable by paste from clipboard
This commit is contained in:
parent
005f9f6f5c
commit
3d39a3c138
2 changed files with 19 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
<form class="form form-horizontal" id="inputform" ng-submit="sendMessage()" imgur-drop>
|
<form class="form form-horizontal" id="inputform" ng-submit="sendMessage()" imgur-drop>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<textarea id="{{inputId}}" class="form-control favorite-font" ng-trim="false" rows="1" ng-change="inputChanged()" autocomplete="on" ng-model="command" ng-focus="hideSidebar()">
|
<textarea id="{{inputId}}" class="form-control favorite-font" ng-trim="false" rows="1" ng-change="inputChanged()" autocomplete="on" ng-model="command" ng-focus="hideSidebar()" ng-paste="inputPasted($event)">
|
||||||
</textarea>
|
</textarea>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-complete-nick unselectable mobile" title="Complete nick" ng-click="handleCompleteNickButton($event)"><i class="glyphicon glyphicon-bullhorn"></i></button>
|
<button class="btn btn-complete-nick unselectable mobile" title="Complete nick" ng-click="handleCompleteNickButton($event)"><i class="glyphicon glyphicon-bullhorn"></i></button>
|
||||||
|
|
|
@ -592,6 +592,24 @@ weechat.directive('inputBar', function() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
$scope.inputPasted = function(e) {
|
||||||
|
if (e.clipboardData && e.clipboardData.files && e.clipboardData.files.length) {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var sendImageUrl = function(imageUrl) {
|
||||||
|
if(imageUrl !== undefined && imageUrl !== '') {
|
||||||
|
$rootScope.insertAtCaret(String(imageUrl));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var i = 0; i < e.clipboardData.files.length; i++) {
|
||||||
|
imgur.process(e.clipboardData.files[i], sendImageUrl);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue