From b735757cf2c599a6e06c53ac30f3355b39ed77d8 Mon Sep 17 00:00:00 2001
From: zhanzhenping <128675240+Zzhenping@users.noreply.github.com>
Date: Thu, 11 Jul 2024 15:26:16 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20markdown=20=E6=94=AF=E6=8C=81word?=
=?UTF-8?q?=E8=BD=AC=E7=AC=94=E8=AE=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
static/js/cherry_markdown.js | 3 +--
static/js/markdown.js | 13 +++++++++++++
views/document/markdown_edit_template.tpl | 4 ++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/static/js/cherry_markdown.js b/static/js/cherry_markdown.js
index bb0e6d83..9734a08e 100644
--- a/static/js/cherry_markdown.js
+++ b/static/js/cherry_markdown.js
@@ -141,14 +141,13 @@ $(function () {
let converter = new WordToHtmlConverter();
converter.handleFileSelect(function (response) {
if (response.messages.length) {
- console.log(response)
let messages = response.messages.map((item)=>{
return item.message + "
";
}).join('\n');
layer.msg(messages);
}
converter.replaceHtmlBase64(response.value).then((html)=>{
- window.editor.setMarkdown(html);
+ window.editor.insertValue(html);
});
})
}
diff --git a/static/js/markdown.js b/static/js/markdown.js
index 96e37c36..e50aade4 100644
--- a/static/js/markdown.js
+++ b/static/js/markdown.js
@@ -436,6 +436,19 @@ $(function () {
drawio.processMarkers(selStartLine, selEndLine)
drawio.show()
+ } else if (name === 'wordToContent') {
+ let converter = new WordToHtmlConverter();
+ converter.handleFileSelect(function (response) {
+ if (response.messages.length) {
+ let messages = response.messages.map((item)=>{
+ return item.message + "
";
+ }).join('\n');
+ layer.msg(messages);
+ }
+ converter.replaceHtmlBase64(response.value).then((html)=>{
+ insertAndClearToMarkdown(html);
+ });
+ })
} else {
var action = window.editor.toolbarHandlers[name];
diff --git a/views/document/markdown_edit_template.tpl b/views/document/markdown_edit_template.tpl
index 4a37291c..631dcc34 100644
--- a/views/document/markdown_edit_template.tpl
+++ b/views/document/markdown_edit_template.tpl
@@ -98,6 +98,8 @@
+
+