DiscoTOC - automatic table of contents

interesting. the link from within your forum seems to have the anchor stripped from it.

I checked on my site and have repro.

1 Like

Interesting - just updated today and getting this scary warning across the top. But the site seems to be fine so far.

:warning: Your site may not work because theme / component DiscoTOC has errors. Disable it at /admin/customize/themes.

Errors:

Message
DiscoTOC theme/component is throwing errors
Backtrace
Error: Could not find module ember-addons/ember-computed-decorators
    at https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:554211
    at require (https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:554249)
    at https://DISCOURSE/theme-javascripts/d829ea593b9ddad05ea983e6419ea86ee453ee60.js?__ws=DISCOURSE:21:24
    at e.withPluginApi (https://DISCOURSE/assets/application-5b495fcb7ef238c0b1efb890288628c6c2a88722f76a13aa45a533b7c0dda246.js:1:418956)
    at Object.initialize (https://DISCOURSE/assets/application-5b495fcb7ef238c0b1efb890288628c6c2a88722f76a13aa45a533b7c0dda246.js:1:205795)
    at https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:334072
    at i.each (https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:494808)
    at i.walk (https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:493827)
    at t.each (https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:493274)
    at t.topsort (https://DISCOURSE/assets/ember_jquery-7d202b640076468b0bd81a4231650174c1a75aec26f132bb7dc3dfad7985b6ff.js:1:493320)
Env
hostname	discourse-app
process_id	17610
application_version	6275c05c0de4da501bf9e5ba40a82280c79ec6a8
HTTP_HOST	DISCOURSE
REQUEST_URI	/logs/report_js_error
REQUEST_METHOD	POST
HTTP_USER_AGENT	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36
HTTP_ACCEPT	*/*
HTTP_REFERER	https://DISCOURSE/
HTTP_X_FORWARDED_FOR	73.239.176.161, 73.239.176.161
HTTP_X_REAL_IP	73.239.176.161
params	
message	DiscoTOC theme/component is throwing errors
stacktrace	Error: Could not find module ember-addons/ember-computed-decorators at https://DISCOURSE/
2 Likes

I think this is fixed in the latest commit 2hrs ago?

5 Likes

yep - that’s the likely culprit. I updated again and error went away.

Yes that fixed it. We changed some Ember stuff in core which threw this warning up if this component was in use. Updating the component fixes it.

6 Likes

I love the look and feel of this component and it works beautifully in Chrome, but in Safari it seems it still has the issues that were claimed to have been fixed (no jumping to the topics when a TOC items is clicked, no bolding of current topic etc)? I just installed the latest from the git repo or should I have a different fork/branch etc?

1 Like

Yes, the component is great, but it doesn’t work in some clients. For example, it also does not work on iphones (no jumping to items as you describe when the item is clicked). But, works great on androids. We’ve tried to debug this, but cannot figure it either why it works on some clients, but not others.

1 Like

:frowning: indeed, and given we’re using it 90% on Safari/WebKit I’m afraid that if it can’t be made to work I have to take it off again, which would be a shame because the concept is fantastic

1 Like

What I didn’t get was that an earlier post suggests that @Johani fixed things in version 0.2 for Safari, which makes we wonder whether things regressed again or whether Safari continues to change in a way that it broke again?

1 Like

I just pushed a fix for the Safari issue.

I’m pretty sure I tested it and saw no issue when v0.2 came out, but Safari required some hacks back then - even though the component follows web standards.

That said, I justed tested again on the latest Safari and there’s no need for the hacks anymore. So, I removed them. My guess is that the old hacks were preventing the component from functioning properly on Safari.

As for the rest of the issues reported here, thanks for those. I haven’t had the time to look at them, but will do so soon :+1:

9 Likes

Woot, thank you so much, saw Discourse reporting the update being available (just can’t get over how good discourse is, that alone is amazing). Works brilliantly! :clap:

Keep up the good work!

4 Likes

Is there any way to display a TOC only for posts within a topic created by the topic author?

No, this only works for the contents of the first post in a topic.