Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置 codeBlockPreview false, esc 后代码块消失 #267

Closed
codingcn opened this issue Apr 2, 2020 · 7 comments
Closed

设置 codeBlockPreview false, esc 后代码块消失 #267

codingcn opened this issue Apr 2, 2020 · 7 comments
Assignees
Milestone

Comments

@codingcn
Copy link

codingcn commented Apr 2, 2020

编辑模式

请选择你遇到问题时使用的编辑模式:

所见即所得模式
即时渲染模式
分屏编辑预览模式

描述问题

新加的VditorCodeBlockPreview应该还是有问题的,我自己npm装的3.0.8和官方demo https://hacpai.com/guide/markdown出现了不同的错误
当所见即所得模式

复现步骤

所见即所得模式,直接手动敲入以下代码(别复制粘贴),显示就会出现异常;然后再切换到分屏模式,生成的md文本也是错误的

<?php
phpinfo();

### 哈哈哈

期待的结果

VditorCodeBlockPreview能正常使用

@Vanessa219
Copy link
Owner

代码块需要先输入

```

Markdown 语法不熟悉的话,可以使用工具栏。直接输入<? 会被 markdown 规范认为是 html

@codingcn
Copy link
Author

codingcn commented Apr 2, 2020

@Vanessa219 我npm装的3.0.8,即时渲染模式没有问题;但使用所见即所得模式时,不管codeBlockPreview设为true还是false,通过工具栏插入代码块,输入的文本总是错位,就是文本不会被包含在代码块标签内。

比如我实际输入的是

alert(1);

但编辑器给我的结果是

alert(1);

@Vanessa219
Copy link
Owner

可以给一下具体步骤么?这里是好的呦
QQ20200403-085814

@codingcn
Copy link
Author

codingcn commented Apr 3, 2020

@Vanessa219
2020-04-03 01 00 11

@codingcn
Copy link
Author

codingcn commented Apr 3, 2020

这是我使用的配置

                    width: '100%',
                    tab: '\t',
                    counter: '999999',
                    typewriterMode: true,
                    // mode: 'sv',
                    // mode: 'ir',
                    mode: 'wysiwyg',
                    preview: {
                        hljs: {
                            enable: true,
                            style: 'github',
                            lineNumber: 1
                        },
                        markdown: {
                            codeBlockPreview: false,
                        },
                        delay: 100,
                        mode: 'both',
                        show: true,
                    },

@Vanessa219
Copy link
Owner

要不你在 demo/static.html 这个上面试一下,我这里还是不能重现。

@codingcn
Copy link
Author

codingcn commented Apr 3, 2020

@Vanessa219 我用demo/static.html 尝试了下,的确不会产生这个问题,应该是我自己的失误,我再自查下,抱歉哈。

后面我用static.html 时,发现了个新问题:

codeBlockPreview: false且所见即所得模式,我输入一行代码,然后按下ESC键,代码就不会显示了,切换到分屏模式,再切换回所见即所得,代码又出现了。

@Vanessa219 Vanessa219 changed the title VditorCodeBlockPreview导致代码显示异常 设置 codeBlockPreview false, esc 后代码块消失 Apr 3, 2020
@Vanessa219 Vanessa219 added this to the 3.0.0 milestone Apr 3, 2020
stevapple pushed a commit to stevapple/vditor that referenced this issue Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants