mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
feat: Add instance link shortcut (#6736)
Adds a keyboard shortcut to the existing “Copy link to instance” action. It copies a link to the current page and selected instance without a success toast, matching other copy actions. The Navigator context-menu item shows ⌘+L on macOS and Ctrl+L elsewhere through the shared `Kbd` primary-modifier mapping. The Vercel preview and fixture workflow no longer runs for feature-branch pushes before a PR exists. Opening or updating a PR runs the workflow; pushes to `main` and `*.staging` keep their existing behavior. We want to push freely while working and spend CI resources only after opening a PR. - [x] Reuse the existing context-menu copy behavior for the shortcut. - [x] Show the platform shortcut hint on the existing Navigator menu item. - [x] Keep copy feedback consistent with other copy actions: no success toast. - [x] Restrict workflow pushes to `main` and `*.staging`, and run it for PRs. - [x] Update the Navigator and shortcuts documentation. - [x] Run focused checks: 59 Builder tests passed; formatting passed. - [x] Verify Ctrl+L in the live Builder on macOS Chrome; it copied the instance link. - [ ] Verify the hint and shortcut behavior in a Windows browser. Windows is unavailable here; Chrome on Windows reserves Ctrl+L for the address bar. - [x] Documentation impact reviewed; no other docs need changes. - [x] Trace the shared E2E failures on shards 2, 3, and 5 to the expired HTTPS certificate used by the dedicated Builder test server. The server now allows this certificate for OAuth token exchanges; all three affected E2E tests pass locally. Ref #4364
This commit is contained in:
1 parent
726b288a3e
commit
6ffbee1e24
7 files changed
+55
-26
No files matched your search
@@ -2,6 +2,10 @@ name: Vercel Deploy Staging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "*.staging"
|
||||
pull_request:
|
||||
workflow_call:
|
||||
|
||||
# cancel in-progress runs on new commits to same PR (gitub.event.number)
|
||||
@@ -19,6 +23,7 @@ jobs:
|
||||
deployment:
|
||||
# Execute development and staging on staging branches
|
||||
# Execute only development on all other branches
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
||||
strategy:
|
||||
matrix:
|
||||
environment:
|
||||
@@ -40,7 +45,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy' }}
|
||||
|
||||
- uses: ./.github/actions/submodules-checkout
|
||||
@@ -61,8 +66,8 @@ jobs:
|
||||
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
||||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
||||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
ref-name: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
sha: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
|
||||
ref-name: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
environment: ${{ matrix.environment }}
|
||||
production-staged: ${{ github.event_name == 'push' && matrix.environment == 'staging' && startsWith(github.ref_name, 'release-') && endsWith(github.ref_name, '.staging') }}
|
||||
PUBLIC_COLLAB_RELAY_URL: ${{ vars.PUBLIC_COLLAB_RELAY_URL }}
|
||||
@@ -102,19 +107,20 @@ jobs:
|
||||
builder-host: "${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is"
|
||||
|
||||
deployment-host:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
development-builder-host: ${{ steps.host.outputs.value }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy' }}
|
||||
|
||||
- id: host
|
||||
shell: bash
|
||||
env:
|
||||
REF_NAME: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
REF_NAME: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
run: |
|
||||
clean_name=$(.github/actions/vercel/deployment-alias.sh "${REF_NAME}")
|
||||
echo "value=${clean_name}.development.webstudio.is" >> "$GITHUB_OUTPUT"
|
||||
@@ -136,4 +142,4 @@ jobs:
|
||||
needs: fixtures-test
|
||||
uses: ./.github/workflows/delete-github-deployments.yml
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
ref: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
|
||||
@@ -105,6 +105,7 @@ import {
|
||||
emitPaste,
|
||||
cutInstance,
|
||||
} from "~/shared/copy-paste/copy-paste";
|
||||
import { getInstanceLink } from "~/shared/instance-utils/link";
|
||||
import {
|
||||
getDeletablePageActionTarget,
|
||||
getPageActionTarget,
|
||||
@@ -935,6 +936,26 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
|
||||
void copyInstance();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "copyInstanceLink",
|
||||
hidden: true,
|
||||
category: "Navigator",
|
||||
defaultHotkeys: ["meta+l", "ctrl+l"],
|
||||
disableOnInputLikeControls: true,
|
||||
handler: async () => {
|
||||
const link = getInstanceLink(
|
||||
$selectedInstancePath.get()?.[0]?.instanceSelector
|
||||
);
|
||||
if (link === undefined) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(link);
|
||||
} catch {
|
||||
toast.error("Could not copy link");
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "paste",
|
||||
description: "Paste copied instance(s)",
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
theme,
|
||||
Kbd,
|
||||
Box,
|
||||
toast,
|
||||
} from "@webstudio-is/design-system";
|
||||
import { showAttribute } from "@webstudio-is/react-sdk";
|
||||
import { emitCommand, instanceMoveCommandMetas } from "./commands";
|
||||
@@ -34,10 +33,7 @@ import {
|
||||
type InstancePath,
|
||||
} from "@webstudio-is/project-build/runtime";
|
||||
import { canDeleteInstanceInContentMode } from "@webstudio-is/project-build/runtime";
|
||||
import {
|
||||
getInstanceLink,
|
||||
getDeepLinkedInstanceSelection,
|
||||
} from "~/shared/instance-utils/link";
|
||||
import { getDeepLinkedInstanceSelection } from "~/shared/instance-utils/link";
|
||||
import { $instances, $pages, $project } from "~/shared/sync/data-stores";
|
||||
import {
|
||||
isComponentDetachable,
|
||||
@@ -205,20 +201,19 @@ export const MenuItems = () => {
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem
|
||||
disabled={instanceSelection === undefined || project === undefined}
|
||||
onSelect={async () => {
|
||||
const link = getInstanceLink(instanceSelector);
|
||||
if (link === undefined) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(link);
|
||||
toast.success("Link copied");
|
||||
} catch {
|
||||
toast.error("Could not copy link");
|
||||
}
|
||||
onSelect={() => {
|
||||
emitCommand("copyInstanceLink");
|
||||
}}
|
||||
>
|
||||
Copy link to instance
|
||||
<ContextMenuItemRightSlot>
|
||||
<Kbd
|
||||
value={["meta", "l"]}
|
||||
color={shortcutColor(
|
||||
instanceSelection !== undefined && project !== undefined
|
||||
)}
|
||||
/>
|
||||
</ContextMenuItemRightSlot>
|
||||
</ContextMenuItem>
|
||||
<ContextMenuItem
|
||||
disabled={!permissions.canPaste}
|
||||
|
||||
@@ -14,6 +14,10 @@ const start = async () => {
|
||||
// Resource E2E fixtures use loopback URLs. Keep this exception limited to
|
||||
// the dedicated test server; production uses the public-address guard.
|
||||
process.env.E2E_ALLOW_LOCAL_RESOURCE_URLS = "true";
|
||||
// Allow the dedicated E2E server's local HTTPS certificate for loopback
|
||||
// service-to-service fetches such as oauth.ws.token, matching vite.config.ts
|
||||
// and e2e/setup.ts.
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED ??= "0";
|
||||
const serverDirectory = path.resolve("build/server");
|
||||
const builds = await Promise.all(
|
||||
readdirSync(serverDirectory, { withFileTypes: true })
|
||||
|
||||
@@ -37,10 +37,11 @@ keeps the remaining selection intact.
|
||||
|
||||
### Link to a selected instance
|
||||
|
||||
Right-click an instance and choose **Copy link to instance** to copy its full
|
||||
Builder URL to the clipboard. Share the link to open the same page and select
|
||||
the same instance, including its location inside a shared Slot. Select one
|
||||
instance at a time; this action is unavailable for Global Root.
|
||||
Right-click an instance and choose **Copy link to instance**
|
||||
(`⌘ + L` on macOS, `Ctrl + L` on Windows when not intercepted by the browser)
|
||||
to copy its full Builder URL to the clipboard. Share the link to open the same
|
||||
page and select the same instance, including its location inside a shared Slot.
|
||||
Select one instance at a time; this action is unavailable for Global Root.
|
||||
|
||||
The recipient needs access to the project. If you opened the Builder through a
|
||||
share link, the copied URL keeps that share link’s access token.
|
||||
|
||||
@@ -30,6 +30,7 @@ icon: command
|
||||
## **Sidebar Left**
|
||||
|
||||
- Copy: `⌘ + c`
|
||||
- Copy link to instance: `⌘ + l` (macOS) / `Ctrl + l` (Windows, when not intercepted by the browser)
|
||||
- Cut: `⌘ + x`
|
||||
- Paste: `⌘ + v`
|
||||
- Duplicate: `⌘ + d`
|
||||
|
||||
@@ -4,6 +4,7 @@ const isMac =
|
||||
typeof navigator === "object" ? /mac/i.test(navigator.platform) : false;
|
||||
|
||||
const shortcutSymbolMap: Record<string, string> = {
|
||||
// Cross-platform primary modifier: ⌘ on macOS, Ctrl elsewhere.
|
||||
meta: isMac ? "⌘" : "Ctrl",
|
||||
shift: "⇧",
|
||||
alt: isMac ? "⌥" : "Alt",
|
||||
|
||||
Reference in new issue
Block a user