From 5e853407d13712424428cdfe099b21033fc09279 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Sat, 13 Apr 2024 19:28:52 +0200 Subject: [PATCH] Remove `#output-copy` element (#331) --- app/javascript/controllers/converter_controller.js | 2 +- app/views/converters/create.turbo_stream.erb | 1 - app/views/converters/index.html.erb | 9 ++++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/javascript/controllers/converter_controller.js b/app/javascript/controllers/converter_controller.js index 48619b5..9f014c1 100644 --- a/app/javascript/controllers/converter_controller.js +++ b/app/javascript/controllers/converter_controller.js @@ -26,7 +26,7 @@ export default class extends Controller { } async copy(event) { - await navigator.clipboard.writeText(document.getElementById("output-copy").value) + await navigator.clipboard.writeText(document.getElementById("output").innerText) const button = (event.target instanceof HTMLButtonElement) ? event.target : event.target.closest("button") diff --git a/app/views/converters/create.turbo_stream.erb b/app/views/converters/create.turbo_stream.erb index e864a71..7fbf7b9 100644 --- a/app/views/converters/create.turbo_stream.erb +++ b/app/views/converters/create.turbo_stream.erb @@ -2,6 +2,5 @@ <% lexer = Rouge::Lexers::Ruby.new %> <%= turbo_stream.update("output", formatter.format(lexer.lex(@converter.code))) %> -<%= turbo_stream.update("output-copy", @converter.code) %> <%= turbo_stream.remove_css_class("#output", "bg-gray-100 animate-pulse duration-75") %> diff --git a/app/views/converters/index.html.erb b/app/views/converters/index.html.erb index ba12829..5ad1db3 100644 --- a/app/views/converters/index.html.erb +++ b/app/views/converters/index.html.erb @@ -104,16 +104,15 @@

-                  
                 
- - - + + + +