Upgrade Ember to 2.13

This commit is contained in:
Robin Ward
2017-06-13 15:52:08 -04:00
parent ac1f84d3e1
commit 8ae445766f
11 changed files with 52 additions and 22 deletions

View File

@ -22,7 +22,7 @@ import { attachAdditionalPanel } from 'discourse/widgets/header';
// If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = '0.8.6';
const PLUGIN_API_VERSION = '0.8.7';
class PluginApi {
constructor(version, container) {
@ -39,6 +39,25 @@ class PluginApi {
return this.container.lookup('current-user:main');
}
/**
* Allows you to overwrite or extend methods in a class.
*
* For example:
*
* ```
* api.modifyClass('controller:composer', {
* actions: {
* newActionHere() { }
* }
* });
* ```
**/
modifyClass(resolverName, changes) {
const klass = this.container.factoryFor(resolverName);
klass.class.reopen(changes);
return klass;
}
/**
* Used for decorating the `cooked` content of a post after it is rendered using
* jQuery.
@ -61,7 +80,7 @@ class PluginApi {
if (!opts.onlyStream) {
decorate(ComposerEditor, 'previewRefreshed', callback);
decorate(this.container.lookupFactory('component:user-stream'), 'didInsertElement', callback);
decorate(this.container.factoryFor('component:user-stream').class, 'didInsertElement', callback);
}
}
@ -170,7 +189,7 @@ class PluginApi {
* ```
**/
attachWidgetAction(widget, actionName, fn) {
const widgetClass = this.container.lookupFactory(`widget:${widget}`);
const widgetClass = this.container.factoryFor(`widget:${widget}`).class;
widgetClass.prototype[actionName] = fn;
}