//回车发消息
$scope.keyDownSend = function ($event) {
var keycode = window.event?$event.keyCode:$event.which;
var evt = $event || window.event;
var inputTxt = document.getElementById("contentText");
// 回车-->发送消息
if(keycode==13 && !(evt.ctrlKey)){
sendMessage();
$event.preventDefault();
return false;
}
// ctrl+回车-->换行
if (evt.ctrlKey && evt.keyCode == 13) {
var #contenText = $('#contenText');
#contenText_opt.html(#contenText_opt.html() + '<br>');
placeCaretAtEnd(#contenText.get(0));
return false;
} function placeCaretAtEnd(el) {
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
else if (typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}
//发消息
$scope.send_test = function($event) {
var contet = $('#contenText').html().replace(/ /g, ' ').replace(/&/g, '&');
if($($event.target).hasClass('on')){
sendErrorTipsMsg(contet);
sendMessageTxt();
} else if (!contet){
sendErrorTipsMsg(ErrorContent);
}
//发送消息后清除类
$($event.target).removeClass('current');
};