From 5890885475d700334cdb87f8a9966a0f8ea7fbd7 Mon Sep 17 00:00:00 2001 From: raizasafeel <89463672+raizasafeel@users.noreply.github.com> Date: Thu, 15 Jan 2026 14:49:04 +0530 Subject: [PATCH] fix(lesson): ensure markdown text is displayed when pasted --- frontend/src/utils/markdownParser.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/markdownParser.js b/frontend/src/utils/markdownParser.js index a5b10ae7..3fe7f0fa 100644 --- a/frontend/src/utils/markdownParser.js +++ b/frontend/src/utils/markdownParser.js @@ -34,7 +34,27 @@ export class Markdown { } static get pasteConfig() { - return { tags: ['P'] } + return { + tags: ['P'], + patterns: { plain: /^[\s\S]*$/ }, + } + } + + onPaste(event) { + const content = event.detail.data + let plainText = '' + + if (content instanceof HTMLElement) { + plainText = content.innerText || content.textContent + } else { + plainText = content + } + + this.text = plainText + + if (this.wrapper) { + this.wrapper.textContent = this.text + } } render() {