Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: block.js

Issue 6097665288830976: Issue 2194 - Don't drag "Block Element" dialog when clicking into the text field (Closed)
Patch Set: Created March 20, 2015, 5:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: block.js
===================================================================
--- a/block.js
+++ b/block.js
@@ -101,8 +101,18 @@
function onDragStart(event)
{
- dragStartX = event.screenX;
- dragStartY = event.screenY;
+ var element = document.elementFromPoint(event.clientX, event.clientY);
+ if (element && element.localName == "textarea")
+ {
+ // Don't drag the dialog when the user has clicked into the textarea.
+ // Most likely the user just wants to focus it or select text there.
+ event.preventDefault();
+ }
+ else
+ {
+ dragStartX = event.screenX;
+ dragStartY = event.screenY;
+ }
}
function onDragEnd(event)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld