From 4ac0252a640afee0778d50a38fc8283daeb2ee80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= Date: Mon, 29 Jun 2026 08:13:12 +0200 Subject: [PATCH 1/3] fix: inline styles detection in newline --- .playwright/tests/strictMarks.spec.ts | 24 ++++++++++++++++++++++++ src/web/pmPlugins/StrictMarksPlugin.ts | 3 +++ 2 files changed, 27 insertions(+) diff --git a/.playwright/tests/strictMarks.spec.ts b/.playwright/tests/strictMarks.spec.ts index 646d74b88..1777e7a10 100644 --- a/.playwright/tests/strictMarks.spec.ts +++ b/.playwright/tests/strictMarks.spec.ts @@ -143,6 +143,30 @@ test.describe('strict marks', () => { await expect(boldBtn).toHaveClass(/toolbar-btn--active/); }); + test('pressing Enter in the middle of bold that is followed by plain text keeps bold and types bold', async ({ + page, + }) => { + await setEditorHtml(page, '

hello world

'); + + const editor = editorLocator(page); + const boldBtn = toolbarButton(page, 'bold'); + + await editor.click(); + await editor.press('End'); + // land in he|llo + for (let i = 0; i < 9; i++) { + await editor.press('ArrowLeft', { delay: 40 }); + } + + await editor.press('Enter'); + await expect(boldBtn).toHaveClass(/toolbar-btn--active/); + + await editor.pressSequentially('X', { delay: 40 }); + await expect(boldBtn).toHaveClass(/toolbar-btn--active/); + + await expect.poll(async () => getSerializedHtml(page)).toMatch(/

X/); + }); + test('pressing Enter after the last bold character keeps bold when the rest of the line is plain', async ({ page, }) => { diff --git a/src/web/pmPlugins/StrictMarksPlugin.ts b/src/web/pmPlugins/StrictMarksPlugin.ts index cbbc5de18..5d5220362 100644 --- a/src/web/pmPlugins/StrictMarksPlugin.ts +++ b/src/web/pmPlugins/StrictMarksPlugin.ts @@ -104,6 +104,9 @@ export const StrictMarksPlugin = Extension.create({ if (!selection.empty) return null; const docChanged = !oldState.doc.eq(newState.doc); + const selChanged = !oldState.selection.eq(newState.selection); + if (!docChanged && !selChanged) return null; + const isExplicitToggle = !docChanged && transactions.some((tr) => tr.storedMarks !== null); if (isExplicitToggle) return null; From a768836d9d2a75bbe379f1c56b33a40e37bffca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= <74975508+kacperzolkiewski@users.noreply.github.com> Date: Mon, 29 Jun 2026 08:23:45 +0200 Subject: [PATCH 2/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .playwright/tests/strictMarks.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.playwright/tests/strictMarks.spec.ts b/.playwright/tests/strictMarks.spec.ts index 1777e7a10..0c8ea4988 100644 --- a/.playwright/tests/strictMarks.spec.ts +++ b/.playwright/tests/strictMarks.spec.ts @@ -161,7 +161,7 @@ test.describe('strict marks', () => { await editor.press('Enter'); await expect(boldBtn).toHaveClass(/toolbar-btn--active/); - await editor.pressSequentially('X', { delay: 40 }); + await editor.pressSequentially('X', { delay: 80 }); await expect(boldBtn).toHaveClass(/toolbar-btn--active/); await expect.poll(async () => getSerializedHtml(page)).toMatch(/

X/); From d6ae94b6212dab0db35e0984ef8f210e63703afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= <74975508+kacperzolkiewski@users.noreply.github.com> Date: Mon, 29 Jun 2026 08:23:54 +0200 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .playwright/tests/strictMarks.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.playwright/tests/strictMarks.spec.ts b/.playwright/tests/strictMarks.spec.ts index 0c8ea4988..23609b1d3 100644 --- a/.playwright/tests/strictMarks.spec.ts +++ b/.playwright/tests/strictMarks.spec.ts @@ -155,7 +155,7 @@ test.describe('strict marks', () => { await editor.press('End'); // land in he|llo for (let i = 0; i < 9; i++) { - await editor.press('ArrowLeft', { delay: 40 }); + await editor.press('ArrowLeft', { delay: 80 }); } await editor.press('Enter');