Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue 现象:
粘贴多行代码时,如果光标在当前行的文字后面,代码段的开头标识 ``` 会与当前行内容混淆在一起,导致代码段解析错误
Issue 影响的模式:即时渲染模式 & 分屏预览模式
例子:
首先输入:1111,让光标在 文字最后,然后去 VSCode 内复制多行代码,进行粘贴
两种模式粘贴后显示现象分别如下:
修正方法:在调用 pasteCode 方法之前,判断 code 如果是多行内容,则在开头增加 "\n",保证 document.execCommand("insertHTML", false, code); 方法正常在当前行的下一行 插入代码区域