More agile code block edit flow (#1390)#1537
Merged
Merged
Conversation
Double-clicking a code block or pressing Edit Code while another editor is open now auto-closes the clean editor and opens the new block. While an editor has unsaved changes (or an error), the Edit Code button is disabled on all code blocks until it is committed or discarded. Tracks the active editor in a new monaco-session store so any code block can react to its dirty state without reaching into the modal instance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Make the code block editable in place instead of only via the modal. Decompose Monaco.svelte into reusable CodeEditor/CommitStatus/ CharacterCount components and reuse them for an in-action-block editor with Commit/Discard, auto-sizing (5-20 lines), syntax validation, and grid sync. - Open Editor carries uncommitted inline edits into the modal; discard from the modal reverts the inline editor; commit from either updates the other. - The block being edited in the modal is locked inline with a dimmed overlay. - Syntax errors are dispatched to DynamicWrapper so the block is flagged invalid (red border) like other blocks, and cleared on teardown so the flag doesn't outlive the editor. - Move the "Powered by Lua" footer into the modal. - Replace svelte/animate flip with a translate-only reflow so blocks whose height changes (e.g. showing a syntax error) aren't squished. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Visit the preview URL for this PR (updated for commit 5871fca): https://grid-editor-web--pr1537-feature-1390-agile-c-shodvob6.web.app (expires Wed, 29 Jul 2026 09:58:14 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2b65ba6ef19c55d367eaffd04e46bcde25305d6f |
Catch Ctrl/Cmd+S in each code-editor context and trigger its commit/save button, which no-ops on its own when disabled. The handler is scoped to the editor's container (preventDefault + stopPropagation) so the shortcut doesn't leak to other handlers or the browser default. - CodeBlock.svelte: inline editor -> Commit - Monaco.svelte: editor modal -> Commit - FileManager.svelte: file editor -> Save Buttons are triggered via a click on their rendered <button> for now; once intechstudio/grid-uikit#50 lands (MoltenPushButton.trigger()) these can drop the wrapper + querySelector. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update Playwright tests for the new code-block flow (the "Edit Code" button was replaced by inline editing + an "Open Editor" modal): - locators/page object open the modal via "Open Editor", scope the editor input and Commit/Close to #monaco-container, and read the inline editor (.view-line) instead of the removed <pre> preview - code-jump-back filters on the code text, not the old "Code preview:" Harden cross-test bleed on the shared page: - LogStream.store: expose reset() to force the log stream/logger empty - App.svelte: expose window.__gridTest.resetLogStream() in the web build - CursorLog: make the toast container pointer-events-none (messages stay interactive) so it no longer overlays clicks for ~5s after operations - configPage.resetTransientUi() clears toasts and closes a leftover-open action menu (blur first, since its search input swallows Escape) - target a single "Modifications can not" toast to avoid strict-mode hits Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Visit the preview URL for this PR (updated for commit 5871fca): https://grid-playwright-result--pr1537-feature-1390-agile-c-cwayx15g.web.app (expires Thu, 02 Jul 2026 10:06:29 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 0f764ceb264072188bf1a5dee10613d8f10b4ca2 |
Contributor
selectAllActions clicked into the config area, which now lands focus in a code block's inline Monaco editor — so Ctrl+A selected editor text and the select-all-actions shortcut silently bailed (the handler ignores events originating in .monaco-editor). That made "code jump back" delete the wrong block. Focus the .configpanel container instead so Ctrl+A reaches handleSelectAll. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Align error/luaSyntaxError displays with CodeBlock's pattern: theme-aware text-error, text-sm, whitespace-pre-line, max-h-24 overflow-y-auto. Replaces hardcoded text-red-400.
When GridScript.expandScript throws (malformed/compressed Lua), the outer catch nulled everything including fileContent, hiding the editor. Now the inner try/catch sets fileContent to the raw content and records the error, so the Monaco editor remains visible and the user can fix it.
Member
Author
|
@Greg-Orca fixed |
Contributor
Contributor
Member
Author
|
Automatic height calculator removed from inline code editor, height is now fixed 128px. The automatic height calculation is the most likely cause of the resize observer infinite loop. (Cannot verify 100%, let's hope) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #1390
Closes #967
Makes working with code blocks less of a time sink by removing the need to open/close the full editor modal to switch between blocks.
Part 1 — auto-close & replace
A new
monaco-session.storetracks the open editor's action + dirty state. Opening another block's editor while the current one is clean auto-closes and replaces it; while it has unsaved changes it's protected and the trigger is disabled.Part 2 — inline editing
The read-only preview is replaced by a real inline Monaco editor in the action block, so you can edit any number of blocks without ever opening the modal.
Monaco.sveltedecomposed into reusableCodeEditor(editor + validation + commit),CommitStatus, andCharacterCountcomponents, reused by both the modal and the inline editor.DynamicWrapperso the block is flagged invalid (red border) like other blocks, and cleared on teardown so the flag doesn't outlive the editor.svelte/animateflipwith a translate-onlyreflowanimation so blocks whose height changes (e.g. showing a syntax error) aren't vertically squished mid-animation.background-muted/background-soft), also applied toLineEditor.Ctrl+S to commit/save (#967)
Ctrl/Cmd+S now commits/saves in every code-editor context. Each container catches the keystroke (
preventDefault+stopPropagation, so it's scoped and doesn't hit the browser default or other handlers) and triggers the context's canonical button, which no-ops on its own when disabled:CodeBlock.svelteMonaco.svelteFileManager.sveltePer the direction in #967, this is scoped to editor/file-system commits rather than a global "save everything" state. Buttons are triggered via their rendered
<button>for now; follow-up intechstudio/grid-uikit#50 proposes aMoltenPushButton.trigger()method to drop the wrapper +querySelector.Notes
🤖 Generated with Claude Code