Skip to content

Reinstate file name in central control bar#2837

Merged
abose merged 5 commits intomainfrom
ai
Apr 24, 2026
Merged

Reinstate file name in central control bar#2837
abose merged 5 commits intomainfrom
ai

Conversation

@abose
Copy link
Copy Markdown
Member

@abose abose commented Apr 23, 2026

Reinstated in design mode as per beta test feedback:

  1. Could not see what file name is being editor prominently in live preview
  2. Could not see the dirty state of the file if there are any unsaved edits.

So we show filename with dirty indicator in design mode. Nothing in code mode.

abose added 5 commits April 23, 2026 15:49
…ocus in design mode

In design mode the active document can sit behind a surface that owns
DOM focus instead of a CodeMirror editor — e.g. the markdown viewer's
iframe when it's in edit mode. EditorManager.getFocusedEditor() returns
null in that case, so the CCB undo/redo buttons (and anything else
routing through EDIT_UNDO / EDIT_REDO) silently no-op'd even though the
underlying Phoenix document had perfectly good history.

When design mode is active and no editor is focused, fall back to
EditorManager.getCurrentFullEditor() so toolbar undo/redo drives the
active document. External surfaces that sync their edits back to that
document (like the md viewer) will re-render to reflect the rolled-back
text. Outside design mode the pre-existing no-op behavior is preserved.
Restores the vertical file-name + dirty-dot label that was removed in
22b2191 (replaced with a show-in-tree button at the time). The label
hangs below the save group, reads the file name bottom-up, and shows
a small amber dot at the top when the active document is dirty.

Two improvements over the original:

- Source the file from MainViewManager.getCurrentlyViewedFile(ACTIVE_PANE)
  instead of DocumentManager.getCurrentDocument(). getCurrentDocument()
  is CodeMirror-only, so the old label went blank whenever the active
  pane was an image or other non-CM view. Dirty state still goes
  through DocumentManager.getOpenDocumentForPath(fullPath), which is
  null for non-editable views — they correctly stay un-dirty.

- Anti-pixelation for linux electron: swap
  `writing-mode: vertical-rl; transform: rotate(180deg)` for
  `writing-mode: sideways-lr`, which lets Chromium take its fast
  vertical-text path instead of rasterizing through a rotated
  transform. Pair it with translateZ(0), backface-visibility,
  -webkit-font-smoothing: antialiased, and
  text-rendering: geometricPrecision so the glyphs stay crisp even
  if a system falls back to the slow text path.

Click still dispatches NAVIGATE_SHOW_IN_FILE_TREE (mirrors the
binoculars affordance the label replaced).

Tests: adds a 2b. #ccbFileLabel describe to CentralControlBar-integ-test
covering render/placement, the name-shown / cleared-on-FILE_CLOSE_ALL
cycle, the .is-dirty toggle via setText + refreshText, the click →
NAVIGATE_SHOW_IN_FILE_TREE dispatch, and the label updating when the
active file switches.
In code mode the active file is already obvious from the tab bar and
working-files list, so the vertical CCB label is redundant chrome that
just steals vertical space. In design mode the editor collapses and
those affordances aren't visible — that's the only place the label
earns its spot.

Tag the divider preceding the file group with .ccb-file-divider so the
divider + group can be hidden as a pair, and wrap both in a
`body:not(.ccb-editor-collapsed)` rule. No JS toggle needed; the body
class is already flipped by CentralControlBar when design mode changes.

Adds a "should only be visible in design mode" integ test that
checks :visible on both the label and the leading divider through
enter/exit design-mode transitions.
Turn the live-preview toolbar's play button into an edit-mode toggle:

- Icon: fa-play → fa-pencil; title "Toggle Preview Mode (F8)" →
  "Toggle Edit Mode (F8)" via new LIVE_PREVIEW_MODE_TOGGLE_EDIT string.
- Invert the .selected semantics — the button now lights amber when
  LiveDevelopment.getCurrentMode() === LIVE_EDIT_MODE (not when in
  preview). _initializeMode reconciles .selected against the real mode
  on every livePreviewMode pref change, so state and visuals stay
  synchronized.
- Click handler routes through LiveDevelopment.setMode(LIVE_EDIT_MODE)
  instead of PreferencesManager.set, so we pick up the entitlement
  gate for free: setMode returns false for users without the live-edit
  entitlement, and we then invoke
  KernalModeTrust.ProDialogs.showProUpsellDialog(UPSELL_TYPE_LIVE_EDIT)
  — the same dialog the mode dropdown's "Edit Mode" item opens
  (main.js:459-466). Pro users in edit drop back to preview; pro users
  not in edit enter edit.
- F8 keybinding routes through the same click handler, so it gets the
  same behavior and upsell for free.

No existing tests are affected — the two suites that touch
#previewModeLivePreviewButton only assert its visibility, never the
icon, the .selected class, or the click path.
Onboarding section 6's mode-switch hint used to embed the playButton.svg
with alt="Play". The live-preview toolbar now surfaces a single pencil
edit toggle instead of the play-styled preview button, so update
DEMO_MODE_SWITCH_HINT to inline <i class="fa-solid fa-pencil"> inside
the existing .play-button-hint chip, and change "buttons" to "button"
since there's only one toggle now.

Only root/strings.js is edited — other locales auto-translate via CI.
@sonarqubecloud
Copy link
Copy Markdown

@abose abose merged commit 1c8c9a0 into main Apr 24, 2026
10 of 21 checks passed
@abose abose deleted the ai branch April 24, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant