-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
tests/plugins/link/link.js
Outdated
} ); | ||
}, | ||
|
||
// (#2478) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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 |
I'm also against removing the old keystroke. It was present from the very beginning and probably many people are accustomed to it. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this 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.
There was a problem hiding this 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.
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
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.