Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard: Implement permissions for pasting in Chrome-based browsers #8023

Closed
vmiklos opened this issue Jan 15, 2024 · 7 comments
Closed

Clipboard: Implement permissions for pasting in Chrome-based browsers #8023

vmiklos opened this issue Jan 15, 2024 · 7 comments
Assignees
Labels
23.05 enhancement New feature or request

Comments

@vmiklos
Copy link
Contributor

vmiklos commented Jan 15, 2024

Is your feature request related to a problem?

Pressing ctrl-v pastes from the clipboard, but pressing the paste button, we just show a popup to press ctrl-v.

Describe the solution you'd like

Chrome has some new clipboard API that allows asking for the clipboard permission, we should conditionally start using that. See https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read.

@vmiklos vmiklos added enhancement New feature or request unconfirmed labels Jan 15, 2024
@vmiklos vmiklos self-assigned this Jan 15, 2024
@venky-17
Copy link

hey can u pls assign me this issue??

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 18, 2024

hey can u pls assign me this issue??

This issue is already assigned, please pick an other issue which is not yet assigned. Thanks.

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 18, 2024

The above PR is meant to survive the clipboard sanitize process as implemented e.g. here:

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/clipboard/clipboard_reader.cc;bpv=1;bpt=1

I.e. the old clipboard marker looked like this:

<!DOCTYPE html>
<html>
<head>
	<meta name="origin" content="..."/>
...
<body>
...
</body>
</html>

The new markup is like this:

<html>
<body>
<div id="meta-origin" data-coolorigin="...">
...
</div>
</body>
</html> 

It's not necessary to remove the old marker right now, this allows leaving the Android case alone for now.

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 22, 2024

#8061 switches to the improved new markup, described above, #8068 fixes up that switch.

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 23, 2024

Next step is to actually use the new API in Chrome. To test the new functionality, have an --enable-experimantal build, and then the baseline gives you an annoying popup when you click the paste button on the toolbar, while the new code asks for this permission once, and otherwise it more or less "just works".

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 25, 2024

#8091 removes the old markup.

@vmiklos
Copy link
Contributor Author

vmiklos commented Jan 29, 2024

#8106 adds tests, let's close this.

@vmiklos vmiklos closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
23.05 enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

3 participants