Skip to content

Commit c42aee6

Browse files
authored
Merge pull request #5 from ladadeedee/master
Allow select when clicking outside of node text
2 parents a37602c + 4101a13 commit c42aee6

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

addon/components/x-tree-node.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ export default Component.extend({
1010
return this.get('model.id') === this.get('chosenId');
1111
}),
1212

13+
click() {
14+
let select = this.get('select');
15+
if (select) {
16+
select(this.get('model'));
17+
}
18+
},
19+
1320
mouseEnter() {
1421
this.set('model.isSelected', true);
1522
let hover = this.get('hover');
@@ -32,12 +39,6 @@ export default Component.extend({
3239

3340
toggleExpand() {
3441
this.toggleProperty('model.isExpanded');
35-
},
36-
select() {
37-
let select = this.get('select');
38-
if (select) {
39-
select(this.get('model'));
40-
}
4142
}
4243
}
4344
});

addon/templates/components/x-tree-node.hbs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
{{/if}}
1616

1717
{{#if hasBlock}}
18-
<span onclick={{action 'select'}}>
19-
{{yield model}}
20-
</span>
18+
{{yield model}}
2119
{{else}}
22-
<span onclick={{action 'select'}}>
23-
{{model.name}}
24-
</span>
20+
{{model.name}}
2521
{{/if}}

0 commit comments

Comments
 (0)