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

editor.md录入延迟太大(停顿明显),试用了cmd markdown,基本无延迟。建议这样...... #45

Closed
byhgj opened this issue Mar 12, 2015 · 4 comments

Comments

@byhgj
Copy link

byhgj commented Mar 12, 2015

试了一下cmd markdown,cmd可能使用了击键延迟触发markdown解析(击键暂停n秒后才开始解析,不再每次点击都解析),这样基本不影响使用者感知。建议editor.md使用类似策略。

@byhgj byhgj changed the title editor.md录入延迟太大,使用了cmd markdown,基本无延迟。能不能改进啊。 editor.md录入延迟太大,使用了cmd markdown,基本无延迟。建议这样...... Mar 12, 2015
@byhgj byhgj changed the title editor.md录入延迟太大,使用了cmd markdown,基本无延迟。建议这样...... editor.md录入延迟太大,试用了cmd markdown,基本无延迟。建议这样...... Mar 12, 2015
@byhgj byhgj changed the title editor.md录入延迟太大,试用了cmd markdown,基本无延迟。建议这样...... editor.md录入延迟太大(停顿明显),试用了cmd markdown,基本无延迟。建议这样...... Mar 12, 2015
@byhgj
Copy link
Author

byhgj commented Mar 12, 2015

修改codeEditor事件change,代码如下,800毫秒延时

            codeEditor.on("change", function(cm, changeObj) {
                if (_this.parseTimer != null) clearTimeout(_this.parseTimer);
                _this.parseTimer = setTimeout(function(){
                    _this.saveToTextareas()
                },800);
            });

@pandao
Copy link
Owner

pandao commented Mar 13, 2015

谢谢你的建议,可以考虑,这个可以供用户选择。
不过需要说的是目前Editor.md是零延迟,即时解析,如果解析量太多(并且开启支持TeX等Markdown扩展语法的情况下),才会出现所谓的延迟现象。

@pandao
Copy link
Owner

pandao commented Mar 13, 2015

@byhgj 新版本会增加一个延迟解析预览的机制,可供用户自定义,特别是用户输入太快的场景。

另外,你给我一个启发,利用延迟机制解决了一个老问题,即当输入速度过快时,解析Flowchart会出错的问题,谢谢!

@pandao
Copy link
Owner

pandao commented Mar 23, 2015

@v1.4.0 added.

@pandao pandao closed this as completed Mar 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants