From 0c85ba6e4bc92614946440182e99853452aaf512 Mon Sep 17 00:00:00 2001 From: abose Date: Thu, 23 Apr 2026 15:49:20 +0530 Subject: [PATCH 1/5] fix(ccb): make toolbar undo/redo work when an external surface owns focus in design mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/editor/EditorCommandHandlers.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/editor/EditorCommandHandlers.js b/src/editor/EditorCommandHandlers.js index df76575eb6..7a8aa3669d 100644 --- a/src/editor/EditorCommandHandlers.js +++ b/src/editor/EditorCommandHandlers.js @@ -33,6 +33,7 @@ define(function (require, exports, module) { Editor = require("editor/Editor").Editor, CommandManager = require("command/CommandManager"), EditorManager = require("editor/EditorManager"), + WorkspaceManager = require("view/WorkspaceManager"), StringUtils = require("utils/StringUtils"), TokenUtils = require("utils/TokenUtils"), CodeMirror = require("thirdparty/CodeMirror/lib/codemirror"), @@ -1185,6 +1186,16 @@ define(function (require, exports, module) { var editor = EditorManager.getFocusedEditor(); var result = new $.Deferred(); + // In design mode the active document often lives behind an external + // surface that owns DOM focus (e.g. the markdown viewer iframe in + // edit mode), so getFocusedEditor() returns null even though there + // is an underlying Phoenix editor whose doc captures the changes. + // Fall back to the active-pane full editor so toolbar undo/redo + // still drives the document's history in that state. + if (!editor && WorkspaceManager.isInDesignMode()) { + editor = EditorManager.getCurrentFullEditor(); + } + if (editor) { editor[operation](); result.resolve(); From 64ac885e59e4e0e6921143caba7460eb661e0d09 Mon Sep 17 00:00:00 2001 From: abose Date: Thu, 23 Apr 2026 18:57:54 +0530 Subject: [PATCH 2/5] feat(ccb): reinstate active-file label with dirty indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restores the vertical file-name + dirty-dot label that was removed in 22b219168 (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. --- src/index.html | 7 ++ src/styles/CentralControlBar.less | 63 +++++++++++++++ src/view/CentralControlBar.js | 44 ++++++++++ test/spec/CentralControlBar-integ-test.js | 98 ++++++++++++++++++++++- 4 files changed, 211 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index f44dc52308..1da43dfafb 100644 --- a/src/index.html +++ b/src/index.html @@ -969,6 +969,13 @@ +
+
+
+ + +
+
diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 482fec812a..43f4073bd0 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -544,6 +544,7 @@ define({ "IMAGE_SEARCH_PRO_THROTTLE_MESSAGE": "Image search is temporarily unavailable due to high demand. This usually clears within an hour — please try again shortly.", "LIVE_PREVIEW_CUSTOM_SERVER_BANNER": "Getting preview from your custom server {0}", "LIVE_PREVIEW_MODE_TOGGLE_PREVIEW": "Toggle Preview Mode (F8)", + "LIVE_PREVIEW_MODE_TOGGLE_EDIT": "Toggle Edit Mode (F8)", "LIVE_PREVIEW_MODE_PREVIEW": "Preview Mode", "LIVE_PREVIEW_MODE_HIGHLIGHT": "Highlight Mode", "LIVE_PREVIEW_MODE_EDIT": "Edit Mode", From 8ea615e0a210439ffbb8a3aa0d907a7028039cf1 Mon Sep 17 00:00:00 2001 From: abose Date: Thu, 23 Apr 2026 20:51:30 +0530 Subject: [PATCH 5/5] chore(strings): point the mode-switch hint at the new pencil toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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. --- src/nls/root/strings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 43f4073bd0..0bc4d69f2b 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -2358,7 +2358,7 @@ define({ "DEMO_EDIT_MODE_DESCRIPTION": "Select and change things on the page", "DEMO_PREVIEW_MODE_LABEL": "Preview mode", "DEMO_PREVIEW_MODE_DESCRIPTION": "See your page as visitors will see it", - "DEMO_MODE_SWITCH_HINT": "Press F8 or click the \"Play\" buttons to switch modes.", + "DEMO_MODE_SWITCH_HINT": "Press F8 or click the button to switch modes.", "DEMO_TIPS_LABEL": "Tips:", "DEMO_SECTION6_TIP1": "Click any link to select it for editing", "DEMO_SECTION6_TIP2_NEWTAB": "Enable Open in new tab to open links on a separate page",