-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Change -engine/bindTwoStepCaretToAttribute util to -typing/TwoStepCaretMovement plugin. #7506
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.
For the refactor there are mostly cosmetics to fix.
It's not entirely clear for me if this should be handled in this PR:
We also agreed, there should be only 2 movements required for multiple attributes ending in the same position. E.g. "some linking
code
[]" + ←←, results in "some linkingcode[]
". Meaning stepping inside steps into the deepest attribute at given position. It is to minimize the overhead of additional ←s needed for navigation, simplify the behavior and implementation, especially given, looking at the model with a flat structure of attributes, it's hard to identify the depth of nesting.
I think not - so I would see #7444 to be converted to an epic or have a clear follow up so the scope of the PR is clear.
I've found those issues, but it might be related to a work in progress:
a) ticket 1301
manual tests is not working for me
b) two strikes required to move
// Do nothing if the plugin is disabled. | ||
// if ( !this.isEnabled ) { | ||
// return; | ||
// } |
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.
Another lef-over. This one makes me think if we need to enable/disable this plugin. On the first thought I think not - as this is purely navigational plugin but I don't have a strong opinion 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 think so as well, but I'd like to do that in the next PR, to limit functional changes in this one.
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.
Comment removed.
} | ||
export default TwoStepCaretMovement; |
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.
We tend to keep it together with class
declaration.
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.
But then you do not have the named export, which is usually my personal preference, but if the convention is to always use default imports, then, I'll change 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.
The convention is:
export default class TwoStepCareMovement { ... }
not the named export.
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.
addressed
Co-authored-by: Maciej <jodator@jodator.net>
I'd cover it in the next PR, this one is only to refactor, without changing functionality, except making it a plugin.
Checking...
That's 0., isn't it? If so, I'll cover that in the next PR |
Co-authored-by: Maciej <jodator@jodator.net>
I reproduced a) |
The changelog generator will handle only the first listed package in the scoped BC. |
Suggested merge commit message (convention)
Other (engine, typing): The engine's util
bindTwoStepCaretToAttribute
is now typing's plugin TwoStepCaretMovement . Closes #7444.MINOR BREAKING CHANGE (engine, typing): Package and API for
bindTwoStepCaretToAttribute(…)
changed toeditor.plugins.get( TwoStepCaretMovement ).registerAttribute( 'a' )
Additional information
I'd also move highlighting code a part of this plugin (currently hard-coded in
Link
), but I'd do that in a separate PR, for an easier review.I will add more tests for multi-attribute scenarios, in a PR that adds 2SCM to the
Code
plugin.I was thinking about adding the
unregisterAttribute
method for cleanup and scenarios when somebody would like to disable 2SCM forLink
. Alternatively, we could make a more breaking change and disable 2SCM for Link and require setting it up in config, by just adding 2SCM plugin explicitly.