Skip to content

Commit 4dc1adf

Browse files
committed
fix(ui): fix TurndownService instantiation for announcement add/edit
1 parent 2798da5 commit 4dc1adf

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ui/admin/src/components/Announcement/AnnouncementEdit.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ const snackbar = useSnackbar();
8686
const showDialog = ref(false);
8787
const md = new MarkdownIt();
8888
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
89-
const { turndown } = new TurndownService() as {
90-
turndown: (input: string) => string;
91-
};
89+
const turndownService = new TurndownService() as { turndown: (input: string) => string };
9290
const tinyMceKey = computed(() => envVariables.tinyMceKey);
9391
const isTinyMceKeyEmpty = computed(() => tinyMceKey.value === "");
9492
const announcement = computed(() => announcementStore.announcement);
@@ -127,7 +125,7 @@ const onSubmit = async () => {
127125
}
128126
129127
try {
130-
const contentInMarkdown = turndown(contentInHtml.value);
128+
const contentInMarkdown = turndownService.turndown(contentInHtml.value);
131129
await announcementStore.updateAnnouncement(announcement.value.uuid, {
132130
title: title.value ?? "",
133131
content: contentInMarkdown,

ui/admin/src/views/NewAnnouncement.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const tinyMceKeyIsEmpty = computed(() => tinyMceKey.value === "");
8888
const announcement = ref("");
8989
const announcementError = ref(false);
9090
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
91-
const { turndown } = new TurndownService() as { turndown: (input: string) => string };
91+
const turndownService = new TurndownService() as { turndown: (input: string) => string };
9292
9393
watch(announcement, (val) => {
9494
if (val) announcementError.value = false;
@@ -107,7 +107,7 @@ const postAnnouncement = async () => {
107107
}
108108
109109
try {
110-
const contentInHtml = turndown(announcement.value);
110+
const contentInHtml = turndownService.turndown(announcement.value);
111111
await announcementStore.createAnnouncement({
112112
title: title.value,
113113
content: contentInHtml,

0 commit comments

Comments
 (0)