Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2019-08

dataTransfer has a rare performance!??

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pedro Pablo Oviedo Vera

Hello people,...yes, me again....look:

..if in a function like :
function Arrastrar(aEvent:TJSDragEvent): Boolean;
begin
  aEvent.dataTransfer.setData('Text','<img src="'+
FOrg1.getAttribute('src')+'" >');
end;

with FOrg1.getAttribute('src') >> '/synapse/synapse_logo.gif'

...and later:

function Soltar(aEvent:TJSDragEvent):Boolean;
begin
   FDest.innerHTML:= aEvent.dataTransfer.getData('Text');
   aEvent.preventDefault;
end;
...
why FDest.InnerHTML just shows '/synapse/synapse_logo.gif' instead of  <img
src="/synapse/synapse_logo.gif" > ??

any idea?

Thanks
pp

MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190821/f2a2d9a4/attachment.html>

Reply by email

Michael Van Canneyt
to Pedro Pablo Oviedo Vera
Pedro Pablo Oviedo Vera wrote 24 lines
Hello people,...yes, me again....look: ..if in a function like : function Arrastrar(aEvent:TJSDragEvent): Boolean; begin aEvent.dataTransfer.setData('Text','<img src="'+ FOrg1.getAttribute('src')+'" >'); end; with FOrg1.getAttribute('src') >> '/synapse/synapse_logo.gif' ...and later: function Soltar(aEvent:TJSDragEvent):Boolean; begin FDest.innerHTML:= aEvent.dataTransfer.getData('Text'); aEvent.preventDefault; end; ... why FDest.InnerHTML just shows '/synapse/synapse_logo.gif' instead of <img src="/synapse/synapse_logo.gif" > ?? any idea?

Try logging aEvent.dataTransfer.getData('Text') in your Soltar event. I suspect that because you use Text, it transforms whatever is inside the data to plain text. If so, try using 'text/html' instead of Text.

Michael.

Reply by email

Pedro Pablo Oviedo Vera
to Michael Van Canneyt

it;s works....thanks!!!

Saludos
pp

El jue., 22 ago. 2019 a las 2:48, Michael Van Canneyt (<

Show quoted text 42 lines
) escribió: On Wed, 21 Aug 2019, Pedro Pablo Oviedo Vera wrote: > Hello people,...yes, me again....look: > > ..if in a function like : > function Arrastrar(aEvent:TJSDragEvent): Boolean; > begin > aEvent.dataTransfer.setData('Text','<img src="'+ > FOrg1.getAttribute('src')+'" >'); > end; > > > with FOrg1.getAttribute('src') >> '/synapse/synapse_logo.gif' > > ...and later: > > function Soltar(aEvent:TJSDragEvent):Boolean; > begin > FDest.innerHTML:= aEvent.dataTransfer.getData('Text'); > aEvent.preventDefault; > end; > ... > why FDest.InnerHTML just shows '/synapse/synapse_logo.gif' instead of <img > src="/synapse/synapse_logo.gif" > ?? > > any idea? Try logging aEvent.dataTransfer.getData('Text') in your Soltar event. I suspect that because you use Text, it transforms whatever is inside the data to plain text. If so, try using 'text/html' instead of Text. Michael. _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190823/5135dfd3/attachment.html>

Reply by email