Skip to content

Add onBlur event#1224

Closed
hata6502 wants to merge 3 commits into
codex-team:nextfrom
impact-blue:feature/add-onblur-event
Closed

Add onBlur event#1224
hata6502 wants to merge 3 commits into
codex-team:nextfrom
impact-blue:feature/add-onblur-event

Conversation

@hata6502

@hata6502 hata6502 commented Jul 7, 2020

Copy link
Copy Markdown
Contributor

@hata6502 hata6502 force-pushed the feature/add-onblur-event branch from e4ed11f to 4caa01b Compare July 7, 2020 07:40
@hata6502 hata6502 marked this pull request as ready for review July 7, 2020 07:43
@gohabereg gohabereg changed the base branch from master to next July 26, 2020 15:55
@hata6502 hata6502 mentioned this pull request Aug 13, 2020
@hata6502 hata6502 changed the title Feature/add onblur event Add onBlur event Aug 24, 2020
@neSpecc

neSpecc commented Aug 26, 2020

Copy link
Copy Markdown
Member

The onBlur does not resolve the attached issue, because the content of the editor can be modified not only through the typing from the keyboard. All other changes like blocks moving, changing block tunes, and others won't fire the onBlur event. It means that you can't use it for triggering a saving.

I'll close the PR for now. If someone will have a use-case for the onBlur callback, please raise the issue describing your case. Maybe we will reopen this PR later.

@neSpecc neSpecc closed this Aug 26, 2020
@neSpecc neSpecc mentioned this pull request Aug 26, 2020
@hata6502 hata6502 mentioned this pull request Oct 10, 2020
@tom2strobl

Copy link
Copy Markdown

@neSpecc While I agree with you that it doesn't solve the issues some people might believe it would, it still gives power to the people. In my case in a react scenario I re-initialize the editor when I have new data from the server. If I use onChange (even debounced) as soon as a successful write happens my user loses editor focus because the editor is re-rendered. Which is fine if blocks were moved, but sucks when, well, when the editor is focused. If the debounce is too short I could be interrupted even mid sentence, if its too long I risk navigational side effects.

If I knew that the editor is focused/blurred, I can write React logic to not re-initialize the editor until the editor is blurred and things would be solved rather cleanly without the use of a dedicated save button.

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.

3 participants