public inbox for [email protected]
help / color / mirror / Atom feedFrom: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser
Date: Wed, 3 Jul 2019 18:08:40 +0530
Message-ID: <CAM9w-_=JTefrud=+P7Y-Ukik=Z+tQVSMu+7m1H3767Hp+K-B4g@mail.gmail.com> (raw)
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({
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][RM4429] Drag and Drop name in query tool is not working for Firefox browser
In-Reply-To: <CAM9w-_=JTefrud=+P7Y-Ukik=Z+tQVSMu+7m1H3767Hp+K-B4g@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox