Skip to content

Commit

Permalink
🎨 fix Vanessa219#955
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 authored and izgzhen committed Dec 11, 2021
1 parent 604d00b commit c339f4c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -98,6 +98,12 @@

### v3.8.4

* [955](https://github.com/Vanessa219/vditor/issues/955) 为 hint 内容添加是否进行 md 转换的设置 `改进功能`
* [956](https://github.com/Vanessa219/vditor/issues/956) 改进 plantuml 解析问题 `修复缺陷`
* 文档修改
* 3.8.4
* 添加 hint.parse 配置

### v3.8.3 / 2021-03-14

* [953](https://github.com/Vanessa219/vditor/issues/953) 标题删除需保留空行 `改进功能`
Expand Down
1 change: 1 addition & 0 deletions demo/index.js
Expand Up @@ -87,6 +87,7 @@ window.vditor = new Vditor('vditor', {
'sd': '💔',
'j': 'https://unpkg.com/vditor@1.3.1/dist/images/emoji/j.png',
},
parse: false,
extend: [
{
key: '@',
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "vditor",
"version": "3.8.3",
"version": "3.8.4",
"description": "♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生",
"author": "Vanessa <v@b3log.org> (http://vanessa.b3log.org)",
"homepage": "https://b3log.org/vditor",
Expand Down
15 changes: 12 additions & 3 deletions src/ts/hint/index.ts
Expand Up @@ -161,11 +161,20 @@ ${i === 0 ? "class='vditor-hint--current'" : ""}> ${html}</button>`;

range.setStart(range.startContainer, this.lastIndex);
range.deleteContents();

if (vditor.options.hint.parse) {
if (vditor.currentMode === "sv") {
insertHTML(vditor.lute.SpinVditorSVDOM(value), vditor);
} else if (vditor.currentMode === "wysiwyg") {
insertHTML(vditor.lute.SpinVditorDOM(value), vditor);
} else {
insertHTML(vditor.lute.SpinVditorIRDOM(value), vditor);
}
} else {
insertHTML(value, vditor);
}
if (this.splitChar === ":" && value.indexOf(":") > -1 && vditor.currentMode !== "sv") {
insertHTML(vditor.lute.SpinVditorDOM(value), vditor);
range.insertNode(document.createTextNode(" "));
} else {
insertHTML(vditor.lute.SpinVditorDOM(value), vditor);
}
range.collapse(false);
setSelectionFocus(range);
Expand Down
1 change: 1 addition & 0 deletions src/ts/util/Options.ts
Expand Up @@ -38,6 +38,7 @@ export class Options {
},
emojiPath: `${Constants.CDN}/dist/images/emoji`,
extend: [],
parse: true,
},
icon: "ant",
lang: "zh_CN",
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Expand Up @@ -448,6 +448,8 @@ interface IHintExtend {

/** @link https://ld246.com/article/1549638745630#options-hint */
interface IHint {
/** 提示内容是否进行 md 解析 */
parse?: boolean;
/** 常用表情提示 HTML */
emojiTail?: string;
/** 提示 debounce 毫秒间隔。默认值: 200 */
Expand Down

0 comments on commit c339f4c

Please sign in to comment.