From b9b19d8a2eaa3d53c56040eee0104068ab69dc2c Mon Sep 17 00:00:00 2001 From: Adeyemi Adetunji Date: Tue, 28 Oct 2025 11:59:21 +0100 Subject: [PATCH] feat: add search and replace to tinymce editor (#585) --- .../components/Lesson/Materials/components/Comments.svelte | 3 ++- apps/dashboard/src/lib/components/TextEditor/index.svelte | 3 ++- apps/dashboard/src/lib/utils/translations/da.json | 6 ++++-- apps/dashboard/src/lib/utils/translations/de.json | 3 ++- apps/dashboard/src/lib/utils/translations/en.json | 3 ++- apps/dashboard/src/lib/utils/translations/es.json | 3 ++- apps/dashboard/src/lib/utils/translations/fr.json | 3 ++- apps/dashboard/src/lib/utils/translations/hi.json | 3 ++- apps/dashboard/src/lib/utils/translations/pl.json | 3 ++- apps/dashboard/src/lib/utils/translations/pt.json | 3 ++- apps/dashboard/src/lib/utils/translations/ru.json | 3 ++- apps/dashboard/src/lib/utils/translations/vi.json | 3 ++- 12 files changed, 26 insertions(+), 13 deletions(-) diff --git a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/Comments.svelte b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/Comments.svelte index 57b14bea..74254c83 100644 --- a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/Comments.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/Comments.svelte @@ -83,6 +83,7 @@ isSaving = false; if (error) { console.error('Error adding comment:', error); + snackbar.error($t('course.navItem.lessons.comments.comment_error')); return; } @@ -352,7 +353,7 @@ /> {:else} -
+
{commentItem.comment}
{/if} diff --git a/apps/dashboard/src/lib/components/TextEditor/index.svelte b/apps/dashboard/src/lib/components/TextEditor/index.svelte index 35790854..08bb3502 100644 --- a/apps/dashboard/src/lib/components/TextEditor/index.svelte +++ b/apps/dashboard/src/lib/components/TextEditor/index.svelte @@ -26,7 +26,7 @@ // editor configuration let conf = { - plugins: 'lists, link, emoticons, code, media, eqneditor', + plugins: 'lists, link, emoticons, code, media, searchreplace, eqneditor', toolbar: [ { name: 'history', items: ['undo', 'redo'] }, { name: 'styles', items: ['styles'] }, @@ -38,6 +38,7 @@ { name: 'insert', items: ['emoticons'] }, { name: 'code', items: ['code'] }, { name: 'media', items: ['media'] }, + { name: 'search', items: ['searchreplace'] }, { name: 'eqneditor', items: ['eqneditor'] } ], lists_indent_on_tab: false, diff --git a/apps/dashboard/src/lib/utils/translations/da.json b/apps/dashboard/src/lib/utils/translations/da.json index 5eb5ec8a..c78bcb26 100644 --- a/apps/dashboard/src/lib/utils/translations/da.json +++ b/apps/dashboard/src/lib/utils/translations/da.json @@ -761,7 +761,8 @@ "placeholder": "Hvad synes du om denne lektion?", "comment_btn": "Kommentar", "cancel_btn": "Ophæve", - "load_more_btn": "Indlæs mere" + "load_more_btn": "Indlæs mere", + "comment_error": "Kunne ikke skrive kommentar. Prøv venligst igen." }, "exercises": { "heading": "Alle øvelser", @@ -1380,7 +1381,8 @@ "title_highlight": "Titelhøjlight", "subtitle": "Undertekst", "phone_number": "Telefonnummer", - "email": "E -mail" + "email": "E -mail", + "address": "Adresse" }, "faq": { "heading": "Ofte stillede spørgsmål", diff --git a/apps/dashboard/src/lib/utils/translations/de.json b/apps/dashboard/src/lib/utils/translations/de.json index 51242d55..15081ee6 100644 --- a/apps/dashboard/src/lib/utils/translations/de.json +++ b/apps/dashboard/src/lib/utils/translations/de.json @@ -584,7 +584,8 @@ "text_area_title": "Hinterlassen Sie einen Kommentar", "comment_btn": "Kommentar", "load_more_btn": "Mehr laden", - "cancel_btn": "Stornieren" + "cancel_btn": "Stornieren", + "comment_error": "Kommentar konnte nicht gepostet werden. Bitte versuchen Sie es erneut." }, "exercises": { "heading": "Alle Übungen", diff --git a/apps/dashboard/src/lib/utils/translations/en.json b/apps/dashboard/src/lib/utils/translations/en.json index 940715b6..b1432cf6 100644 --- a/apps/dashboard/src/lib/utils/translations/en.json +++ b/apps/dashboard/src/lib/utils/translations/en.json @@ -858,7 +858,8 @@ "placeholder": "What do you think about this lesson?", "comment_btn": "Comment", "cancel_btn": "Cancel", - "load_more_btn": "Load more" + "load_more_btn": "Load more", + "comment_error": "Failed to post comment. Please try again." }, "polls": { diff --git a/apps/dashboard/src/lib/utils/translations/es.json b/apps/dashboard/src/lib/utils/translations/es.json index 550c87ce..0132dc3a 100644 --- a/apps/dashboard/src/lib/utils/translations/es.json +++ b/apps/dashboard/src/lib/utils/translations/es.json @@ -584,7 +584,8 @@ "text_area_title": "Deja un comentario", "comment_btn": "Comentario", "load_more_btn": "Cargar más", - "cancel_btn": "Cancelar" + "cancel_btn": "Cancelar", + "comment_error": "No se pudo publicar el comentario. Por favor inténtalo de nuevo." }, "exercises": { "heading": "Todos los ejercicios", diff --git a/apps/dashboard/src/lib/utils/translations/fr.json b/apps/dashboard/src/lib/utils/translations/fr.json index e711acca..dd86f54f 100644 --- a/apps/dashboard/src/lib/utils/translations/fr.json +++ b/apps/dashboard/src/lib/utils/translations/fr.json @@ -584,7 +584,8 @@ "text_area_title": "Laisser un commentaire", "comment_btn": "Commentaire", "load_more_btn": "Charger plus", - "cancel_btn": "Annuler" + "cancel_btn": "Annuler", + "comment_error": "Échec de la publication du commentaire. Veuillez réessayer." }, "exercises": { "heading": "Tous les exercices", diff --git a/apps/dashboard/src/lib/utils/translations/hi.json b/apps/dashboard/src/lib/utils/translations/hi.json index e86b1b99..54f61de0 100644 --- a/apps/dashboard/src/lib/utils/translations/hi.json +++ b/apps/dashboard/src/lib/utils/translations/hi.json @@ -584,7 +584,8 @@ "text_area_title": "एक टिप्पणी छोड़ें", "comment_btn": "टिप्पणी", "load_more_btn": "और लोड करें", - "cancel_btn": "रद्द करना" + "cancel_btn": "रद्द करना", + "comment_error": "टिप्पणी पोस्ट करने में विफल. कृपया पुन: प्रयास करें।" }, "exercises": { "heading": "सभी व्यायाम", diff --git a/apps/dashboard/src/lib/utils/translations/pl.json b/apps/dashboard/src/lib/utils/translations/pl.json index 12d71c1a..d5d7452c 100644 --- a/apps/dashboard/src/lib/utils/translations/pl.json +++ b/apps/dashboard/src/lib/utils/translations/pl.json @@ -753,7 +753,8 @@ "placeholder": "Co sądzisz o tej lekcji?", "comment_btn": "Komentarz", "cancel_btn": "Anulować", - "load_more_btn": "Załaduj więcej" + "load_more_btn": "Załaduj więcej", + "comment_error": "Nie udało się opublikować komentarza. Spróbuj ponownie." }, "exercises": { "heading": "Wszystkie ćwiczenia", diff --git a/apps/dashboard/src/lib/utils/translations/pt.json b/apps/dashboard/src/lib/utils/translations/pt.json index 4feca1cf..d8fdad1b 100644 --- a/apps/dashboard/src/lib/utils/translations/pt.json +++ b/apps/dashboard/src/lib/utils/translations/pt.json @@ -584,7 +584,8 @@ "text_area_title": "Deixe um comentário", "comment_btn": "Comentário", "load_more_btn": "Carregar mais", - "cancel_btn": "Cancelar" + "cancel_btn": "Cancelar", + "comment_error": "Falha ao postar comentário. Por favor, tente novamente." }, "exercises": { "heading": "Todos os exercícios", diff --git a/apps/dashboard/src/lib/utils/translations/ru.json b/apps/dashboard/src/lib/utils/translations/ru.json index 99228eed..a9355ea3 100644 --- a/apps/dashboard/src/lib/utils/translations/ru.json +++ b/apps/dashboard/src/lib/utils/translations/ru.json @@ -584,7 +584,8 @@ "text_area_title": "Оставить комментарий", "comment_btn": "Комментарий", "load_more_btn": "Загрузить больше", - "cancel_btn": "Отмена" + "cancel_btn": "Отмена", + "comment_error": "Не удалось опубликовать комментарий. Пожалуйста, попробуйте еще раз." }, "exercises": { "heading": "Все упражнения", diff --git a/apps/dashboard/src/lib/utils/translations/vi.json b/apps/dashboard/src/lib/utils/translations/vi.json index d4850736..49b1370c 100644 --- a/apps/dashboard/src/lib/utils/translations/vi.json +++ b/apps/dashboard/src/lib/utils/translations/vi.json @@ -584,7 +584,8 @@ "text_area_title": "Để lại một bình luận", "comment_btn": "Bình luận", "load_more_btn": "Tải thêm", - "cancel_btn": "Hủy bỏ" + "cancel_btn": "Hủy bỏ", + "comment_error": "Không thể gửi bình luận. Vui lòng thử lại." }, "exercises": { "heading": "Tất cả các bài tập",