Keep editor background on rerender (#869)

This commit is contained in:
Jonatan Kłosko 2022-01-15 23:08:45 +01:00 committed by GitHub
parent 59370a55ae
commit 35e42d1bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View file

@ -45,7 +45,7 @@ const Cell = {
editorContainer.appendChild(editorElement); editorContainer.appendChild(editorElement);
// Adjust the background color based on local settings // Adjust the background color based on local settings
const settings = loadLocalSettings(); const settings = loadLocalSettings();
editorContainer.parentElement.style.backgroundColor = editorContainer.style.backgroundColor =
THEME_BACKGROUND_COLOR[settings.editor_theme]; THEME_BACKGROUND_COLOR[settings.editor_theme];
// Setup the editor instance. // Setup the editor instance.
this.state.liveEditor = new LiveEditor( this.state.liveEditor = new LiveEditor(

View file

@ -212,13 +212,12 @@ defmodule LivebookWeb.SessionLive.CellComponent do
defp editor(assigns) do defp editor(assigns) do
~H""" ~H"""
<div class="py-3 rounded-lg bg-editor relative"> <div class="relative">
<div <div id={"editor-#{@cell_view.id}"} phx-update="ignore">
id={"editor-container-#{@cell_view.id}"} <div class="py-3 rounded-lg bg-editor" data-element="editor-container">
data-element="editor-container" <div class="px-8">
phx-update="ignore"> <.content_placeholder bg_class="bg-gray-500" empty={@cell_view.empty?} />
<div class="px-8"> </div>
<.content_placeholder bg_class="bg-gray-500" empty={@cell_view.empty?} />
</div> </div>
</div> </div>