From 7cc28350c20dd0dd138a3f9430e5f83565666889 Mon Sep 17 00:00:00 2001 From: rtibblesbot Date: Sat, 24 Oct 2026 19:26:15 -0700 Subject: [PATCH] Let Ctrl/Cmd+Shift+S apply strikethrough instead of small text The Small node's shortcut shadowed the strike mark's binding. Co-Authored-By: Claude Opus 5.5 --- .../extensions/SmallTextExtension.js | 6 ------ .../TipTapEditor/__tests__/useEditor.spec.js | 21 ++++++++++++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/extensions/SmallTextExtension.js b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/extensions/SmallTextExtension.js index 5a2039bca1..34d7929377 100644 --- a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/extensions/SmallTextExtension.js +++ b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/extensions/SmallTextExtension.js @@ -68,10 +68,4 @@ export const Small = Node.create({ }, }; }, - - addKeyboardShortcuts() { - return { - 'Mod-Shift-S': () => this.editor.commands.toggleSmall(), - }; - }, }); diff --git a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/__tests__/useEditor.spec.js b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/__tests__/useEditor.spec.js index d47e2e84af..965294e285 100644 --- a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/__tests__/useEditor.spec.js +++ b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/__tests__/useEditor.spec.js @@ -56,6 +56,26 @@ describe('the editor schema', () => { expect(editor.getHTML()).not.toContain(''); }); + it.each([ + ['paragraph', '

text

'], + ['small', 'text'], + ])('strikes a %s through on Ctrl+Shift+S, keeping the block', (block, content) => { + const editor = createEditor(content); + editor.commands.selectAll(); + const keydown = new KeyboardEvent('keydown', { + key: 'S', + keyCode: 83, + ctrlKey: true, + shiftKey: true, + }); + editor.view.someProp('handleKeyDown', handler => handler(editor.view, keydown)); + + expect(editor.state.doc.firstChild.type.name).toBe(block); + expect(spansIn(editor.getHTML())).toEqual([ + { text: 'text', style: expect.stringContaining('text-decoration: line-through') }, + ]); + }); + it('reads back the decorated spans it writes', () => { // A is no node in this schema, so it survives the round trip only by being // read as the mark that wrote it. @@ -148,7 +168,6 @@ describe('the inline-only schema', () => { ['ordered list', 'Mod-Shift-7'], ['blockquote', 'Mod-Shift-b'], ['code block', 'Mod-Alt-c'], - ['small text', 'Mod-Shift-S'], ])('creates no block from the %s shortcut', (_, shortcut) => { const editor = createEditor('text'); editor.commands.focus('end');