DEV: Allow RenderGlimmer to be used inside post-cooked-glued widgets (#26675)
In this case, the top-level widget being glued must have a `_postCookedWidget` attribute.
This commit is contained in:
parent
bfd6a7b86c
commit
5c2ac4fe88
|
@ -178,7 +178,21 @@ export default class RenderGlimmer {
|
|||
}
|
||||
|
||||
get parentMountWidgetComponent() {
|
||||
return this.widget?._findView() || this._emberView;
|
||||
if (this._emberView) {
|
||||
return this._emberView;
|
||||
}
|
||||
// Work up parent widgets until we find one with a _emberView
|
||||
// attribute. `.parentWidget` is the normal way to work up the tree,
|
||||
// but we use `attrs._postCookedWidget` to handle the special case
|
||||
// of widgets rendered inside post-cooked.
|
||||
let widget = this.widget;
|
||||
while (widget) {
|
||||
const component = widget._emberView;
|
||||
if (component) {
|
||||
return component;
|
||||
}
|
||||
widget = widget.parentWidget || widget.attrs._postCookedWidget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ function initializePolls(api) {
|
|||
groupableUserFields: (pollGroupableUserFields || "")
|
||||
.split("|")
|
||||
.filter(Boolean),
|
||||
_postCookedWidget: helper.widget,
|
||||
};
|
||||
const glue = new WidgetGlue("discourse-poll", register, attrs);
|
||||
glue.appendTo(pollNode);
|
||||
|
|
Loading…
Reference in New Issue