Class Clipboard
java.lang.Object
org.vaadin.firitin.util.clipboard.Clipboard
Deprecated, for removal: This API element is subject to removal in a future version.
Utility class for clipboard operations in a Vaadin application.
This class provides methods to copy text to the clipboard and read text from the clipboard
using the Clipboard API.
Note that this is helper is early experiment and may not work in all browsers, most especially in Safari, due to its incomplete handling of transient activation regarding clipboard. See test class for more details and workarounds.
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyToClipboard(String thisIsATestText) Deprecated, for removal: This API element is subject to removal in a future version.Copies the given text to the current user's clipboard using the Clipboard API.static CompletableFuture<String> Deprecated, for removal: This API element is subject to removal in a future version.Reads text from the clipboard using the Clipboard API.
-
Constructor Details
-
Clipboard
public Clipboard()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
copyToClipboard
Deprecated, for removal: This API element is subject to removal in a future version.Copies the given text to the current user's clipboard using the Clipboard API.- Parameters:
thisIsATestText- the text to be copied to the clipboard
-
readFromClipboard
Deprecated, for removal: This API element is subject to removal in a future version.Reads text from the clipboard using the Clipboard API. This method returns a CompletableFuture that resolves to the text read from the clipboard, once the required browser round-trip is done.- Returns:
- a CompletableFuture containing the text from the clipboard
-
com.vaadin.flow.component.clipboard.Clipboard, which handles the browser's user-gesture (transient activation) requirement correctly by arming the action on a click:Clipboard.onClick(component)returns a binding withwriteText(...)/readText(...).