From 12162f53b443a3f794416002e1d9af0d57690b39 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 9 Aug 2016 18:13:54 -0700 Subject: You can drag links to the editor (which will be parsed and inserted); as well as files (which will be uploaded) --- view/tpl/jot-header.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/tpl/jot-header.tpl') diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index c0d524764..85ce9dad8 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -268,7 +268,6 @@ function enableOnUser(){ function linkdrop(event) { var reply = event.dataTransfer.getData("text/uri-list"); - event.target.textContent = reply; event.preventDefault(); if(reply && reply.length) { reply = bin2hex(reply); @@ -489,6 +488,7 @@ function enableOnUser(){ // cancel event and hover styling DragDropUploadFileHover(e); + // fetch FileList object var files = e.target.files || e.originalEvent.dataTransfer.files; // process all File objects -- cgit v1.2.3 From de12503fadbead1722824311d0887ad65b0cb925 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 9 Aug 2016 22:52:14 -0700 Subject: allow dropping links on comments as well as posts --- view/tpl/jot-header.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'view/tpl/jot-header.tpl') diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 85ce9dad8..9b00b25d3 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -269,13 +269,15 @@ function enableOnUser(){ function linkdrop(event) { var reply = event.dataTransfer.getData("text/uri-list"); event.preventDefault(); + var editwin = '#' + event.target.id; if(reply && reply.length) { reply = bin2hex(reply); $('#profile-rotator').spin('tiny'); $.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) { if (!editor) $("#profile-jot-text").val(""); initEditor(function(){ - addeditortext(data); + $(editwin).val( $(editwin).val() + data ); + // addeditortext(data); $('#profile-rotator').spin(false); }); }); -- cgit v1.2.3 From 7a557d31e026705fc3bd2d4f39c4c679449cef56 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 10 Aug 2016 01:35:58 -0700 Subject: open editor or comment window when linkdropping to a closed window. We probably also need this for filedropping. --- view/tpl/jot-header.tpl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'view/tpl/jot-header.tpl') diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 9b00b25d3..9de049b58 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -270,16 +270,30 @@ function enableOnUser(){ var reply = event.dataTransfer.getData("text/uri-list"); event.preventDefault(); var editwin = '#' + event.target.id; + var commentwin = false; + if(editwin) { + commentwin = ((editwin.indexOf('comment') >= 0) ? true : false); + if(commentwin) { + var commentid = editwin.substring(editwin.lastIndexOf('-') + 1); + commentOpen(document.getElementById(event.target.id),commentid); + } + } + if(reply && reply.length) { reply = bin2hex(reply); $('#profile-rotator').spin('tiny'); $.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) { - if (!editor) $("#profile-jot-text").val(""); - initEditor(function(){ + if(commentwin) { $(editwin).val( $(editwin).val() + data ); - // addeditortext(data); $('#profile-rotator').spin(false); - }); + } + else { + if (!editor) $("#profile-jot-text").val(""); + initEditor(function(){ + addeditortext(data); + $('#profile-rotator').spin(false); + }); + } }); } } -- cgit v1.2.3