Do not disable text selection in the issue list.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3543 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-03-04 19:06:33 +00:00
parent bd5fe10c13
commit e8bc0b2980
1 changed files with 9 additions and 7 deletions

View File

@ -8,13 +8,6 @@ ContextMenu.prototype = {
initialize: function (url) { initialize: function (url) {
this.url = url; this.url = url;
this.createMenu(); this.createMenu();
// prevent text selection in the issue list
var tables = $$('table.issues');
for (i=0; i<tables.length; i++) {
tables[i].onselectstart = function () { return false; } // ie
tables[i].onmousedown = function () { return false; } // mozilla
}
if (!observingContextMenuClick) { if (!observingContextMenuClick) {
Event.observe(document, 'click', this.Click.bindAsEventListener(this)); Event.observe(document, 'click', this.Click.bindAsEventListener(this));
@ -167,6 +160,7 @@ ContextMenu.prototype = {
addSelection: function(tr) { addSelection: function(tr) {
tr.addClassName('context-menu-selection'); tr.addClassName('context-menu-selection');
this.checkSelectionBox(tr, true); this.checkSelectionBox(tr, true);
this.clearDocumentSelection();
}, },
toggleSelection: function(tr) { toggleSelection: function(tr) {
@ -196,6 +190,14 @@ ContextMenu.prototype = {
isSelected: function(tr) { isSelected: function(tr) {
return Element.hasClassName(tr, 'context-menu-selection'); return Element.hasClassName(tr, 'context-menu-selection');
},
clearDocumentSelection: function() {
if (document.selection) {
document.selection.clear(); // IE
} else {
window.getSelection().removeAllRanges();
}
} }
} }