|
|
@ -695,6 +695,10 @@ MessageComposer.prototype.checkAutocomplete = function (forceFull) { |
|
|
|
var valueCaret = getRichValueWithCaret(textarea); |
|
|
|
var valueCaret = getRichValueWithCaret(textarea); |
|
|
|
var value = valueCaret[0]; |
|
|
|
var value = valueCaret[0]; |
|
|
|
var pos = valueCaret[1] >= 0 ? valueCaret[1] : value.length; |
|
|
|
var pos = valueCaret[1] >= 0 ? valueCaret[1] : value.length; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!pos) { |
|
|
|
|
|
|
|
this.cleanRichTextarea(value, true); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var textarea = this.textareaEl[0]; |
|
|
|
var textarea = this.textareaEl[0]; |
|
|
|
var pos = getFieldSelection(textarea); |
|
|
|
var pos = getFieldSelection(textarea); |
|
|
@ -799,6 +803,7 @@ MessageComposer.prototype.onFocusBlur = function (e) { |
|
|
|
this.isActive = e.type == 'focus'; |
|
|
|
this.isActive = e.type == 'focus'; |
|
|
|
|
|
|
|
|
|
|
|
if (!this.isActive) { |
|
|
|
if (!this.isActive) { |
|
|
|
|
|
|
|
this.cleanRichTextarea(); |
|
|
|
this.hideSuggestions(); |
|
|
|
this.hideSuggestions(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setTimeout(this.checkAutocomplete.bind(this), 100); |
|
|
|
setTimeout(this.checkAutocomplete.bind(this), 100); |
|
|
@ -832,6 +837,24 @@ MessageComposer.prototype.onRichPaste = function (e) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageComposer.prototype.cleanRichTextarea = function (value, focused) { |
|
|
|
|
|
|
|
if (value === undefined) { |
|
|
|
|
|
|
|
value = getRichValue(this.richTextareaEl[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (value.match(/^\s*$/) && this.richTextareaEl.html().length > 0) { |
|
|
|
|
|
|
|
this.richTextareaEl.html(''); |
|
|
|
|
|
|
|
this.lastLength = 0; |
|
|
|
|
|
|
|
this.wasEmpty = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (focused) { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
|
|
|
|
setZeroTimeout(function () { |
|
|
|
|
|
|
|
self.focus(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MessageComposer.prototype.onRichPasteNode = function (e) { |
|
|
|
MessageComposer.prototype.onRichPasteNode = function (e) { |
|
|
|
var element = (e.originalEvent || e).target, |
|
|
|
var element = (e.originalEvent || e).target, |
|
|
|
src = (element || {}).src || '', |
|
|
|
src = (element || {}).src || '', |
|
|
|