+ACL.prototype.remove_mention = function(id) {
+ if (!that.automention) return;
+ var nick = that.data[id].nick;
+ var searchText = "@"+nick+"+"+id+" ";
+ if (tinyMCE.activeEditor===null) {
+ start = that.element.val().indexOf(searchText);
+ if ( start<0) return;
+ end = start+searchText.length;
+ that.element.setSelection(start,end).replaceSelectedText('').collapseSelection(false);
+ } else {
+ start = tinyMCE.activeEditor.getContent({format : 'raw'}).search( searchText );
+ if ( start<0 ) return;
+ txt = tinyMCE.activeEditor.getContent();
+ newtxt = txt.replace(searchText, '');
+ tinyMCE.activeEditor.setContent(newtxt);
+ }
+}
+
+ACL.prototype.add_mention = function(id) {
+ if (!that.automention) return;
+ var nick = that.data[id].nick;
+ var searchText = "@"+nick+"+"+id+" ";
+ if (tinyMCE.activeEditor===null) {
+ if ( that.element.val().indexOf( searchText) >= 0 ) return;
+ that.element.val( searchText + that.element.val() );
+ } else {
+ if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return;
+ tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'dummy', {}, searchText);
+ }
+}
+