From 4830c8b236e765dbc7fb12953148cdadd7e90d78 Mon Sep 17 00:00:00 2001 From: Van Date: Wed, 4 Dec 2019 17:01:49 +0800 Subject: [PATCH] :bug: fix #10 --- CHANGELOG.md | 3 ++- src/ts/util/processPasteCode.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b66196b4..b01a0944c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,9 +36,10 @@ * [3](https://github.com/Vanessa219/vditor/issues/3) 编辑预览同步滚动改进 `enhancement` * [4](https://github.com/Vanessa219/vditor/issues/4) 添加支持思维导图的功能 `enhancement` -### v1.10.5 / 2019-12-04 +### v1.10.6 / 2019-12-04 * [11](https://github.com/Vanessa219/vditor/issues/11) 添加 CDN 配置 `enhancement` +* [10](https://github.com/Vanessa219/vditor/issues/10) block code 拷贝后变为 inline code `bug` * [9](https://github.com/Vanessa219/vditor/issues/9) 没有预览界面时依旧出现预览耗时提示 `bug` * [1](https://github.com/Vanessa219/vditor/issues/1) 上传时支持 xhr.setRequestHeader 设置 `enhancement` * [172](https://github.com/b3log/vditor/issues/172) 上传改进 `enhancement` diff --git a/src/ts/util/processPasteCode.ts b/src/ts/util/processPasteCode.ts index e4d454848..747369221 100644 --- a/src/ts/util/processPasteCode.ts +++ b/src/ts/util/processPasteCode.ts @@ -22,7 +22,7 @@ export const processPasteCode = (html: string, text: string, type: string = "mar if (type === "wysiwyg") { return `${code}`; } - if (/\n/.test(code)) { + if (/\n/.test(code) || pres.length === 1) { return "```\n" + code + "\n```"; } else { return `\`${code}\``;