mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 23:32:44 +08:00
![]() Eventually, this new component will be used everywhere that we render 'decorated' HTML (e.g. all posts and chat messages). It takes the best bits from our main widget-based post rendering and re-creates it in a more ember-native way. For example: - The HTML is first rendered in a detached DOM, so that requests for images/iframes/etc. are not triggered until after the decoration - HTML generation and decoration is done in a helper (i.e. during the 'render' phase of the runloop). I think that's the 'most Ember compatible' way for us to do this. It means that components added via `renderGlimmer` will be rendered in the same runloop, and it means that things like `schedule("afterRender")` will work exactly as expected. - HTML will be re-rendered and re-decorated whenever the `@html` or `@decorate` arguments change - BUT, `untrack` is used to ensure that reactive state accessed inside the decorate function will not trigger a re-render. This is mostly for compatibility with existing decorators, and we may want to make reactivity opt-in in future - A self-contained `renderGlimmer` system is included. This will allow `helper.renderGlimmer` to be used for any content in these components. Implementing it in a self-contained way rather than using the service means that the component will work ok in unit tests, and that rendered components will show up in the right place in the Ember inspector. This commit only introduces the new component in DiscourseBanner. Followups will introduce it elsewhere. |
||
---|---|---|
.. | ||
discourse/initializers | ||
lib/discourse-markdown |