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

Add Ctrl+K keystroke for link command #2479

Merged
merged 8 commits into from
Oct 15, 2018
Merged

Add Ctrl+K keystroke for link command #2479

merged 8 commits into from
Oct 15, 2018

Conversation

Comandeer
Copy link
Member

What is the purpose of this pull request?

New feature

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

I've added new keystroke for link command. Additionally I added tests to check if it's working alongside the old Ctrl + L one.

Closes #2478.

@mlewand mlewand added the review:easy Pull requests that can be reviewed by a Junior Developer before being reviewed by the Reviewer. label Oct 15, 2018
@jacekbogdanski jacekbogdanski self-assigned this Oct 15, 2018
Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we could deprecate CTRL + L keystroke. TBO I hate this keystroke thus it conflicts with default browser keybindings. However, not sure if we should break old user habits. WDYT?

CHANGES.md Outdated
@@ -12,6 +12,7 @@ New Features:
* [#706](https://github.com/ckeditor/ckeditor-dev/issues/706): Added different cursor style when selecting cells for [Table Selection](https://ckeditor.com/cke4/addon/tableselection) plugin.
* [#651](https://github.com/ckeditor/ckeditor-dev/issues/651): Text pasted using [Paste from Word](https://ckeditor.com/cke4/addon/pastefromword) preservers indentation in paragraphs.
* [#1176](https://github.com/ckeditor/ckeditor-dev/pull/1176): The [Balloon Panel](https://ckeditor.com/cke4/addon/balloonpanel) can be attached to selection instead of element.
* [#2478](https://github.com/ckeditor/ckeditor-dev/issues/2478): Link could be inserted using <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd> keystroke.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Link](https://ckeditor.com/cke4/addon/link) can be inserted using <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd> keystroke.


Link dialog is open.

Repeat the procedure for <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>L</kbd> keystroke.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge it with reproduction steps, so it will be easier to track expected/unexpected.

1. Focus the editor.
2. Press <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd>.

## Expected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing ## Unexpected section. I know it may seem redundant but let's keep it consistent within a project.

} );
},

// (#2478)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is not a part of the issue so I would remove tag reference here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the reference and treat this one as prevention from regression (accidentally breaking the former keystroke).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd second to what @jacekbogdanski noted, this case is not related. Regression protection (related to #2478) is provided by the test Ctrl+K keystroke test case.

resume( function() {
var dialog = evt.data;

dialog.hide();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hiding dialog here, you could move the whole teardown login into tearDown test function. Something like:

  var dialog = CKEDITOR.dialog.getCurrent();
  if ( dialog ) {
    dialog.hide();
  }

It also applies to the second unit test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's necessary. Every other test in this file hides dialog on its own. Having two tests that are using tearDown for it would break consistency.

Copy link
Member

@jacekbogdanski jacekbogdanski Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2479 (comment)

Not if you refactor other tests. However, following the rule "If it ain't broke, don't fix it", lets deal with important stuff, not test refactoring.

@mlewand
Copy link
Contributor

mlewand commented Oct 15, 2018

I'm not sure about removing the hotkey, we'd need to have some data on how people really use the app to back it up.

E.g. personally I find ctrl + l much more intuitive. I also do not miss the native hotkey, as I use alt + d for focusing the address bar (more convenient to press).

@Comandeer
Copy link
Member Author

I'm also against removing the old keystroke. It was present from the very beginning and probably many people are accustomed to it.

Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1. Focus the editor.
2. Press <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd>.

## Expected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure about test construction. I'm more used to linear tests. Although it's subjective, so would like to see the opinion of another reviewer.

resume( function() {
var dialog = evt.data;

dialog.hide();
Copy link
Member

@jacekbogdanski jacekbogdanski Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2479 (comment)

Not if you refactor other tests. However, following the rule "If it ain't broke, don't fix it", lets deal with important stuff, not test refactoring.

Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, the only thing that bugs me is this ticket reference.

There's also a copy'n'pasta in unit tests, but we can let it go as long as there's no third use.

Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, I have rebased the branch.

@mlewand mlewand merged commit e413fab into major Oct 15, 2018
@CKEditorBot CKEditorBot deleted the t/2478 branch October 15, 2018 12:44
@mlewand mlewand added this to the 4.11.0 milestone Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:easy Pull requests that can be reviewed by a Junior Developer before being reviewed by the Reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants