mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 05:01:03 +03:00
fix(app): paste plain text when renaming session tabs (#58036)
Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
4d120d491d
commit
f7d5b6ffc4
@@ -217,7 +217,7 @@ test.describe("rename", () => {
|
||||
await expect(tab).toBeFocused()
|
||||
await tab.press("Shift+F10")
|
||||
await page.getByRole("menuitem", { name: "Rename", exact: true }).click()
|
||||
const input = page.locator('[data-slot="tab-title"][contenteditable="true"]')
|
||||
const input = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
|
||||
await expect(input).toBeFocused()
|
||||
await input.fill("Renamed from tab")
|
||||
await input.press("Enter")
|
||||
@@ -241,7 +241,7 @@ test.describe("rename", () => {
|
||||
await expect(heading(page, fixture.expected.sourceTitle)).toBeVisible()
|
||||
await tabs(page).filter({ hasText: fixture.expected.targetTitle }).click({ button: "right" })
|
||||
await page.getByRole("menuitem", { name: "Rename", exact: true }).click()
|
||||
const input = page.locator('[data-slot="tab-title"][contenteditable="true"]')
|
||||
const input = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
|
||||
await expect(input).toBeFocused()
|
||||
await input.fill("Inactive tab renamed")
|
||||
await input.press("Tab")
|
||||
|
||||
@@ -125,7 +125,7 @@ test("a tab does not reopen its title editor while a rename is saving", async ({
|
||||
await mockWorkspace(page, { name: "Tabs", sessions: [a, b] })
|
||||
await page.goto(sessionHref(a.id))
|
||||
const title = page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(a.id)}"]) [data-slot="tab-title"]`)
|
||||
const editor = page.locator('[data-slot="tab-title"][contenteditable="true"]')
|
||||
const editor = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
|
||||
await expect(title).toHaveText(a.title)
|
||||
const save = await holdRoute(page, (url) => url.pathname === `/api/session/${a.id}`, { method: "PATCH" })
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const editableSelector = "input, textarea, select, [contenteditable=''], [contenteditable='true']"
|
||||
const editableSelector = "input, textarea, select, [contenteditable=''], [contenteditable='true'], [contenteditable='plaintext-only']"
|
||||
|
||||
export function handleDocumentSearchKeydown(
|
||||
input: HTMLInputElement | undefined,
|
||||
|
||||
@@ -328,7 +328,7 @@ export function TabNavItem(props: {
|
||||
"overflow-hidden text-clip whitespace-nowrap": !editing(),
|
||||
"select-text": editing(),
|
||||
}}
|
||||
contenteditable={editing() ? true : undefined}
|
||||
contenteditable={editing() ? "plaintext-only" : undefined}
|
||||
onDblClick={openRename}
|
||||
onKeyDown={(event) => {
|
||||
event.stopPropagation()
|
||||
|
||||
@@ -364,7 +364,7 @@ export function TitlebarTabStrip(props: {
|
||||
: [new PointerActivationConstraints.Distance({ value: 4 })],
|
||||
preventActivation: (event) =>
|
||||
event.target instanceof Element &&
|
||||
!!event.target.closest('[data-slot="tab-close"], [contenteditable="true"]'),
|
||||
!!event.target.closest('[data-slot="tab-close"], [contenteditable="true"], [contenteditable="plaintext-only"]'),
|
||||
}),
|
||||
]}
|
||||
modifiers={[
|
||||
|
||||
Reference in New Issue
Block a user