2015-12-03 13:28:13 +08:00
|
|
|
import {PreferencesUIStore, ComponentRegistry, DraftStore} from 'nylas-exports';
|
2015-11-12 04:49:48 +08:00
|
|
|
import TemplatePicker from './template-picker';
|
|
|
|
import TemplateStatusBar from './template-status-bar';
|
|
|
|
import Extension from './template-draft-extension';
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
item: null, // The DOM item the main React component renders into
|
|
|
|
|
|
|
|
activate(state = {}) {
|
|
|
|
this.state = state;
|
2015-12-03 13:28:13 +08:00
|
|
|
this.preferencesTab = new PreferencesUIStore.TabItem({
|
|
|
|
tabId: "Quick Replies",
|
|
|
|
displayName: "Quick Replies",
|
|
|
|
component: require("./preferences-templates"),
|
|
|
|
});
|
2015-11-12 04:49:48 +08:00
|
|
|
ComponentRegistry.register(TemplatePicker, {role: 'Composer:ActionButton'});
|
|
|
|
ComponentRegistry.register(TemplateStatusBar, {role: 'Composer:Footer'});
|
2015-12-03 13:28:13 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(this.preferencesTab);
|
2015-11-12 04:49:48 +08:00
|
|
|
return DraftStore.registerExtension(Extension);
|
|
|
|
},
|
|
|
|
|
|
|
|
deactivate() {
|
|
|
|
ComponentRegistry.unregister(TemplatePicker);
|
|
|
|
ComponentRegistry.unregister(TemplateStatusBar);
|
2015-12-03 13:28:13 +08:00
|
|
|
PreferencesUIStore.unregisterPreferencesTab(this.preferencesTab.sectionId);
|
2015-11-12 04:49:48 +08:00
|
|
|
return DraftStore.unregisterExtension(Extension);
|
|
|
|
},
|
|
|
|
|
|
|
|
serialize() { return this.state; },
|
|
|
|
};
|