mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 19:29:51 +00:00
FIX: Couldn't modify a widget that wasn't in the registry
This commit is contained in:
parent
6d30be1f94
commit
6fec4982d9
@ -42,6 +42,7 @@ import { registerCustomPostMessageCallback as registerCustomPostMessageCallback1
|
||||
import Sharing from "discourse/lib/sharing";
|
||||
import { addComposerUploadHandler } from "discourse/components/composer-editor";
|
||||
import { addCategorySortCriteria } from "discourse/components/edit-category-settings";
|
||||
import { queryRegistry } from "discourse/widgets/widget";
|
||||
|
||||
// If you add any methods to the API ensure you bump up this number
|
||||
const PLUGIN_API_VERSION = "0.8.31";
|
||||
@ -325,7 +326,9 @@ class PluginApi {
|
||||
* ```
|
||||
**/
|
||||
attachWidgetAction(widget, actionName, fn) {
|
||||
const widgetClass = this.container.factoryFor(`widget:${widget}`).class;
|
||||
const widgetClass =
|
||||
queryRegistry(widget) ||
|
||||
this.container.factoryFor(`widget:${widget}`).class;
|
||||
widgetClass.prototype[actionName] = fn;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user