Topic: Pasting from clipboard after cleaning Pages that link to <a href="https://ozoneasylum.com/backlink?for=27684" title="Pages that link to Topic: Pasting from clipboard after cleaning" rel="nofollow" >Topic: Pasting from clipboard after cleaning\

 
Author Thread
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

IP logged posted posted 03-24-2006 06:46 Edit Quote

Hi all, for some reason i'm having trouble with this one....


I need to paste the clipboard the data to an area (which is already setup and working). I am happy to use execCommand etc as its for IE only (if there is a solution without execcommand, even better).

document.execcommand('paste') works fine and pastes what I copy,
however I want to parse the data before it is pasted, removing certain html formatting.

The problem is I cant find a way to get the clipboard data and do just that,

if i use clipboardData.getData("Text") it has no formatting at all (which is not what i want),

if i use clipboardData.getData("Url"), and try put in in a variable or something, it always returns null, even though
document.execcommand('paste', false, clipboardData.getData("Url")) works fine.

Anyone have some advice?
Thanks.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 03-24-2006 10:49 Edit Quote

none, apart from 'look at TinyMCE or FckEditor and see how they do it' - I know there's a paste plugin for Tiny that might provide some clue to you

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

IP logged posted posted 03-24-2006 20:25 Edit Quote

couldn't you have, oh, a hidden form element (as in <input type-"hidden" /> and paste the clipboard contents into that, then pull them out and edit them? Not elegant, sure, but it might work.


Justice 4 Pat Richard

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

IP logged posted posted 03-27-2006 02:43 Edit Quote

TP: Yeh, fck has a popup that you have to paste stuff into first to clean it, but Tiny looks likes its possible - will have to have a peak.


Skaarj: Yeh tried that... still doesnt work.


For some reason even if you do alert(clipboardData.getData("Url")) - it shows null, even though it works with the paste. If you do alert(clipboardData.getData("Test")) however - It pops up with the clipboard text.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 03-27-2006 06:48 Edit Quote

please remember that none of these ways work in firefox - at least easily. You have to edit a configuration file just to allow a single webpage to access your clipboard ;(

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

IP logged posted posted 03-27-2006 09:01 Edit Quote

hmm will keep that in mind - at the moment im writing exclusively for IE so it isnt an issue. The intention is to expand to firefox at a later stage.

I know its all to do with security etc, so what can you do eh... users won't be editing their configuration file, though it may be an option i guess.

I'm assuming ctrl-v still works - so if this is the case i can implement a popup box that handles it all instead.


p.s
Got it all working - not sure why it wasnt working before I did try this way, must have had some dodgey stuff in my code mess. Basically it was using a hidden div for the html. Then reading the html with innerHTML etc etc..

alucard
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jul 2012

IP logged posted posted 07-09-2012 21:05 Edit Quote

dear H][RO, it's been months that i am searching for a solution to paste an image from the clipboard to internet explorer ,you seems to know how to do ,please help me i'll be gratefull to until the end of my life é_è



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu