diff --git a/app/assets/stylesheets/media.scss b/app/assets/stylesheets/media.scss index b27201d77..044e8accc 100644 --- a/app/assets/stylesheets/media.scss +++ b/app/assets/stylesheets/media.scss @@ -118,7 +118,7 @@ input[type="text"], textarea { margin-bottom: 1rem; padding: .375rem .75rem; - width: 100%; + width: calc(100% - 2rem); } fieldset { @@ -154,6 +154,7 @@ text-decoration: underline; cursor: pointer; } + } } diff --git a/app/components/embed/media/embed_this_form_component.html.erb b/app/components/embed/media/embed_this_form_component.html.erb index 74d308024..dbc344a80 100644 --- a/app/components/embed/media/embed_this_form_component.html.erb +++ b/app/components/embed/media/embed_this_form_component.html.erb @@ -1,9 +1,23 @@
- - +
+ + + +
- - +
+ + + +
Select options: diff --git a/app/javascript/src/controllers/clipboard_controller.js b/app/javascript/src/controllers/clipboard_controller.js new file mode 100644 index 000000000..bf5381c1d --- /dev/null +++ b/app/javascript/src/controllers/clipboard_controller.js @@ -0,0 +1,9 @@ +import { Controller } from '@hotwired/stimulus' + +export default class extends Controller { + static targets = ['value'] + + copy () { + navigator.clipboard.writeText(this.valueTarget.value) + } +} diff --git a/spec/components/embed/media/embed_this_form_component_spec.rb b/spec/components/embed/media/embed_this_form_component_spec.rb index dfb5fc21f..62617e87b 100644 --- a/spec/components/embed/media/embed_this_form_component_spec.rb +++ b/spec/components/embed/media/embed_this_form_component_spec.rb @@ -21,5 +21,6 @@ expect(page).to have_css('input#sul-embed-embed-title[type="checkbox"]') expect(page).to have_css('input#sul-embed-embed[type="checkbox"]') expect(page).to have_css('textarea#sul-embed-iframe-code') + expect(page).to have_css('button.copy-to-clipboard') end end