Anonymous avatar Anonymous committed b1bf554

fix selection of reviews. Put drag handle on window title instead of content. Maybe later adding a check of click delay will allow to put this beahvior back.

Comments (0)

Files changed (1)

static/js/src/review.js

         form.id = 'freview';
         
         var h3 = document.createElement('h3');
+        h3.classList.add('wtitle');
         h3.appendChild(document.createTextNode('Add your review to line ' + 
                     lineNumber +' '));
         var markdown = document.createElement('a');
         if (this.isDragging)
             return false;
 
-        if ((tag_name = e.target.tagName.toUpperCase()) && (
-            tag_name=='INPUT' ||
-            tag_name=='SELECT' ||
-            tag_name=='OPTION' ||
-            tag_name=='BUTTON' ||
-            tag_name=='TEXTAREA') || 
-            (e.target.className && 
-             e.target.className == "grippie")) return;
+        base2.DOM.bind(e.target);
+        if (!e.target.classList.has("wtitle"))
+            return;
        
-        base2.DOM.bind(e.target);
         var point = pointer(e);
         this.boxDimensions = this.divComment.getDimensions();
 
 
         this.isDragging = true;
 
+        this.old_cursor =  this.divComment.getStyle('cursor');
         this.divComment.style.cursor = "move";
         
         var pos = this.divComment.cumulativeOffset();
         document.body.focus();
                
         // prevent text selection for ie
-        if (base2.detect('MSIE'))
+        if (base2.detect('MSIE')) {
             this.old_onselectstart = document.onselectstart;
             document.onselectstart = function (e) {
                 return false;
             }
+        }
         
         e.preventDefault();
         e.stopPropagation(); 
 
     
     endDragCB: function(e) {
-        
+        if (!this.isDragging)
+           return; 
         this.isDragging = false;
         
-        if (this.old_onselectstart) {
+        if (base2.detect('MSIE')) {
             document.onselectstart = this.old_onselectstart;
-            this.old_onsselectstart = null;
         }
-        this.divComment.style.cursor = "default";
+        this.divComment.style.cursor = this.old_cursor;
         //this.divComment.querySelector('textarea').focus();
     },
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.