diff --git a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 index 49db0a298..3f1ec4b5f 100644 --- a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 +++ b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 @@ -23,7 +23,6 @@ class PluginApi { constructor(version, container) { this.version = version; this.container = container; - this._currentUser = container.lookup('current-user:main'); } diff --git a/app/assets/javascripts/discourse/widgets/decorator-helper.js.es6 b/app/assets/javascripts/discourse/widgets/decorator-helper.js.es6 index d1cbf4912..3448a660f 100644 --- a/app/assets/javascripts/discourse/widgets/decorator-helper.js.es6 +++ b/app/assets/javascripts/discourse/widgets/decorator-helper.js.es6 @@ -1,6 +1,7 @@ import Connector from 'discourse/widgets/connector'; import { h } from 'virtual-dom'; import PostCooked from 'discourse/widgets/post-cooked'; +import RawHtml from 'discourse/widgets/raw-html'; class DecoratorHelper { constructor(widget, attrs, state) { @@ -17,6 +18,10 @@ class DecoratorHelper { return this.widget.findAncestorModel(); } + rawHtml(html) { + return new RawHtml({ html }); + } + cooked(cooked) { return new PostCooked({ cooked }); } diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6 index 47e071d5b..e61b00ff7 100644 --- a/app/assets/javascripts/discourse/widgets/post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post.js.es6 @@ -1,5 +1,5 @@ import PostCooked from 'discourse/widgets/post-cooked'; -import { createWidget } from 'discourse/widgets/widget'; +import { createWidget, applyDecorators } from 'discourse/widgets/widget'; import { iconNode } from 'discourse/helpers/fa-icon'; import { transformBasicPost } from 'discourse/lib/transform-post'; import { h } from 'virtual-dom'; @@ -251,7 +251,8 @@ createWidget('post-contents', { }, html(attrs, state) { - const result = [new PostCooked(attrs, new DecoratorHelper(this))]; + let result = [new PostCooked(attrs, new DecoratorHelper(this))]; + result = result.concat(applyDecorators(this, 'after-cooked', attrs, state)); if (attrs.cooked_hidden) { result.push(this.attach('expand-hidden', attrs)); diff --git a/app/assets/javascripts/discourse/widgets/widget.js.es6 b/app/assets/javascripts/discourse/widgets/widget.js.es6 index 7176de339..f959c8fc7 100644 --- a/app/assets/javascripts/discourse/widgets/widget.js.es6 +++ b/app/assets/javascripts/discourse/widgets/widget.js.es6 @@ -22,7 +22,7 @@ export function decorateWidget(widgetName, cb) { _decorators[widgetName].push(cb); } -function applyDecorators(widget, type, attrs, state) { +export function applyDecorators(widget, type, attrs, state) { const decorators = _decorators[`${widget.name}:${type}`] || []; if (decorators.length) {