From 5074987544583f606cc16e76976f148169fa3d2f Mon Sep 17 00:00:00 2001 From: Bowrna Date: Sun, 13 Oct 2024 16:58:48 +0530 Subject: [PATCH] Add Markdown syntax highlighting (#2068) Closes #2058. Co-authored-by: Kailash Nadh --- frontend/package.json | 1 + frontend/src/assets/style.scss | 2 +- frontend/src/components/Editor.vue | 9 ++- frontend/src/components/MarkdownEditor.vue | 79 ++++++++++++++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/MarkdownEditor.vue diff --git a/frontend/package.json b/frontend/package.json index de3abd7c..d24959ea 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -18,6 +18,7 @@ "codeflask": "^1.4.1", "dayjs": "^1.11.10", "indent.js": "^0.3.5", + "prismjs":"^1.29.0", "qs": "^6.10.1", "textversionjs": "^1.1.3", "tinymce": "^5.10.9", diff --git a/frontend/src/assets/style.scss b/frontend/src/assets/style.scss index c52afdfb..1b8c82a6 100644 --- a/frontend/src/assets/style.scss +++ b/frontend/src/assets/style.scss @@ -243,7 +243,7 @@ body.is-noscroll { } /* WYSIWYG / HTML code editor */ -.html-editor { +.html-editor, .markdown-editor { position: relative; width: 100%; min-height: 250px; diff --git a/frontend/src/components/Editor.vue b/frontend/src/components/Editor.vue index c9c35f52..56506647 100644 --- a/frontend/src/components/Editor.vue +++ b/frontend/src/components/Editor.vue @@ -80,8 +80,11 @@ - - + + + + @@ -136,6 +139,7 @@ import { colors, uris } from '../constants'; import Media from '../views/Media.vue'; import CampaignPreview from './CampaignPreview.vue'; import HTMLEditor from './HTMLEditor.vue'; +import MarkdownEditor from './MarkdownEditor.vue'; const turndown = new TurndownService(); @@ -158,6 +162,7 @@ export default { Media, CampaignPreview, 'html-editor': HTMLEditor, + 'markdown-editor': MarkdownEditor, TinyMce, }, diff --git a/frontend/src/components/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor.vue new file mode 100644 index 00000000..ea38ae5a --- /dev/null +++ b/frontend/src/components/MarkdownEditor.vue @@ -0,0 +1,79 @@ + + +