上次评论看到还不相信, 今天自己碰到了, 在评论框裸写代码的时候
中文输入法情况下感觉不出来, 在键盘用英文快速按就能遇到了,
用 Chrome 自动的工具看了下, CPU 占用好可怕

回复 (10)
A
确实,昨天我也遇到这个问题,今天好像就快了,但是网页还是容易少加载一些资源导致页面变乱
J
引用 a272121742确实,昨天我也遇到这个问题,今天好像就快了,但是网页还是容易少加载一些资源导致页面变乱
今天我这里也是, 502 很多次, 加载 css 失败若干次
G
实时编译md导致的?
L
引用 gxmari007实时编译md导致的?
只有在文章的回复数量很多时,这个问题才越来越明显。 应该跟回复框数量有关,每个会分开都创建了一个Markdown.Editor,或许是这个的问题:
function run_md_editor() {
var converter = new Showdown.converter();
var editor = new Markdown.Editor(converter);
editor.run();
editor.hooks.chain('onPreviewRefresh', function () {
prettyPrint();
});
$('.reply2_editor').each(function() {
var editor_id = $(this).attr('id');
var suffix = editor_id.slice(editor_id.indexOf('-'));
var editor = new Markdown.Editor(converter, suffix);
editor.run();
editor.hooks.chain('onPreviewRefresh', function () {
prettyPrint();
});
});
}
run_md_editor();
L
@gxmari007 @jiyinyiyong 刚提交了个pull request:https://github.com/cnodejs/nodeclub/pull/76
J
引用 leizongmin@gxmari007 @jiyinyiyong 刚提交了个pull request:https://github.com/cnodejs/nodeclub/pull/76
onPreviewRefresh 那个事件是怎么回事啊, 是每次输入都有的么?
L
引用 leizongmin@gxmari007 @jiyinyiyong 刚提交了个pull request:https://github.com/cnodejs/nodeclub/pull/76
@jiyinyiyong 应该是吧: 你在浏览器控制台中执行以下代码,然后再找个回复框输入内容,可以看到没次改变回复框内容都会触发该事件。
_p = prettyPrint;
i = 0;
prettyPrint = function () { console.log(i++); _p(); }
J
引用 leizongmin@gxmari007 @jiyinyiyong 刚提交了个pull request:https://github.com/cnodejs/nodeclub/pull/76
@leizongmin 真的, 唉. 每次整个执行一遍实在可怕
G
引用 leizongmin@gxmari007 @jiyinyiyong 刚提交了个pull request:https://github.com/cnodejs/nodeclub/pull/76
每个回复框都创建一个编辑器其实没必要,如果扩展功能会越来越卡,其实只显示一个就行了。
参与回复
登录后即可参与回复。登录