mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
IJSDK-32 "Copy link to source to clipboard" button
This commit is contained in:
parent
702d7f3c2b
commit
b6d18f2bba
20
_plugins/copy_area.rb
Normal file
20
_plugins/copy_area.rb
Normal file
@ -0,0 +1,20 @@
|
||||
class CopyToClipboard < Liquid::Tag
|
||||
def initialize(tagName, markup, tokens)
|
||||
super
|
||||
|
||||
@text = markup
|
||||
end
|
||||
|
||||
def render(context)
|
||||
text = @text.strip.gsub(/^'|"/, '').gsub(/'|"$/, '')
|
||||
|
||||
<<-HTML
|
||||
<div class="copy-area">
|
||||
<input class="copy-area__field" value="#{text}">
|
||||
<button class="btn copy-area__button" data-clipboard-text="#{text}">Copy</button>
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag "copyArea", self
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user