4 ms·
How would they implement things like copy-to-clipboard then?
by amelius 6y ago
How would they implement things like copy-to-clipboard then?
- dezmou 6y agoI don't know but Figma do it without issues, maybe there are some hidden inputs behind the canvas that are selected
- amelius 6y agoWouldn't that cause security issues which should be blocked by browsers? I.e. on some malicious website you could select some innocent looking text, but under the covers it selects some evil bash command.
- remram 6y agoThis is already possible with tiny or invisible text, I don't think browsers are trying to protect from that. The protections that exist are to prevent sites from reading your clipboard or replacing it without you clicking on anything, other than that the site already has control over what goes in it.
- city41 6y agoThey already have, the sample document has copy implemented.
- sime2009 6y agoWeb browsers have APIs for things like the clipboard these days.
- tmalsburg2 6y agoWhich makes you wonder why it doesn't work in Firefox (where it='copy & paste in Google docs').
- andrewingram 6y agoCurrent Google Docs already uses iframes to intercept keyboard/text events, the document you actually see isn't the thing you're interacting with, because contentEditable is nowhere near powerful enough for something like this. All their decision to use canvas is doing is changing the render target.