FIX: also apply decorators to embedded posts
This commit is contained in:
parent
bbe642070e
commit
180c972b58
|
@ -1,4 +1,5 @@
|
||||||
import RawHtml from 'discourse/widgets/raw-html';
|
import PostCooked from 'discourse/widgets/post-cooked';
|
||||||
|
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon';
|
||||||
|
@ -35,7 +36,7 @@ export default createWidget('embedded-post', {
|
||||||
this.attach('poster-name', attrs),
|
this.attach('poster-name', attrs),
|
||||||
this.attach('post-link-arrow', { above: state.above, shareUrl: attrs.shareUrl })
|
this.attach('post-link-arrow', { above: state.above, shareUrl: attrs.shareUrl })
|
||||||
]),
|
]),
|
||||||
new RawHtml({html: `<div class='cooked'>${attrs.cooked}</div>`})
|
new PostCooked(attrs, new DecoratorHelper(this))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import PostCooked from 'discourse/widgets/post-cooked';
|
import PostCooked from 'discourse/widgets/post-cooked';
|
||||||
|
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
||||||
import { createWidget, applyDecorators } from 'discourse/widgets/widget';
|
import { createWidget, applyDecorators } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon';
|
||||||
import { transformBasicPost } from 'discourse/lib/transform-post';
|
import { transformBasicPost } from 'discourse/lib/transform-post';
|
||||||
|
@ -225,17 +226,6 @@ createWidget('expand-post-button', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
class DecoratorHelper {
|
|
||||||
constructor(widget) {
|
|
||||||
this.container = widget.container;
|
|
||||||
this._widget = widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
getModel() {
|
|
||||||
return this._widget.findAncestorModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
createWidget('post-contents', {
|
createWidget('post-contents', {
|
||||||
buildKey: attrs => `post-contents-${attrs.id}`,
|
buildKey: attrs => `post-contents-${attrs.id}`,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue