[Website] Use the shared file explorer in the Blueprint editor - #3990
Merged
Conversation
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 00:46
a8c6564 to
a10232f
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 00:53
3ac76a4 to
90edf18
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 10:06
a10232f to
f35c004
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 10:08
90edf18 to
1aceadf
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 10:27
f35c004 to
8011730
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 10:28
1aceadf to
ed1bc6f
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 12:16
8011730 to
da048e2
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 12:26
ed1bc6f to
44690d1
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 12:51
da048e2 to
12c47f3
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 12:52
44690d1 to
02d08d3
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 18:54
12c47f3 to
e488dfa
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 18:54
02d08d3 to
5540f06
Compare
adamziel
force-pushed
the
dock-file-editor-surfaces
branch
from
July 10, 2026 20:33
e488dfa to
7229e8d
Compare
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 20:33
5540f06 to
6061c98
Compare
adamziel
added a commit
that referenced
this pull request
Jul 10, 2026
## What it does Adds an Upload button to the reusable file editor and lets users drop files or local directories on the blank area around its file tree. Imports go into the selected directory, and dropped directories keep their nested files and subdirectories. This PR also: - adds a `readOnly` option that keeps browsing and previews available while hiding or disabling changes to the filesystem; - selects and expands to the file currently open in the editor; and - uses the existing POSIX path helpers without trimming rename input or treating `\` as a separator. Empty names, `.`, `..`, and names containing `/` are still rejected. The Blueprint editor switch remains in #3990. ## Rationale The file browser has two parts. `FileExplorerSidebar` renders the header, Upload button, and space around the tree. `FilePickerTree` renders the rows and performs filesystem operations. Before this PR, dropping a local directory on a tree row worked because the drop reached `FilePickerTree`. Dropping the same directory on the surrounding sidebar did not reach that code. This PR makes the tree's import operation available to the sidebar, so the Upload button, tree-row drops, and background drops all behave the same way. The browser only exposes a drop payload while the drop handler is running, so the sidebar captures its entries and files before starting the asynchronous import. ## Testing instructions ```bash npm exec nx -- run-many -t test,typecheck,lint,build \ --projects=playground-components npm exec nx -- run playground-components:e2e -- --workers=1 ``` Manual check: 1. Run `npm exec nx -- run playground-components:dev -- --host 127.0.0.1 --port 5174` and open `http://127.0.0.1:5174/playwright-file-editor.html`. 2. Select `/wordpress/workspace/subdir`, upload a text file, and confirm it appears there. 3. Drop a nested local directory on the blank explorer background and confirm its hierarchy appears under the selected directory. 4. Rename a throwaway entry with surrounding spaces and a backslash and confirm the name is not rewritten.
adamziel
marked this pull request as ready for review
July 10, 2026 23:35
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Replaces the Blueprint editor’s bespoke file explorer with the shared FileExplorerSidebar / FilePickerTree implementation so Blueprint bundles get the same recursive directory import and read-only behavior as the reusable file editor surface.
Changes:
- Delete Blueprint editor–specific file explorer component + CSS and wire the editor to the shared components
- Extend shared explorer/tree to support read-only mode and unified background drop + file-input upload importing
- Add/adjust Playwright coverage to validate the shared upload/import surface appears and supports nested directory drops
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/src/components/blueprint-editor/file-explorer.module.css | Deleted duplicated Blueprint explorer styles (now using shared explorer surface). |
| packages/playground/website/src/components/blueprint-editor/file-explorer-sidebar.tsx | Deleted duplicated Blueprint explorer implementation (replaced by shared component). |
| packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.tsx | Switched Blueprint editor to shared FileExplorerSidebar and removed treeFocusPath state. |
| packages/playground/website/playwright/e2e/website-ui.spec.ts | Added assertion that the shared “Upload files” action is visible in Blueprint editor. |
| packages/playground/components/src/PlaygroundFileEditor/file-explorer-sidebar.tsx | Added upload UI + background drop handling and read-only plumbing; sync tree selection with currentPath. |
| packages/playground/components/src/FilePickerTree/index.tsx | Added readOnly mode, exposed import APIs, improved path normalization and CSS selector escaping, and refactored drop import flow. |
| packages/playground/components/e2e/tests/playground-file-picker.spec.ts | Added e2e coverage for renaming with backslashes/spaces. |
| packages/playground/components/e2e/tests/playground-file-editor.spec.ts | Added e2e coverage for dropping a nested host directory onto the explorer background. |
Comments suppressed due to low confidence (2)
packages/playground/components/src/FilePickerTree/index.tsx:681
- The previous logic rejected dropping a node onto itself (
destinationDir === sourcePath) in addition to rejecting descendant drops. After switching toisParentOf(...), the self-drop check is gone, which can allow attempting to move a folder into itself (e.g., drop/aonto/a→ move to/a/a), typically resulting in a failing/undefined filesystem move. Add an explicitdestinationDir === sourcePathguard (or ensureisParentOftreats equality as invalid) before allowing the drop.
if (!destinationDir) {
return { allowed: false, state: 'invalid', destination: null };
}
if (sourcePath) {
if (isParentOf(sourcePath, destinationDir)) {
return { allowed: false, state: 'invalid', destination: null };
}
}
return { allowed: true, state: 'valid', destination: destinationDir };
packages/playground/components/src/PlaygroundFileEditor/file-explorer-sidebar.tsx:1
- This
<button>is missing an explicittype=\"button\". If this sidebar is ever rendered inside a<form>, the defaulttype=\"submit\"can trigger unintended submissions. Settype=\"button\"on the create-file and create-folder buttons (the upload button already does this).
import React, {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adamziel
force-pushed
the
file-editor-surface-wiring
branch
from
July 10, 2026 23:44
767f3e1 to
0082791
Compare
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.
What it does
Uses the shared
FileExplorerSidebarin the Blueprint editor, so Blueprint bundles get the same recursive local-directory import and read-only behavior as the reusable file editor surface.The Blueprint editor's private 512-line explorer and 89-line stylesheet are deleted.
currentPathnow drives tree selection directly, so the paralleltreeFocusPathstate is gone as well.The shared toolbar uses three consistently sized icon buttons, keeping the actions on one line in the narrow Blueprint sidebar. Each button retains an accessible name and browser tooltip.
This PR does not change Site Manager persistence, OPFS lifecycle behavior, or editor ownership. Those concerns do not belong in a component-wiring change.
Rationale
There is no useful distinction between the two explorers. The private Blueprint copy duplicated uploads, previews, selection, and styling, and that duplication is exactly why local directories worked in one editor but not the other.
The shared explorer from #3973 provides the required import and read-only contracts. This PR replaces the duplicate caller and keeps its controls usable at the Blueprint sidebar width.
Testing instructions