Accessing clipboard in Perspective

I can't even get perspective to recognize "Ctrl + v" event.

Thanks, this explains why all online app, wants a keyboard "Ctrl+v".

I tried, but this is outside my power.
Will need a JS and Python developer.

Wasn't too hard, 0.5.2 is available here.

3 Likes

Why would you want to target a textArea?

Are you trying to store the image and a text together?

1 Like

Anyways i tried to push the files from the paste event to an ondrop event on the fileupload component but didnt have much luck yet.

I dont really know how the component works, and if it has something targetable for this to trigger its onfilerecieved event.

Edit, another way:
Def notperfect, but you should be able to do something with this. i wouldnt really use this, but i dont have time to look for something else atm.

pasteimg.zip (6.2 KB)


	code =  """<img style='display:none' src='/favicon.ico' onload=\"
	const view = [...window.__client.page.views._data.values()].find(view => view.value.mountPath == this.parentNode.parentNode.parentNode.getAttributeNode('data-component-path').value.split('.')[0]).value; 
	window.addEventListener('paste', e => {		
		console.log(e.clipboardData.files);
		const buffer = e.clipboardData.files[0].arrayBuffer();
		buffer.then((x) => {
			console.log(x);
	    	let byteArray = btoa(String.fromCharCode(...new Uint8Array(x)));	
	    	console.log( byteArray);   
			view.custom.write('bites',byteArray);
			});		
	});
	\"></img>""".replace("\n", "").replace("\t", "")
	return code
		
4 Likes

I am sorry.. But I am not following, I imported this, don't have idea how can I make this work?

Can someone explain further?

-edit: oh... it worked... still speechless.. Thanks.

I was doing a system.perspective.download but file came out empty.
I read the documentation, it is downloading from gateway.. made sense since bytearray still in client session
Aha! So..
I created an upload button.. to upload to database(varbinary max)..
then create a download(blobserver download) button..

1 Like