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

Fix triple click issue in paragraph with widget #15011

Merged

Conversation

illia-stv
Copy link
Contributor

@illia-stv illia-stv commented Sep 15, 2023

Suggested merge commit message (convention)

Fix (widget): Triple click on paragraph with widget should select the whole paragraph. Closes #11130.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@illia-stv illia-stv self-assigned this Sep 15, 2023
Copy link
Member

@filipsobol filipsobol left a comment

Choose a reason for hiding this comment

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

The above comment is nitpicky and optional. I'd like to see it included, but I'm fine with PR as is.

Copy link
Contributor

@niegowski niegowski left a comment

Choose a reason for hiding this comment

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

Triple click on an image:
Screenshot 2023-09-20 at 13 45 25

packages/ckeditor5-widget/src/widget.ts Outdated Show resolved Hide resolved
Comment on lines 219 to 221
if ( domEventData.domEvent.detail >= 3 ) {
setSelectionInAncestorElement();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should narrow it to just affected cases with widgets? This looks like first we check if in nested editable on FF or Safari and then we do it everywhere.

Comment on lines 220 to 227
// If triple click should select entire paragraph.
if ( parentElement &&
parentElement.is( 'element' ) &&
!isWidget( parentElement ) &&
domEventData.domEvent.detail >= 3
) {
this._setSelectionInAncestorElement( element, domEventData );
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are checking the parent element? I'm not sure what this condition is checking.

/**
* Selects entire block content, e.g. on triple click it selects entire paragraph.
*/
private _selectBlockContent( element: ViewElement ): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

This code could be simpler, we could use some existing helper methods. Let's talk about it f2f.

@niegowski niegowski merged commit beb4c80 into master Oct 5, 2023
6 checks passed
@niegowski niegowski deleted the ck/11130-not-able-to-select-whole-paragraph-with-triple-click branch October 5, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not able to select whole paragraph with triple click when there is a table right after it
4 participants