survivejs / react-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/react/introduction/
2.02k stars 366 forks source link

Editable component onClick not bound #352

Closed aldon-cmd closed 8 years ago

aldon-cmd commented 8 years ago

http://survivejs.com/webpack_react/from_notes_to_kanban/#connecting-lane-with-editable- there is no onclick event bound to the Editable component in this section like the sentence at the end of it suggests

this calls activateLaneEdit()

<Editable className="lane-name" editing={lane.editing}
value={lane.name} onEdit={this.editName} />

  editName(id, e, name) {
    console.log(`edit lane ${id} name using ${name}`);
  }

this calls editName()

<Editable className="lane-name" onClick={this.editName} editing={lane.editing}
value={lane.name} onEdit={this.editName} />

  editName(id, e, name) {
    e.stopPropagation();
    console.log(`edit lane ${id} name using ${name}`);
  }

e.stopPropagation(); needs to be called inside editName() else activateLaneEdit() will also be called

bebraw commented 8 years ago

Thanks for the report! I'll get that sorted out.

The dev version of the chapter has received a few tweaks but it's quite possible this one is missing.

aldon-cmd commented 8 years ago

if you fix it in the way that i have it above, the following sections will break. you may have to find another way to fix it