Tiddlywiki5: Make permalink/view also Add to clipboard

Created on 4 May 2018  路  15Comments  路  Source: Jermolene/TiddlyWiki5

AFAICT there are only two reasons to click permalink/view; to bookmark or to get a copy of the link to be pasted somewhere. The latter is probably much more frequently used than the former. However, to get a copy of the link you must also take the extra steps to get it into memory.

I propose that clicking permalink/view also copies the url to memory.

Most helpful comment

I've implemented this as a new setting that enables one to independently control whether the address bar is updated and/or the URL is copied to the clipboard.

I've made the copy-to-clipboard part be enabled by default, do you think that's reasonable?

screenshot 2018-08-16 20 04 16

All 15 comments

I propose that clicking permalink/view also copies the url to memory.

I would like to have a possibility, that permalink and permaview ONLY copy to the clipboard. ... I don't like it, that the URL is changed. .. It actually causes minimal problems for me.

I would like to have a possibility, that permalink and permaview ONLY copy to the clipboard. ... I don't like it, that the URL is changed. .. It actually causes minimal problems for me.

You do state "minimal" but maybe others will chime in if you describe them. Personally I'd also be OK if it was only copied to clipboard because it would be simple to paste into address field for those rare occasions.

@twMat @pmario

Hi, the part for the permalink button could look like this:

title: $:/core/ui/Buttons/permalink
tags: $:/tags/ViewToolbar
caption: {{$:/core/images/permalink-button}} {{$:/language/Buttons/Permalink/Caption}}
description: {{$:/language/Buttons/Permalink/Hint}}

\whitespace trim
\define uriEncodedPermaLink() $(url)$#$(encodedTitle)$
<$button message="tm-permalink" tooltip={{$:/language/Buttons/Permalink/Hint}} aria-label={{$:/language/Buttons/Permalink/Caption}} class=<<tv-config-toolbar-class>>>
<$vars url={{$:/info/url/full}} encodedTitle={{{ [<currentTiddler>encodeuricomponent[]] }}}>
<$action-sendmessage $message="tm-copy-to-clipboard" $param=<<uriEncodedPermaLink>>/>
</$vars>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/permalink-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text">
<$text text=" "/>
<$text text={{$:/language/Buttons/Permalink/Caption}}/>
</span>
</$list>
</$button>

... and a setting in controlpanel could disable the tm-permalink message

for the permaview I don't know how to put the url together by just using wikitext... I was almost there with a filter but it was too complicated

IMO It needs to be :

\define uriEncodedPermaLink() $(url)$#$(encodedTitle)$
\whitespace trim
...

IMO It needs to be :

\define uriEncodedPermaLink() $(url)$#$(encodedTitle)$
\whitespace trim
...

oh, well - thanks @pmario - I never understood well enough where to put pragmas

Good working! Is this even PR ready? :-D

I wouldn't support the code as it is. ... I want to have a configuration, where I can decide IF content is copied to the clipboard. ...

Copying content to the clipboard as a "side-effect" imo isn't proper behavior. So we need a new button or a new icon, that makes it clear, what's going on!

Could we simply add a new button that allows "copy permalink to clipboard button". The choice can be made in the ViewTemplate Toolbar or behind more...

I can provide an Icon once I learn how to export the svg images into InkScape.

I've implemented this as a new setting that enables one to independently control whether the address bar is updated and/or the URL is copied to the clipboard.

I've made the copy-to-clipboard part be enabled by default, do you think that's reasonable?

screenshot 2018-08-16 20 04 16

@Jermolene - EXCELLENT!

Thanks @twMat - you can try it out at https://tiddlywiki.com/prerelease

Thank you! I just tried it and like it! Great idea with the little "Copied!" popup.

There are some issues with it that are not limited to this ctrlpanel-setting but clearly seen in it... so while we're at it:

1) Unchecking both checkboxes makes the permalink button do nothing, but there is no feedback for this when clicking the permalink button. Maybe inactive buttons should be greyed out? Inactivating both checkboxes does mean that one doesn't want the feature so that could toggle a de-activate for the permalink button?
2) As I've noted before; Checkbox labels in blue text look odd, even if they're links. In this case the linkiness is even odder because they are in italics since they're missing... unless you click one, which makes it normal but the other still in italics. IMO, all Ctrlpanel setting-labels should just be a normal looking black text. If a link is needed, these could be in the form of a little "link symbol" after the label.

Thank you! I just tried it and like it! Great idea with the little "Copied!" popup.

IMO it should be "Copied to clipboard!" .. So users actually know, what's going on.

Hi @twMat @pmario

Unchecking both checkboxes makes the permalink button do nothing, but there is no feedback for this when clicking the permalink button. Maybe inactive buttons should be greyed out? Inactivating both checkboxes does mean that one doesn't want the feature so that could toggle a de-activate for the permalink button?

We could switch to a dropdown that offers "copy", "address", "copy+address" as its options. But I don't think the current behaviour is confusing really: if you turn everything off, then everything will be off, is pretty much all that's going on.

As I've noted before; Checkbox labels in blue text look odd, even if they're links. In this case the linkiness is even odder because they are in italics since they're missing... unless you click one, which makes it normal but the other still in italics. IMO, all Ctrlpanel setting-labels should just be a normal looking black text. If a link is needed, these could be in the form of a little "link symbol" after the label.

Agreed, but this needs to be fixed across all the settings as a separate PR.

IMO it should be "Copied to clipboard!" .. So users actually know, what's going on.

Good thinking, I've updated it in 7d0b255

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saqimtiaz picture saqimtiaz  路  5Comments

twMat picture twMat  路  5Comments

saqimtiaz picture saqimtiaz  路  5Comments

morosanuae picture morosanuae  路  6Comments

ifethereal picture ifethereal  路  5Comments