Skip to content

slides: add context menu, insert cell actions#9783

Open
Light2Dark wants to merge 4 commits into
sham/add-show-code-configfrom
sham/qol-features-slides
Open

slides: add context menu, insert cell actions#9783
Light2Dark wants to merge 4 commits into
sham/add-show-code-configfrom
sham/qol-features-slides

Conversation

@Light2Dark
Copy link
Copy Markdown
Collaborator

📝 Summary

Adds a context menu, and a line between slide cells to insert new ones. Also fixes some focus bugs and keypress bugs when doing this.

Screen.Recording.2026-06-04.at.11.56.20.AM.mov

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

@Light2Dark Light2Dark requested a review from Copilot June 4, 2026 03:57
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jun 5, 2026 9:41am

Request Review

@Light2Dark Light2Dark added the enhancement New feature or request label Jun 4, 2026
@Light2Dark Light2Dark marked this pull request as ready for review June 4, 2026 03:59
@Light2Dark Light2Dark changed the title add context menu, insert cell actions slides: add context menu, insert cell actions Jun 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the slides editing experience by adding minimap affordances (context menu + insert-cell lines) and improving slide deck composition/overlay behavior to prevent editor focus loss when a parked/no-output cell starts producing output.

Changes:

  • Add insert/delete actions to the slides minimap (inline “insert cell” lines + right-click context menu).
  • Refactor parked preview behavior in RevealSlidesComponent to “hold” an editing cell in the overlay to avoid editor remount/focus loss, and to keep held cells out of the composed deck.
  • Expose/consume LanguageToggles in slide cell view and make its wrapper class configurable; add/expand unit tests for the new parked-preview logic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/components/slides/slide-cell-view.tsx Adds language toggles to slide cell view and ensures toggle callbacks are stable.
frontend/src/components/slides/reveal-component.tsx Introduces held parked-preview logic, factors out deck slide type resolution, and tweaks code-toggle UX when code is pinned on.
frontend/src/components/slides/minimap.tsx Adds insert-cell UI lines and a context menu for slide thumbnail rows; adjusts thumbnail row semantics.
frontend/src/components/slides/tests/reveal-component.test.ts Adds coverage for deckSlideType, parkedRendersSource, and useParkedPreview.
frontend/src/components/editor/cell/code/language-toggle.tsx Adds an optional className prop to allow alternate placement/styling of language toggles.

Comment thread frontend/src/components/slides/minimap.tsx
Comment thread frontend/src/components/slides/reveal-component.tsx Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files

Architecture diagram
sequenceDiagram
    participant User
    participant Minimap as Slides Minimap
    participant SlideRow as SlideThumbnailRow
    participant ContextMenu as ContextMenu Trigger
    participant InsertBtn as InsertCellLine
    participant CellActions as useCellActions
    participant DeleteCell as useDeleteCellCallback
    participant Deck as RevealSlidesComponent
    participant ParkedPreview as useParkedPreview
    participant DeckSlideType as deckSlideType
    participant SlideCellView as SlideCellView
    participant LangToggles as LanguageToggles
    participant SlideCells as slideCells Store

    Note over User,SlideCells: Insert Cell Flow

    User->>Minimap: Clicks insert line
    Minimap->>InsertBtn: Renders "+" button
    InsertBtn->>InsertBtn: Stops pointer event propagation
    InsertBtn->>CellActions: createNewCell({ cellId, before, code: "", autoFocus: false })
    CellActions->>SlideCells: Insert new blank cell
    SlideCells-->>Deck: Cell list updates
    Deck->>Deck: Re-compute composition

    Note over User,SlideCells: Context Menu Flow

    User->>Minimap: Right-clicks slide thumbnail
    Minimap->>ContextMenu: Opens (onInsertBelow / onDelete present)
    alt User selects "Add cell"
        ContextMenu-->>CellActions: onInsertBelow
        CellActions->>SlideCells: Insert cell after
    else User selects "Delete cell"
        ContextMenu-->>DeleteCell: onDelete
        DeleteCell->>SlideCells: Remove cell from store
    end

    Note over Deck,ParkedPreview: Parked Preview / Held Edit Flow

    Deck->>ParkedPreview: useParkedPreview({ activeCell, slideConfigs, noOutputIds })
    alt No output cell selected
        ParkedPreview->>ParkedPreview: baseParked = true (no output or skip type)
        ParkedPreview-->>Deck: { parkedPreviewCell, isNoOutputPreview: true, heldEditCellId: null }
    else Output cell currently being edited
        ParkedPreview->>ParkedPreview: baseParked = false, but heldParkedCellRef matches activeCell
        ParkedPreview-->>Deck: { parkedPreviewCell, isHeldEdit: true, heldEditCellId }
    else Normal rendered cell
        ParkedPreview-->>Deck: { parkedPreviewCell: null }
    end

    Deck->>Deck: Use heldEditCellId in deckSlideType() to skip held cell from deck
    DeckSlideType->>DeckSlideType: Returns "skip" for held/ no-output cells

    Note over Deck,SlideCellView: Cell Rendering in Parked Overlay

    Deck->>Deck: If parkedPreviewCell exists, render overlay
    Deck->>SlideCellView: Render cell in overlay (if editable)
    SlideCellView->>LangToggles: NEW: Shows language toggles
    SlideCellView->>SlideCellView: On toggle, calls maybeAddMarimoImport()
    Deck->>Deck: parkedRendersSource() decides source vs output display

    Note over User,Minimap: Keyboard Navigation

    User->>Minimap: Arrow keys while parked
    Minimap->>Deck: Navigate to next/prev slide
    alt Held cell releases
        Deck->>ParkedPreview: New activeCell triggers release
        ParkedPreview->>ParkedPreview: heldParkedCellRef reset
        ParkedPreview-->>Deck: parkedPreviewCell = null
    end

    Note over SlideCellView,LangToggles: Language Toggle Integration

    SlideCellView->>LangToggles: NEW: Renders with custom className
    LangToggles->>SlideCellView: onAfterToggle
    SlideCellView->>SlideCellView: maybeAddMarimoImport()
    SlideCellView->>CellActions: createNewCell if autoInstantiate
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/components/slides/reveal-component.tsx Outdated
Comment thread frontend/src/components/slides/reveal-component.tsx Outdated
@Light2Dark Light2Dark added the bash-focus Area to focus on during release bug bash label Jun 4, 2026
@Light2Dark
Copy link
Copy Markdown
Collaborator Author

