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

Prevent error when there's no activeElement during undo/redo #1359

Merged
merged 1 commit into from
Aug 13, 2018
Merged

Prevent error when there's no activeElement during undo/redo #1359

merged 1 commit into from
Aug 13, 2018

Conversation

nojacko
Copy link
Contributor

@nojacko nojacko commented Aug 13, 2018

Our errors logs picked up a lot of "Cannot read property 'activeElement' of null" errors so I put in a check.

I did spot the comment above the function:

    /**
     * Detects if some input is focused (input elements, text components, etc.)
     * Used internally, for example, to avoid undo/redo in text editing mode
     * @return {Boolean}
     */

The function only seems to return true is tag isn't BODY which doesn't match the comments. Is this correct?

@artf
Copy link
Member

artf commented Aug 13, 2018

Yes James, that was actually an intentional behaviour, if activeElement was different from Body, some editable component, inside the canvas, was selected. Actually I had other issues with this method and now I prefer to rely on em.isEditing, probably I'll replace it in Undo Manager in the next release and will see what to do with this method, for now I accept you PR as it's a good check in any way

@artf artf merged commit 1cac4b1 into GrapesJS:dev Aug 13, 2018
@lock
Copy link

lock bot commented Sep 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Sep 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants