Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend copy to clipborad function to support customized mime types #8912

Merged
merged 7 commits into from
Jan 27, 2025

Conversation

Leilei332
Copy link
Contributor

@Leilei332 Leilei332 commented Jan 26, 2025

Related to #7208 and #8613. An attempt to extend tw's copy to clipboard function to support setting the mime type of the copied text. Macros and widget messages are also updated.

Copy link

Confirmed: Leilei332 has already signed the Contributor License Agreement (see contributing.md)

Copy link

netlify bot commented Jan 26, 2025

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit 79dc78f
🔍 Latest deploy log https://app.netlify.com/sites/tiddlywiki-previews/deploys/67978fad63608a0008daf9bb
😎 Deploy Preview https://deploy-preview-8912--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Leilei332 Leilei332 marked this pull request as draft January 26, 2025 14:46
@pmario
Copy link
Member

pmario commented Jan 26, 2025

Can you be more specific, how this should be used. I am not sure if it works as expected. See: https://alexharri.com/blog/clipboard

@Leilei332
Copy link
Contributor Author

Using the function in javascript, which copys html with text/html mime type:

$tw.utils.copyToClipboard("<em>Test</em>", {}, "text/html");

Using the macro:

<<copy-to-clipboard src:"<em>Test</em>" type:"text/html">>

@Leilei332
Copy link
Contributor Author

Leilei332 commented Jan 27, 2025

Try this one in the preview. Click the copy to clipboard button and press ctrl+v, the tiddlers should be displayed in the importer:

<$transclude $variable="copy-to-clipboard" src=<<jsontiddlers filter:"[tag[Concepts]]">> type="text/vnd.tiddler"/>

The dropzone widget turned out to be able to parse the data saved in text/vnd.tiddler in the clipboard.

@Jermolene
Copy link
Member

Great thanks @Leilei332, looks good, and very useful. We will need a documentation update as well.

@Leilei332 Leilei332 marked this pull request as ready for review January 27, 2025 13:53
@Jermolene
Copy link
Member

Great, thanks @Leilei332

@Jermolene Jermolene merged commit 67e8670 into TiddlyWiki:master Jan 27, 2025
7 checks passed
@pmario
Copy link
Member

pmario commented Jan 27, 2025

@Leilei332 -- Which browsers did you test this with? -- I did test it with Edge Windows and it seems it only handles the text/plain buffer.

@Leilei332
Copy link
Contributor Author

@Leilei332 -- Which browsers did you test this with? -- I did test it with Edge Windows and it seems it only handles the text/plain buffer.

That's strange. I tested it on firefox 128, chrome 132 and edge 132 on Windows 10, they all worked well.

@pmario
Copy link
Member

pmario commented Jan 28, 2025

Did you test with https://tiddlywiki.com/prerelease or from localhost? ... I did test with localhost ... May be there is a difference. More testing will be needed.

@Leilei332 Leilei332 mentioned this pull request Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants