mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-13 15:08:09 +00:00

* Extend copy to clipborad function to support customized mime types * Remove function default parameter syntax * Add plainText option * Use plainText name * Set "text/plain" data only when it exists * Docs update * Docs update
30 lines
1.4 KiB
Plaintext
30 lines
1.4 KiB
Plaintext
caption: tm-copy-to-clipboard
|
|
created: 20171215150056004
|
|
modified: 20250127134445040
|
|
tags: Messages
|
|
title: WidgetMessage: tm-copy-to-clipboard
|
|
type: text/vnd.tiddlywiki
|
|
|
|
The "copy to clipboard" message attempts to copy the specified text to the clipboard. If it succeeds, the tiddler [[$:/language/Notifications/CopiedToClipboard/Succeeded]] is displayed as a notification. If the browser doesn't permit the operation, the tiddler [[$:/language/Notifications/CopiedToClipboard/Failed]] is displayed instead.
|
|
|
|
It requires the following properties on the `event` object:
|
|
|
|
|!Name |!Description |
|
|
|param |Text to be copied to the clipboard |
|
|
|successNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation succeeds |
|
|
|failureNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation fails |
|
|
|type |<<.from-version "5.3.7">> MIME type of the text to be copied, defaults to `text/plain` |
|
|
|plainText |<<.from-version "5.3.7">> Additional plain text to be copied when `type` attribute isn't `text/plain` |
|
|
|
|
This message is usually generated with the ButtonWidget. It is handled by the TiddlyWiki core.
|
|
|
|
! Example
|
|
|
|
This example copies the current time to the clipboard:
|
|
|
|
<$macrocall $name='wikitext-example-without-html'
|
|
src='<$button message="tm-copy-to-clipboard" param=<<now>>>
|
|
Copy date to clipboard
|
|
</$button>'/>
|
|
|