Skip to content

Issue with absence of buttons #29

Description

@antoniobrandao

Hello,

I got an error coming up every time I clicked a editable field which is configured to have no buttons.

The error was as follows:
Uncaught TypeError: Cannot read property 'length' of undefined - etch.js:76

To reproduce it I did:

1 - Click an editable field which has some buttons
2 - Click an editable field configured to have no buttons

The erroneous line is 76:
// hide editor panel if there are no buttons in it and exit early
if (!buttons.length) { $(this.el).hide(); return; }

Because there are no buttons in this field, "buttons" is undefined therefore we can't check it's "length". A prior check for the existence of "buttons" is necessary.

I solved my problem locally by changing that line to:

// hide editor panel if there are no buttons in it and exit early
if (buttons === undefined) { $(this.el).hide(); return; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions