Show a tag if the clipboard contains a youtube link #146
-
Hi, I love this plugin. Thank you so much for your work! I tried to make a template, so when I copy some link to a youtube video it returns a youtube tag, like this This is the code: <%*
var tag = "#link";
const clipboard =tp.system.clipboard();
if (clipboard.contains("youtube") || clipboard.contains("youtu.be")) {
tag = "#youtube";
} %>
<%* tR += tag %> Thank you 😃 |
Beta Was this translation helpful? Give feedback.
Answered by
SilentVoid13
Apr 23, 2021
Replies: 1 comment 1 reply
-
Hey @e5pe, you're missing the <%*
var tag = "#link";
const clipboard = await tp.system.clipboard();
if (clipboard.contains("youtube") || clipboard.contains("youtu.be")) {
tag = "#youtube";
}
tR += tag;
%> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SilentVoid13
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @e5pe, you're missing the
await
keyword, becausetp.system.clipboard
is an asynchronous function.The correct template would be: