mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-15 07:13:22 +00:00
Add copy-to-clipboard macro
And use it in the tw5.com example documentation
This commit is contained in:
parent
6c7f8e5381
commit
1b6a06a4d7
@ -14,6 +14,8 @@ CloseOthers/Caption: close others
|
||||
CloseOthers/Hint: Close other tiddlers
|
||||
ControlPanel/Caption: control panel
|
||||
ControlPanel/Hint: Open control panel
|
||||
CopyToClipboard/Caption: copy to clipboard
|
||||
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||
Delete/Caption: delete
|
||||
Delete/Hint: Delete this tiddler
|
||||
Edit/Caption: edit
|
||||
|
17
core/wiki/macros/copy-to-clipboard.tid
Normal file
17
core/wiki/macros/copy-to-clipboard.tid
Normal file
@ -0,0 +1,17 @@
|
||||
title: $:/core/macros/copy-to-clipboard
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define copy-to-clipboard(src,class:"tc-btn-invisible",style)
|
||||
<$button class=<<__class__>> style=<<__style__>> message="tm-copy-to-clipboard" param=<<__src__>> tooltip={{$:/language/Buttons/CopyToClipboard/Hint}}>
|
||||
{{$:/core/images/copy-clipboard}} <$text text={{$:/language/Buttons/CopyToClipboard/Caption}}/>
|
||||
</$button>
|
||||
\end
|
||||
|
||||
\define copy-to-clipboard-above-right(src,class:"tc-btn-invisible",style)
|
||||
<div style="position: relative;">
|
||||
<div style="position: absolute; bottom: 0; right: 0;">
|
||||
<$macrocall $name="copy-to-clipboard" src=<<__src__>> class=<<__class__>> style=<<__style__>>/>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
19
editions/tw5.com/tiddlers/macros/copy-to-clipboard Macro.tid
Normal file
19
editions/tw5.com/tiddlers/macros/copy-to-clipboard Macro.tid
Normal file
@ -0,0 +1,19 @@
|
||||
caption: colour
|
||||
created: 20171216104754967
|
||||
modified: 20171216104941967
|
||||
tags: Macros [[Core Macros]]
|
||||
title: copy-to-clipboard Macro
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The <<.def copy-to-clipboard>> [[macro|Macros]] displays a button that copies specified text to the clipboard. A notification is displayed if the operation is successful; some browsers do not permit the operation.
|
||||
|
||||
!! Parameters
|
||||
|
||||
;src
|
||||
: The text to be copied to the clipboard
|
||||
;class
|
||||
: Optional CSS classes to be assigned to the button (defaults to `tc-btn-invisible`)
|
||||
;style
|
||||
: Optional CSS styles to be assigned to the button
|
||||
|
||||
<<.macro-examples "copy-to-clipboard">>
|
@ -0,0 +1,8 @@
|
||||
created: 20171216104946277
|
||||
modified: 20171216105109641
|
||||
tags: [[copy-to-clipboard Macro]] [[Macro Examples]]
|
||||
title: copy-to-clipboard Macro (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$macrocall $name=".example" n="1" eg="""<<copy-to-clipboard "Mary had a little lamb">>"""/>
|
||||
<$macrocall $name=".example" n="2" eg="""<$macrocall $name="copy-to-clipboard" src={{$:/SiteTitle}}/>"""/>
|
@ -80,10 +80,12 @@ This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
|
||||
\define .example(n,eg,egvar:NO-SUCH-VAR)
|
||||
<div class="doc-example">
|
||||
<$reveal default="$egvar$" type="match" text="NO-SUCH-VAR">
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src="""$eg$"""/>
|
||||
<$codeblock code="""$eg$"""/>
|
||||
</$reveal>
|
||||
<$reveal default="$egvar$" type="nomatch" text="NO-SUCH-VAR">
|
||||
<!-- allow an example to contain """ -->
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<$egvar$>>/>
|
||||
<$codeblock code=<<$egvar$>>/>
|
||||
</$reveal>
|
||||
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
|
||||
|
@ -6,6 +6,8 @@ tags: $:/tags/Macro
|
||||
\define wikitext-example(src)
|
||||
<div class="doc-example">
|
||||
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||
|
||||
```
|
||||
$src$
|
||||
```
|
||||
@ -25,6 +27,8 @@ $$$
|
||||
\define wikitext-example-without-html(src)
|
||||
<div class="doc-example">
|
||||
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||
|
||||
```
|
||||
$src$
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user