mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
Upgrade Ember to 2.13
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user