From 4de3dfdd8df282011c3cf1751a0c66f0b5fdc1e8 Mon Sep 17 00:00:00 2001 From: ydy0615 Date: Mon, 12 Jan 2026 13:23:55 +0800 Subject: [PATCH] feat(editor): enhance markdown editor with contenteditable interface and modals - Replace textarea with contenteditable div for WYSIWYG-like editing experience - Add code block editing modal for inline code editing functionality - Add image preview modal for zoom functionality on clicked images - Implement keyboard shortcuts (Ctrl+1-6 for headings, Ctrl+B bold, Ctrl+I italic, Ctrl+K links) - Improve syntax highlighting with Prism.js integration and language detection - Add debounced rendering to optimize performance during typing - Enhance styling with hover effects and improved code block indicators --- src/App.vue | 30 +- src/components/MarkdownEditor.vue | 536 +++++++++++++++++++++++++----- 2 files changed, 484 insertions(+), 82 deletions(-) diff --git a/src/App.vue b/src/App.vue index 56f3093..4640159 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,12 +6,36 @@ const html = ref('') +.typora-container { + display: flex; + width: 100vw; + height: 100vh; + overflow: hidden; +} + +.preview { + flex: 1; + padding: 2rem; + overflow-y: auto; + background: #f9f9f9; + border-left: 1px solid #ddd; +} + +/* 图片点击放大 */ +.preview :deep(img) { + max-width: 100%; + cursor: zoom-in; + transition: opacity 0.2s; +} + +.preview :deep(img:hover) { + opacity: 0.8; +} diff --git a/src/components/MarkdownEditor.vue b/src/components/MarkdownEditor.vue index 4c3cb1a..9d81742 100644 --- a/src/components/MarkdownEditor.vue +++ b/src/components/MarkdownEditor.vue @@ -1,27 +1,53 @@ \ No newline at end of file