From 0f1626042975b623b375029a754ab8e202b0f993 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Thu, 16 May 2024 11:48:36 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Message=20"=F0=9F=91=80=20Reading=20hidden?= =?UTF-8?q?=20code"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components/Cell.js | 5 ++--- frontend/editor.css | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/frontend/components/Cell.js b/frontend/components/Cell.js index 5bbc88a57b..615b4b8fe3 100644 --- a/frontend/components/Cell.js +++ b/frontend/components/Cell.js @@ -205,12 +205,11 @@ export const Cell = ({ const activate_animation = useDebouncedTruth(running || queued || waiting_to_run) const class_code_differs = code !== (cell_input_local?.code ?? code) - const class_code_folded = code_folded && cm_forced_focus == null const no_output_yet = (output?.last_run_timestamp ?? 0) === 0 const code_not_trusted_yet = process_waiting_for_permission && no_output_yet // during the initial page load, force_hide_input === true, so that cell outputs render fast, and codemirrors are loaded after - let show_input = !force_hide_input && (code_not_trusted_yet || errored || class_code_differs || !class_code_folded) + let show_input = !force_hide_input && (code_not_trusted_yet || errored || class_code_differs || cm_forced_focus != null || !code_folded) const [line_heights, set_line_heights] = useState([15]) const node_ref = useRef(null) @@ -292,7 +291,7 @@ export const Cell = ({ errored, selected, code_differs: class_code_differs, - code_folded: class_code_folded, + code_folded, skip_as_script, running_disabled, depends_on_disabled_cells, diff --git a/frontend/editor.css b/frontend/editor.css index 8722ea9cd9..53a1b3fc43 100644 --- a/frontend/editor.css +++ b/frontend/editor.css @@ -1867,6 +1867,30 @@ pluto-input > .input_context_menu span.icon::after { filter: var(--image-filters); } +pluto-input > .preview_hidden_code_info { + display: none; + position: absolute; + bottom: -1rem; + left: 0; + right: 0; + margin-right: auto; + margin-left: auto; + height: 1.5rem; + width: 19ch; + font-style: italic; + text-align: center; + background: var(--jl-info-color); + border-radius: 0.4rem; + padding: 0.1rem 0.2rem; + font-family: var(--system-ui-font-stack); + z-index: 22; + pointer-events: none; +} + +pluto-cell.code_folded pluto-input > .preview_hidden_code_info { + display: block; +} + /* PKG UI */ pkg-status-mark { From 92d3a8f5a9bc4a6b63186dc0141c77e93a28fc09 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Thu, 16 May 2024 11:59:10 +0200 Subject: [PATCH 2/2] yeaaa --- frontend/components/CellInput.js | 3 +++ frontend/editor.css | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/components/CellInput.js b/frontend/components/CellInput.js index f79138c2ae..591c306108 100644 --- a/frontend/components/CellInput.js +++ b/frontend/components/CellInput.js @@ -970,10 +970,13 @@ export const CellInput = ({ set_show_logs=${set_show_logs} set_cell_disabled=${set_cell_disabled} /> + ${PreviewHiddenCode} ` } +const PreviewHiddenCode = html`
👀 Reading hidden code
` + const InputContextMenu = ({ on_delete, cell_id, run_cell, skip_as_script, running_disabled, any_logs, show_logs, set_show_logs, set_cell_disabled }) => { const timeout = useRef(null) let pluto_actions = useContext(PlutoActionsContext) diff --git a/frontend/editor.css b/frontend/editor.css index 53a1b3fc43..f6da96ed1e 100644 --- a/frontend/editor.css +++ b/frontend/editor.css @@ -1870,24 +1870,24 @@ pluto-input > .input_context_menu span.icon::after { pluto-input > .preview_hidden_code_info { display: none; position: absolute; - bottom: -1rem; + bottom: -1.1rem; left: 0; right: 0; margin-right: auto; margin-left: auto; - height: 1.5rem; + height: 1.4rem; width: 19ch; font-style: italic; text-align: center; background: var(--jl-info-color); border-radius: 0.4rem; - padding: 0.1rem 0.2rem; font-family: var(--system-ui-font-stack); + font-size: 0.9rem; z-index: 22; pointer-events: none; } -pluto-cell.code_folded pluto-input > .preview_hidden_code_info { +body:not(.process_waiting_for_permission) pluto-cell.code_folded pluto-input > .preview_hidden_code_info { display: block; }