*/
_getDropdownMenuPosition: function() {
var $range = this._redactor.getSelection().getRangeAt(0);
- var $orgRange = $range.cloneRange();
+ var $startOffset = $range.startOffset;
- // insert span before the '@' to prevent node splitting (or at least node splitting in between the username and the @)
- $range.setStart($range.startContainer, $range.startOffset - (this._mentionStart.length + 1));
+ $range.setStart($range.startContainer, $range.startOffset - this._mentionStart.length);
$range.collapse(true);
var $element = document.createElement('span');
$jElement.remove();
+ // inserting the node caused the text node to be split, merge them again
+ // using stupid DOM manipulation since .normalize() is broken in Internet Explorer 11
+ $range.startContainer.nodeValue += $range.startContainer.nextSibling.textContent;
+ $range.startContainer.parentNode.removeChild($range.startContainer.nextSibling);
+
// move to end of node
- $range.setEnd($orgRange.startContainer, $orgRange.startOffset);
+ $range.setEnd($range.startContainer, $startOffset);
$range.collapse(false);
return $offsets;
this._redactor.bufferSet();
var $range = this._redactor.getSelection().getRangeAt(0);
- $range.setStart($range.startContainer, $range.startOffset - (this._mentionStart.length + 1));
+ $range.setStart($range.startContainer, $range.startOffset - this._mentionStart.length);
$range.deleteContents();
$range.collapse(true);
}
// use native API to prevent issues in Internet Explorer
- var $text = document.createTextNode('@' + username);
+ var $text = document.createTextNode(username);
$range.insertNode($text);
this._hideList();
* Updates the position of the suggestion list.
*/
_updateSuggestionListPosition: function() {
- try {
+ //try {
var $dropdownMenuPosition = this._getDropdownMenuPosition();
$dropdownMenuPosition.top += 5 + this._lineHeight; // add little vertical gap
+ $dropdownMenuPosition.left -= 16;
this._dropdownMenu.css($dropdownMenuPosition);
this._selectItem(0);
else {
this._dropdownMenu.removeClass('dropdownArrowBottom');
}
- }
+ /*}
catch (e) {
// ignore errors that are caused by pressing enter to
// often in a short period of time
- }
+ }*/
}
});
// detect smartphones
jQuery.browser.smartphone = ($('html').css('caption-side') == 'bottom');
- // CKEditor support (disabled for Android & Windows Phone)
- jQuery.browser.ckeditor = (navigator.userAgent.match(/(Android|Windows Phone)/i)) ? false : true;
+ // allow plugins to detect the used editor, value should be the same as the $.browser.<editorName> key
+ jQuery.browser.editor = 'redactor';
+
+ // CKEditor support (removed in WCF 2.1), do NOT remove this variable for the sake for compatibility
+ jQuery.browser.ckeditor = false;
+
+ // Redactor support
+ jQuery.browser.redactor = true;
// properly detect IE11
if (jQuery.browser.mozilla && ua.match(/trident/)) {