Skip to content

Commit f7d5b6f

Browse files
fix(app): paste plain text when renaming session tabs (#58036)
Co-authored-by: Brendonovich <[email protected]>
1 parent 4d120d4 commit f7d5b6f

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎packages/app/e2e/regression/session-header.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ test.describe("rename", () => {
217217
await expect(tab).toBeFocused()
218218
await tab.press("Shift+F10")
219219
await page.getByRole("menuitem", { name: "Rename", exact: true }).click()
220-
const input = page.locator('[data-slot="tab-title"][contenteditable="true"]')
220+
const input = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
221221
await expect(input).toBeFocused()
222222
await input.fill("Renamed from tab")
223223
await input.press("Enter")
@@ -241,7 +241,7 @@ test.describe("rename", () => {
241241
await expect(heading(page, fixture.expected.sourceTitle)).toBeVisible()
242242
await tabs(page).filter({ hasText: fixture.expected.targetTitle }).click({ button: "right" })
243243
await page.getByRole("menuitem", { name: "Rename", exact: true }).click()
244-
const input = page.locator('[data-slot="tab-title"][contenteditable="true"]')
244+
const input = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
245245
await expect(input).toBeFocused()
246246
await input.fill("Inactive tab renamed")
247247
await input.press("Tab")

‎packages/app/e2e/regression/tabs.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ test("a tab does not reopen its title editor while a rename is saving", async ({
125125
await mockWorkspace(page, { name: "Tabs", sessions: [a, b] })
126126
await page.goto(sessionHref(a.id))
127127
const title = page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(a.id)}"]) [data-slot="tab-title"]`)
128-
const editor = page.locator('[data-slot="tab-title"][contenteditable="true"]')
128+
const editor = page.locator('[data-slot="tab-title"][contenteditable="plaintext-only"]')
129129
await expect(title).toHaveText(a.title)
130130
const save = await holdRoute(page, (url) => url.pathname === `/api/session/${a.id}`, { method: "PATCH" })
131131

‎packages/app/src/shell/commands/search-keydown.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const editableSelector = "input, textarea, select, [contenteditable=''], [contenteditable='true']"
1+
const editableSelector = "input, textarea, select, [contenteditable=''], [contenteditable='true'], [contenteditable='plaintext-only']"
22

33
export function handleDocumentSearchKeydown(
44
input: HTMLInputElement | undefined,

‎packages/app/src/shell/titlebar/tab-nav.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export function TabNavItem(props: {
328328
"overflow-hidden text-clip whitespace-nowrap": !editing(),
329329
"select-text": editing(),
330330
}}
331-
contenteditable={editing() ? true : undefined}
331+
contenteditable={editing() ? "plaintext-only" : undefined}
332332
onDblClick={openRename}
333333
onKeyDown={(event) => {
334334
event.stopPropagation()

‎packages/app/src/shell/titlebar/tab-strip.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export function TitlebarTabStrip(props: {
364364
: [new PointerActivationConstraints.Distance({ value: 4 })],
365365
preventActivation: (event) =>
366366
event.target instanceof Element &&
367-
!!event.target.closest('[data-slot="tab-close"], [contenteditable="true"]'),
367+
!!event.target.closest('[data-slot="tab-close"], [contenteditable="true"], [contenteditable="plaintext-only"]'),
368368
}),
369369
]}
370370
modifiers={[

0 commit comments

Comments
 (0)