2016-05-07 07:23:48 +08:00
|
|
|
/* eslint global-require: 0 */
|
2017-09-27 02:42:18 +08:00
|
|
|
import { PreferencesUIStore, ComponentRegistry, ExtensionRegistry } from 'mailspring-exports';
|
2015-11-12 04:49:48 +08:00
|
|
|
import TemplatePicker from './template-picker';
|
|
|
|
import TemplateStatusBar from './template-status-bar';
|
2015-12-05 14:09:25 +08:00
|
|
|
import TemplateComposerExtension from './template-composer-extension';
|
2015-11-12 04:49:48 +08:00
|
|
|
|
2016-03-01 10:47:22 +08:00
|
|
|
export function activate(state = {}) {
|
|
|
|
this.state = state;
|
|
|
|
this.preferencesTab = new PreferencesUIStore.TabItem({
|
|
|
|
tabId: 'Quick Replies',
|
|
|
|
displayName: 'Quick Replies',
|
2017-09-05 13:42:08 +08:00
|
|
|
componentClassFn: () => require('./preferences-templates').default,
|
2016-03-01 10:47:22 +08:00
|
|
|
});
|
2017-09-27 02:33:08 +08:00
|
|
|
ComponentRegistry.register(TemplatePicker, { role: 'Composer:ActionButton' });
|
|
|
|
ComponentRegistry.register(TemplateStatusBar, { role: 'Composer:Footer' });
|
2016-03-01 10:47:22 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(this.preferencesTab);
|
|
|
|
ExtensionRegistry.Composer.register(TemplateComposerExtension);
|
|
|
|
}
|
2015-11-12 04:49:48 +08:00
|
|
|
|
2016-03-01 10:47:22 +08:00
|
|
|
export function deactivate() {
|
|
|
|
ComponentRegistry.unregister(TemplatePicker);
|
|
|
|
ComponentRegistry.unregister(TemplateStatusBar);
|
|
|
|
PreferencesUIStore.unregisterPreferencesTab(this.preferencesTab.tabId);
|
|
|
|
ExtensionRegistry.Composer.unregister(TemplateComposerExtension);
|
|
|
|
}
|
2015-11-12 04:49:48 +08:00
|
|
|
|
2016-03-01 10:47:22 +08:00
|
|
|
export function serialize() {
|
|
|
|
return this.state;
|
|
|
|
}
|