@dmadisetti what do you think about this addition?

@Light2Dark Light2Dark requested a review from dmadisetti June 5, 2026 08:24
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/components/slides/reveal-component.tsx">

<violation number="1" location="frontend/src/components/slides/reveal-component.tsx:567">
P2: The held-edit `C` toggle is transient; it never updates the shared code-visibility override, so the cell reverts to its previous code state once it leaves the parked overlay.</violation>

<violation number="2" location="frontend/src/components/slides/reveal-component.tsx:667">
P2: Held preview ignores persisted `showCode: true`, so code can stay hidden during held edits.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment on lines +667 to +669
const parkedShowCode = isHeldEdit
? heldShowsCode
: resolveShowCode(parkedPreviewCell?.id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Held preview ignores persisted showCode: true, so code can stay hidden during held edits.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/slides/reveal-component.tsx, line 667:

<comment>Held preview ignores persisted `showCode: true`, so code can stay hidden during held edits.</comment>

<file context>
@@ -630,9 +664,9 @@ const RevealSlidesComponent = ({
-  // While holding a cell in the overlay for an in-progress edit we must keep
-  // the editor mounted
-  const parkedShowCode = resolveShowCode(parkedPreviewCell?.id) || isHeldEdit;
+  const parkedShowCode = isHeldEdit
+    ? heldShowsCode
+    : resolveShowCode(parkedPreviewCell?.id);
</file context>
Suggested change
const parkedShowCode = isHeldEdit
? heldShowsCode
: resolveShowCode(parkedPreviewCell?.id);
const parkedShowCode = isHeldEdit
? heldShowsCode || codeAlwaysShown
: resolveShowCode(parkedPreviewCell?.id);

Comment on lines +567 to 570
if (isHeldEdit) {
toggleHeldShowsCode();
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The held-edit C toggle is transient; it never updates the shared code-visibility override, so the cell reverts to its previous code state once it leaves the parked overlay.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/slides/reveal-component.tsx, line 567:

<comment>The held-edit `C` toggle is transient; it never updates the shared code-visibility override, so the cell reverts to its previous code state once it leaves the parked overlay.</comment>

<file context>
@@ -534,6 +564,10 @@ const RevealSlidesComponent = ({
     if (cellIdToShowCode == null || codeAlwaysShown) {
       return;
     }
+    if (isHeldEdit) {
+      toggleHeldShowsCode();
+      return;
</file context>
Suggested change
if (isHeldEdit) {
toggleHeldShowsCode();
return;
}
if (isHeldEdit) {
startTransition(() =>
setShowCodeOverrides((prev) => {
const next = new Set(prev);
if (next.has(cellIdToShowCode)) {
next.delete(cellIdToShowCode);
} else {
next.add(cellIdToShowCode);
}
return next;
}),
);
toggleHeldShowsCode();
return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants