2017-03-02 19:51:57 +03:00
|
|
|
import Component from 'ember-component';
|
2017-03-01 22:23:03 +03:00
|
|
|
import layout from '../templates/components/koenig-toolbar-button';
|
2017-02-27 07:44:15 +03:00
|
|
|
|
2017-03-02 19:51:57 +03:00
|
|
|
export default Component.extend({
|
2017-02-27 07:44:15 +03:00
|
|
|
layout,
|
2017-02-27 15:05:31 +03:00
|
|
|
tagName: 'button',
|
|
|
|
classNameBindings: ['selected', 'primary', 'secondary',
|
|
|
|
'gh-toolbar-btn-bold', 'gh-toolbar-btn-italic', 'gh-toolbar-btn-strike', 'gh-toolbar-btn-link', 'gh-toolbar-btn-h1', 'gh-toolbar-btn-h2', 'gh-toolbar-btn-quote'],
|
|
|
|
classNames: ['gh-toolbar-btn'],
|
|
|
|
attributesBindings: ['title'],
|
|
|
|
title: 'bold',
|
2017-03-02 19:51:57 +03:00
|
|
|
|
2017-02-27 15:05:31 +03:00
|
|
|
// todo title="Bold", https://github.com/TryGhost/Ghost-Editor/commit/1133a9a7506f409b1b4fae6639c84c94c74dcebf
|
2017-03-02 19:51:57 +03:00
|
|
|
// actions: {
|
|
|
|
click() {
|
|
|
|
this.tool.onClick(this.editor);
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
//
|
|
|
|
willRender() {
|
|
|
|
this.set(`gh-toolbar-btn-${this.tool.class}`, true);
|
|
|
|
if (this.tool.selected) {
|
2017-02-27 07:44:15 +03:00
|
|
|
this.set('selected', true);
|
|
|
|
} else {
|
|
|
|
this.set('selected', false);
|
|
|
|
}
|
|
|
|
|
2017-03-02 19:51:57 +03:00
|
|
|
if (this.tool.visibility) {
|
|
|
|
this.set(this.tool.visibility, true);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|