简体   繁体   English

萤火虫:断点和contentEditable奇怪的行为

[英]firebug: breakpoints and contentEditable odd behaviour

I have a contentEditable element (a tinyMCE editor, actually); 我有一个contentEditable元素(实际上是tinyMCE编辑器); I'm debugging my plugin, looking for a bug specific to Firefox. 我正在调试插件,寻找特定于Firefox的错误。

My code uses event listeners to work, with: 我的代码使用事件侦听器进行以下工作:

ed.onKeyDown.addToTop(mycallback);

Now, my problem is that, if I put a breakpoint in a line of code that is fired by the pressing of a key, and then click on firebug's "continue" button, the code continues, but the key is discarded by the editor. 现在,我的问题是,如果我将断点放在通过按下某个键触发的代码行中,然后单击Firebug的“继续”按钮,该代码将继续,但是该键会被编辑器丢弃。 That is, I press a key and it doesn't appear in the editor. 也就是说,我按了一个键,它没有出现在编辑器中。 If I remove the breakpoint, the editor works fine. 如果删除断点,则编辑器工作正常。

This only happens on firefox: Google Chrome works fine. 这仅在firefox上发生:Google Chrome正常运行。

Is there a solution to use breakpoints and still see the editor work? 有没有使用断点的解决方案,仍然可以看到编辑器的工作?

I don't know if you're still having this problem, but it's working fine for me using the follow example with Firefox 13.0.1 + Firebug 1.9.2 on Win7: 我不知道您是否仍然遇到此问题,但是在Win7上使用Firefox 13.0.1 + Firebug 1.9.2的以下示例对我来说工作正常:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>tinyMCE test</title>
        <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript">
        function mycallback() {
          console.log("Key down");
        }

        var ed = new tinymce.Editor("editor", {});

        ed.onKeyDown.addToTop(mycallback);

        ed.render();
        </script>
    </head>
    <body>
        <textarea id="editor">test</textarea>
    </body>
</html>

My steps: 我的步骤:

  1. Opened Firebug on that test page 在该测试页上打开了Firebug
  2. Enabled and switched to the Script panel 启用并切换到“ 脚本”面板
  3. Reloaded the page 重新载入页面
  4. Set a breakpoint at line 10 ( console.log("Key down"); ) 在第10行设置一个断点( console.log("Key down");
  5. Typed 'a' into the tinyMCE editor => Execution stopped at line 10 在tinyMCE编辑器中键入“ a” =>执行在第10行停止
  6. Clicked the Continue button 单击继续按钮
  7. Switched to the Console panel 切换到控制台面板

=> Output "Key down" was logged into the Console panel =>输出“按键按下”已登录到控制台面板

I have to admit that I don't know anything about tinyMCE and your description was not 100% clear to me. 我必须承认,我对tinyMCE一无所知,而且您的描述对我而言还不是100%清楚。 If you still have that problem, it will help, if you give a small test case including steps to reproduce like I did. 如果您仍然遇到该问题,如果您给出一个小的测试用例,其中包括像我一样进行重现的步骤,那么它将有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM