From 7714815396b4e86afc5db1af3726fab4edf0ca35 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Sat, 3 Jul 2021 23:07:09 +0200 Subject: viewer: add markdown rendering component Extracted from b170f49 (GH PR #304) --- viewer/src/components/async/Markdown.vue | 123 +++++++++++++++++++++++++++++++ viewer/src/components/async/index.ts | 4 + viewer/src/main.ts | 9 +-- viewer/src/plugins/index.ts | 8 ++ viewer/src/services/fetchWithCheck.ts | 7 ++ 5 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 viewer/src/components/async/Markdown.vue create mode 100644 viewer/src/components/async/index.ts create mode 100644 viewer/src/plugins/index.ts create mode 100644 viewer/src/services/fetchWithCheck.ts (limited to 'viewer/src') diff --git a/viewer/src/components/async/Markdown.vue b/viewer/src/components/async/Markdown.vue new file mode 100644 index 0000000..c4e282b --- /dev/null +++ b/viewer/src/components/async/Markdown.vue @@ -0,0 +1,123 @@ + + + + + + + diff --git a/viewer/src/components/async/index.ts b/viewer/src/components/async/index.ts new file mode 100644 index 0000000..5a7d9a6 --- /dev/null +++ b/viewer/src/components/async/index.ts @@ -0,0 +1,4 @@ +// Declare async constants for internal components +// Their name can't start with 'Ld' + +export const Markdown = () => import(/* webpackChunkName: "markdown" */ "./Markdown.vue"); diff --git a/viewer/src/main.ts b/viewer/src/main.ts index cccb37b..d0ee3af 100644 --- a/viewer/src/main.ts +++ b/viewer/src/main.ts @@ -20,18 +20,13 @@ import "@/assets/scss/global.scss"; import "@/assets/scss/scrollbar.scss"; import "@/assets/scss/transition.scss"; +import { MainLayout } from "@/plugins"; import i18n from "@/plugins/i18n"; import router from "@/plugins/router"; import store from "@/store"; import Vue from "vue"; -Vue.config.productionTip = false; -import(/* webpackChunkName: "ui" */ "@/plugins/buefy"); -import(/* webpackChunkName: "ui" */ "@/components"); -import(/* webpackChunkName: "ui" */ "@/plugins/lazyimage"); -import(/* webpackChunkName: "ui" */ "@/plugins/dragscroll"); -import(/* webpackChunkName: "ui" */ "@/plugins/fontawesome"); -const MainLayout = () => import(/* webpackChunkName: "ui" */ "@/views/MainLayout.vue"); +Vue.config.productionTip = false; declare module "vue/types/vue" { interface Vue { diff --git a/viewer/src/plugins/index.ts b/viewer/src/plugins/index.ts new file mode 100644 index 0000000..1555882 --- /dev/null +++ b/viewer/src/plugins/index.ts @@ -0,0 +1,8 @@ +export const MainLayout = () => + Promise.all([ + import(/* webpackChunkName: "ui" */ "@/plugins/buefy"), + import(/* webpackChunkName: "ui" */ "@/components"), + import(/* webpackChunkName: "ui" */ "@/plugins/lazyimage"), + import(/* webpackChunkName: "ui" */ "@/plugins/dragscroll"), + import(/* webpackChunkName: "ui" */ "@/plugins/fontawesome"), + ]).then(() => import(/* webpackChunkName: "ui" */ "@/views/MainLayout.vue")); diff --git a/viewer/src/services/fetchWithCheck.ts b/viewer/src/services/fetchWithCheck.ts new file mode 100644 index 0000000..e84e8b6 --- /dev/null +++ b/viewer/src/services/fetchWithCheck.ts @@ -0,0 +1,7 @@ +export default class FetchWithCheck { + static async get(url: RequestInfo): Promise { + const response = await fetch(url); + if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`); + return response; + } +} -- cgit v1.2.3 From 9328223589fac14327223eb38c988cb32b781cbd Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Sat, 3 Jul 2021 23:07:09 +0200 Subject: viewer/LdInformation: use markdown rendering component Extracted from b170f49 (GH PR #304) --- viewer/src/components/LdInformation.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'viewer/src') diff --git a/viewer/src/components/LdInformation.vue b/viewer/src/components/LdInformation.vue index b161485..68e1817 100644 --- a/viewer/src/components/LdInformation.vue +++ b/viewer/src/components/LdInformation.vue @@ -21,16 +21,20 @@
{{ item.title }}
-
+
-- cgit v1.2.3