mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +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
|
CloseOthers/Hint: Close other tiddlers
|
||||||
ControlPanel/Caption: control panel
|
ControlPanel/Caption: control panel
|
||||||
ControlPanel/Hint: Open control panel
|
ControlPanel/Hint: Open control panel
|
||||||
|
CopyToClipboard/Caption: copy to clipboard
|
||||||
|
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||||
Delete/Caption: delete
|
Delete/Caption: delete
|
||||||
Delete/Hint: Delete this tiddler
|
Delete/Hint: Delete this tiddler
|
||||||
Edit/Caption: edit
|
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)
|
\define .example(n,eg,egvar:NO-SUCH-VAR)
|
||||||
<div class="doc-example">
|
<div class="doc-example">
|
||||||
<$reveal default="$egvar$" type="match" text="NO-SUCH-VAR">
|
<$reveal default="$egvar$" type="match" text="NO-SUCH-VAR">
|
||||||
|
<$macrocall $name="copy-to-clipboard-above-right" src="""$eg$"""/>
|
||||||
<$codeblock code="""$eg$"""/>
|
<$codeblock code="""$eg$"""/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
<$reveal default="$egvar$" type="nomatch" text="NO-SUCH-VAR">
|
<$reveal default="$egvar$" type="nomatch" text="NO-SUCH-VAR">
|
||||||
<!-- allow an example to contain """ -->
|
<!-- allow an example to contain """ -->
|
||||||
|
<$macrocall $name="copy-to-clipboard-above-right" src=<<$egvar$>>/>
|
||||||
<$codeblock code=<<$egvar$>>/>
|
<$codeblock code=<<$egvar$>>/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
|
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
|
||||||
|
|
|
@ -6,6 +6,8 @@ tags: $:/tags/Macro
|
||||||
\define wikitext-example(src)
|
\define wikitext-example(src)
|
||||||
<div class="doc-example">
|
<div class="doc-example">
|
||||||
|
|
||||||
|
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||||
|
|
||||||
```
|
```
|
||||||
$src$
|
$src$
|
||||||
```
|
```
|
||||||
|
@ -25,6 +27,8 @@ $$$
|
||||||
\define wikitext-example-without-html(src)
|
\define wikitext-example-without-html(src)
|
||||||
<div class="doc-example">
|
<div class="doc-example">
|
||||||
|
|
||||||
|
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||||
|
|
||||||
```
|
```
|
||||||
$src$
|
$src$
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user