Guidebook

Guidebook

6M Downloads

Copy to Clipboard

gdarai opened this issue ยท 9 comments

commented

Is there a tag for copying some text into the clipboard?
If not, please add it.

commented

You mean like, when you click on a certain link, it copies to the clipboard?

commented

A way to go about implementing such a thing could be implementing some sort of action type system. What i mean is adding an "action"-attribute to link determining how what to do when the link is clicked. And then having some other attribute(s) as options for said action.

<link action="gbook:copy" data="text to copy to clipboard">copy some text to clipboard</link>
<link action="copy" target="element-id">copy text from element to clipboard</link>
<link action="gbook:command" data="spawnpoint">set spawnpoint to current position (requires op)</link>

The handler for said actions would probably just be given the link elements to read out the attributes by itself.

commented

Don't warry, this is just like work... it will always wait for you. :o)
Your idea seems ok. Yes, why not.

commented

Yes that is exactly what I am looking for.
The issue is that with such capability I would be able to give the player a way to get parts of the book and for example paste them into Open Computer command line... or into Minecraft Console.

commented

Hmmm, how about a <code> type tag, that automatically places a "copy" icon next to the text?

I'm thinking like...

Very quick&dirty mockup, just to get the idea:
image

I'm still recovering from having been sick lately, but I seem to be quite refreshed right now, so there's a lot I want to do, including easing myself back into modding...

commented

I also noticed, there is "Copy to Clipboard" inside the WEB link. But when you put there some other text, not the "link" but for example a wget command, the link stop working and the "Copy to Clipboard" is not available any more, so even to just make this work would be enough.

commented

That dialog is vanilla, I just make use of it.

commented

Went the easy route, in the end:
book clicking link
text copied message
(The book doesn't close, but since the message appears behind the book, I closed it myself to show)

The corresponding XML for that link is:
<link action="copyText" text="Text to copy to the clipboard">Click me 3</link>

I have a couple more things to look at, but I will be releasing this soon.

commented

v2.5.1 is out ans includes links that can copy to clipboard!