Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the confirmation of mention selection by using the space key #7306

Merged
merged 3 commits into from
Aug 18, 2020
Merged
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
3 changes: 1 addition & 2 deletions packages/ckeditor5-mention/src/mentionui.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const handledKeyCodes = [
keyCodes.arrowdown,
keyCodes.enter,
keyCodes.tab,
keyCodes.space,
keyCodes.esc
];

Expand Down Expand Up @@ -121,7 +120,7 @@ export default class MentionUI extends Plugin {
this._mentionsView.selectPrevious();
}

if ( data.keyCode == keyCodes.enter || data.keyCode == keyCodes.tab || data.keyCode == keyCodes.space ) {
if ( data.keyCode == keyCodes.enter || data.keyCode == keyCodes.tab ) {
this._mentionsView.executeSelected();
}

Expand Down
28 changes: 23 additions & 5 deletions packages/ckeditor5-mention/tests/mentionui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1572,8 +1572,30 @@ describe( 'MentionUI', () => {
testExecuteKey( 'enter', keyCodes.enter, feedItems );

testExecuteKey( 'tab', keyCodes.tab, feedItems );
} );

describe( 'on other keys', () => {
it( 'should do nothing on space', async () => {
setData( model, '<paragraph>foo []</paragraph>' );

model.change( writer => {
writer.insertText( '@', doc.selection.getFirstPosition() );
} );

const command = editor.commands.get( 'mention' );
const spy = testUtils.sinon.spy( command, 'execute' );

await waitForDebounce();
expectChildViewsIsOnState( [ true, false, false, false, false ] );

testExecuteKey( 'space', keyCodes.space, feedItems );
fireKeyDownEvent( {
keyCodes: keyCodes.space,
preventDefault: sinon.spy(),
stopPropagation: sinon.spy()
} );

sinon.assert.notCalled( spy );
} );
} );
} );

Expand Down Expand Up @@ -1724,8 +1746,6 @@ describe( 'MentionUI', () => {
testExecuteKey( 'enter', keyCodes.enter, issues );

testExecuteKey( 'tab', keyCodes.tab, issues );

testExecuteKey( 'space', keyCodes.space, issues );
} );
} );
} );
Expand Down Expand Up @@ -1849,8 +1869,6 @@ describe( 'MentionUI', () => {
testExecuteKey( 'enter', keyCodes.enter, issues );

testExecuteKey( 'tab', keyCodes.tab, issues );

testExecuteKey( 'space', keyCodes.space, issues );
} );

describe( 'mouse', () => {
Expand Down