Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,4 @@ export const Small = Node.create({
},
};
},

addKeyboardShortcuts() {
return {
'Mod-Shift-S': () => this.editor.commands.toggleSmall(),
};
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ describe('the editor schema', () => {
expect(editor.getHTML()).not.toContain('<s>');
});

it.each([
['paragraph', '<p>text</p>'],
['small', '<small>text</small>'],
])('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 <span> is no node in this schema, so it survives the round trip only by being
// read as the mark that wrote it.
Expand Down Expand Up @@ -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');
Expand Down
Loading