Topic-timeline api.decorateWidget call has stopped working

Hey friends!

I can’t pinpoint exactly when, but somewhere this year the following code has stopped working. It’s not throwing any errors, just doesn’t do anything anymore - I suspect this might be related to this change, but I’m not sure.

var bHTML = (some html);

api.decorateWidget('topic-timeline-container:before', helper => {
    return helper.h('div.side-block', [
    	helper.rawHtml(bHTML),
    ]);
});

Any ideas how I can fix this?

3 Likes

The timeline has been updated to use regular Ember/Glimmer components rather than our custom ‘widget’ system, so I’m afraid decorateWidget won’t work there any more.

Instead, you’ll need to use a Plugin Outlet. Right now we have these two:

But if they don’t work for your use case please let us know and we’re happy to look at introducing new ones.

6 Likes

I sorta got this to work, but I couldn’t find a way to insert any data from within a Theme Component. Is that still only possible from theme JS?

What do you mean by insert data?

There should be no difference between TC JS and a Theme.

1 Like

I spoke too soon and I need some more help with this. I added the following code in the HEAD section of a Theme Component:

<script type='text/x-handlebars' data-template-name='/connectors/timeline-controls-before/adnet'>
    <div class="side-block">
        <div id="supporters"></div>
    </div>
</script>

While this renders for me, the admin, it doesn’t display for regular users. Any idea why?

Looks like that outlet is only rendered when the ‘timeline controls’ are visible

Perhaps we should introduce another outlet before that {{#if. What do you think @isaac @featheredtoast

3 Likes

Can confirm, this would be nice available outside {{#if :+1:t2:

2 Likes