Skip to content

Commit

Permalink
Remove #output-copy element (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth authored Apr 13, 2024
1 parent d2fceb2 commit 5e85340
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/javascript/controllers/converter_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 0 additions & 1 deletion app/views/converters/create.turbo_stream.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>
9 changes: 4 additions & 5 deletions app/views/converters/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,15 @@
<div class="-m-0.5 rounded-lg p-0.5" role="tabpanel" tabindex="0">
<div class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
<pre class="phlex-output p-3 mb-3 rounded overflow-auto font-mono bg-[#282c34] text-[#dcdfe4] highlight h-[70vh] overflow-scroll" id="output"></pre>
<textarea id="output-copy" class="phlex-output hidden"></textarea
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</form>
</section>
</div>
</main>
</form>
</section>

<style type="text/css">
<%= Rouge::Themes::Monokai.render(scope: 'pre') %>
Expand Down

0 comments on commit 5e85340

Please sign in to comment.