chore: Shows articles in dark mode for widget (#8115)
This commit is contained in:
committed by
GitHub
parent
b28721e10b
commit
28db18ebbd
@@ -60,10 +60,10 @@ export const InitializationHelpers = {
|
|||||||
appendPlainParamToURLs: () => {
|
appendPlainParamToURLs: () => {
|
||||||
document.getElementsByTagName('a').forEach(aTagElement => {
|
document.getElementsByTagName('a').forEach(aTagElement => {
|
||||||
if (aTagElement.href && aTagElement.href.includes('/hc/')) {
|
if (aTagElement.href && aTagElement.href.includes('/hc/')) {
|
||||||
aTagElement.setAttribute(
|
const url = new URL(aTagElement.href);
|
||||||
'href',
|
url.searchParams.set('show_plain_layout', 'true');
|
||||||
aTagElement.href + '?show_plain_layout=true'
|
|
||||||
);
|
aTagElement.setAttribute('href', url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import ArticleHero from 'widget/components/ArticleHero.vue';
|
|||||||
import ArticleCardSkeletonLoader from 'widget/components/ArticleCardSkeletonLoader.vue';
|
import ArticleCardSkeletonLoader from 'widget/components/ArticleCardSkeletonLoader.vue';
|
||||||
|
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import darkModeMixin from 'widget/mixins/darkModeMixin';
|
||||||
import routerMixin from 'widget/mixins/routerMixin';
|
import routerMixin from 'widget/mixins/routerMixin';
|
||||||
import configMixin from 'widget/mixins/configMixin';
|
import configMixin from 'widget/mixins/configMixin';
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ export default {
|
|||||||
TeamAvailability,
|
TeamAvailability,
|
||||||
ArticleCardSkeletonLoader,
|
ArticleCardSkeletonLoader,
|
||||||
},
|
},
|
||||||
mixins: [configMixin, routerMixin],
|
mixins: [configMixin, routerMixin, darkModeMixin],
|
||||||
props: {
|
props: {
|
||||||
hasFetched: {
|
hasFetched: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -113,9 +114,14 @@ export default {
|
|||||||
return this.replaceRoute('messages');
|
return this.replaceRoute('messages');
|
||||||
},
|
},
|
||||||
openArticleInArticleViewer(link) {
|
openArticleInArticleViewer(link) {
|
||||||
|
let linkToOpen = `${link}?show_plain_layout=true`;
|
||||||
|
const isDark = this.prefersDarkMode;
|
||||||
|
if (isDark) {
|
||||||
|
linkToOpen = `${linkToOpen}&theme=dark`;
|
||||||
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'article-viewer',
|
name: 'article-viewer',
|
||||||
params: { link: `${link}?show_plain_layout=true` },
|
params: { link: linkToOpen },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
viewAllArticles() {
|
viewAllArticles() {
|
||||||
|
|||||||
Reference in New Issue
Block a user