public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser
@ 2019-07-03 12:38 Aditya Toshniwal <[email protected]>
  2019-07-04 13:49 ` Re: [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Aditya Toshniwal @ 2019-07-03 12:38 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Attached is the patch to fix drag and drop issue on firefox. Had to make
few code changes required by firefox explicitly :/

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM4429.patch (1.6K, 3-RM4429.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 7e8ba320..f0388f7e 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -161,6 +161,10 @@ export class Tree {
           }
 
           origEvent.dataTransfer.setData('text', JSON.stringify(dropDetails));
+          /* Required by Firefox */
+          if(origEvent.dataTransfer.dropEffect) {
+            origEvent.dataTransfer.dropEffect = 'move';
+          }
 
           /* setDragImage is not supported in IE. We leave it to
            * its default look and feel
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 8bf041f6..d23a5727 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -347,13 +347,19 @@ define('tools.querytool', [
       if(self.handler.is_query_tool) {
         self.query_tool_obj.setOption('dragDrop', true);
         self.query_tool_obj.on('drop', (editor, e) => {
+          /* Stop firefox from redirecting */
+          if(e.preventDefault) {
+            e.preventDefault();
+          }
+          if (e.stopPropagation) {
+            e.stopPropagation();
+          }
           var cursor = editor.coordsChar({
             left: e.x,
             top: e.y,
           });
           var dropDetails = JSON.parse(e.dataTransfer.getData('text'));
           e.codemirrorIgnore = true;
-          e.dataTransfer.clearData('text');
           editor.replaceRange(dropDetails.text, cursor);
           editor.focus();
           editor.setSelection({


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser
  2019-07-03 12:38 [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser Aditya Toshniwal <[email protected]>
@ 2019-07-04 13:49 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2019-07-04 13:49 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Wed, Jul 3, 2019 at 1:39 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Hackers,
>
> Attached is the patch to fix drag and drop issue on firefox. Had to make
> few code changes required by firefox explicitly :/
>
> Kindly review.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-07-04 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 12:38 [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser Aditya Toshniwal <[email protected]>
2019-07-04 13:49 ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox