mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-22 13:53:23 +08:00
* Update phoenix deps
* Update reference to LiveDashboard encode_pid
* Fix form input id references
* Move to HEEx
* Update back to filesystem LV npm package
* Further HEEx rewrites
* Refactor icons into function components
* .html.leex -> .html.heex
* Further refactoring
* Move render helpers into function components
* Add doctype back
* Further refactoring
* Refactor cell component
* Further refactoring
* Compose sidebar using function components
* Rewrite notebook card component as function component
* Fruther refactoring
* Fix race condition in runtime tests
* Rewrite tooltips into function component
* Update Tailwind purge rules
* Revert "Rewrite tooltips into function component"
This reverts commit bd6ca8f0b5
.
* Refactor conditional tooltip
30 lines
1.1 KiB
Elixir
30 lines
1.1 KiB
Elixir
defmodule LivebookWeb.Output.TextComponent do
|
|
use LivebookWeb, :live_component
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div id={"virtualized-text-#{@id}"}
|
|
class="relative"
|
|
phx-hook="VirtualizedLines"
|
|
data-max-height="300"
|
|
data-follow={to_string(@follow)}>
|
|
<%# Add a newline to each element, so that multiple lines can be copied properly %>
|
|
<div data-template class="hidden"
|
|
id={"virtualized-text-#{@id}-template"}
|
|
><%= for line <- ansi_to_html_lines(@content) do %><div><%= [line, "\n"] %></div><% end %></div>
|
|
<div data-content class="overflow-auto whitespace-pre font-editor text-gray-500 tiny-scrollbar"
|
|
id={"virtualized-text-#{@id}-content"}
|
|
phx-update="ignore"></div>
|
|
<div class="absolute right-0 top-0 z-10">
|
|
<button class="icon-button bg-gray-100"
|
|
id={"virtualized-text-#{@id}-clipcopy"}
|
|
phx-hook="ClipCopy"
|
|
data-target-id={"virtualized-text-#{@id}-template"}>
|
|
<.remix_icon icon="clipboard-line" class="text-lg" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
"""
|
|
end
|
|
end
|