ktquez / vue-disqus

Integrate Disqus count and comments in your application Vue 3, with support for SPA
https://ktquez.github.io/vue-disqus/
MIT License
253 stars 26 forks source link

Prop for light/dark color scheme #39

Closed mzhukovs closed 4 years ago

mzhukovs commented 4 years ago

Thanks for this library.

I have an app that has a theme switcher for user to pick between light and dark mode.

Looks like in admin settings in Disqus one can select auto or pick a light or dark based Disqus view. Wondering if it possible to update the library with a prop for this such that we could update on app dynamically. Would be an awesome feature.

ktquez commented 4 years ago

You read my mind.

I'm also going through this using @vue-a11y/dark-mode on my blog.

I will update yes, thanks for the suggestion.

As soon as I release an updated version, I'll let you know here.

ktquez commented 4 years ago

@mzhukovs

VueDisqus v4 released!

I exposed a method to reset the embed, so you can run this.$disqus.reset() when there is a change in the theme of the app.

To learn more you can access the reset documentation.

Thanks for using!

mzhukovs commented 4 years ago

@ktquez this appears to be working only if the reset is triggered away from the page? Meaning, if we are on a page that has the Disqus component and we change the theme to dark and call reset(), it won't work. Are you seeing the same thing?

update: was able to get it to work as desired by delaying for 1 second:

setTimeout(this.$disqus.reset, 1000);

ktquez commented 4 years ago

Can you reproduce this online?


In my app, I needed to do this:

if (this.$disqus.reset) this.$disqus.reset()

Due to the lazy load, it may be that the disqus is not yet loaded on the page, I check if the reset method has already been registered.