Skip to content

Clear highlights and pointer on BlockManager even if selection was inside of the editor before clicking outside#2644

Open
VikhorKonstantin wants to merge 3 commits intocodex-team:nextfrom
VikhorKonstantin:fix/issue#2643_clearCurrentBlockOnLeavingEditor
Open

Clear highlights and pointer on BlockManager even if selection was inside of the editor before clicking outside#2644
VikhorKonstantin wants to merge 3 commits intocodex-team:nextfrom
VikhorKonstantin:fix/issue#2643_clearCurrentBlockOnLeavingEditor

Conversation

@VikhorKonstantin
Copy link
Copy Markdown
Contributor

Fix: #2643

Clear highlights and pointer on BlockManager even if selection was inside of the editor before clicking outside

* Do not fire check on clicks at the Inline Toolbar buttons
*/
const target = event.target as HTMLElement;
const clickedInsideOfEditor = this.nodes.holder.contains(target) || Selection.isAtEditor;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can't remember why it was added. Anyway, I've tested it and it looks like everything is ok. So please add a test (at the Ui.cy.ts) and a change log

Copy link
Copy Markdown
Contributor Author

@VikhorKonstantin VikhorKonstantin Mar 1, 2024

Choose a reason for hiding this comment

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

@neSpecc, I just tried to write some tests and encountered an issue with the ui.ts:documentClicked function:
image
It appears that this check causes clicks made by Cypress click() to behave differently from user-generated clicks (because Cypress-generated clicks will always have isTrusted == false). I'm concerned that this might break other tests as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@neSpecc, I've commented this out with an explanation in a comment. Seems like we're not triggering Click events anywhere in the code so it shouldn't break anything.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've found a bug with Block Tunes pressing by Enter. It sometimes removes the block itself (like Enter pressed when block is selected). It can be reproduces in the next so I'm gonna dig in it soon.

They can be related

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @VikhorKonstantin. I've resolved several problems with Enter press. Please, pull the next and check if the problem still actual

@VikhorKonstantin VikhorKonstantin requested a review from neSpecc March 1, 2024 12:54
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.

Bug: clicking outside of an editor should clear currentBlock (call dropPointer) even if selection was inside of editor before the click

2 participants