[webkit-dev] Edit mode bug inserting <br> ?

David Kilzer ddkilzer at webkit.org
Tue Jan 6 07:08:51 PST 2009


The WebKit nightly DMG launches Safari with pre-built frameworks, so it's still running in the browser.  It's important to find out if this issue is fixed there so that you know whether you need to file a bug on <https://bugs.webkit.org/> or not.

I'm not very familiar with DOM editing methods, so I don't have a work-around to propose.  Sorry.

Dave




________________________________
From: Diego Taylor <diego.taylor at gmail.com>
To: David Kilzer <ddkilzer at webkit.org>
Sent: Tuesday, January 6, 2009 6:50:46 AM
Subject: Re: [webkit-dev] Edit mode bug inserting <br> ?

Hi Dave,

The only issue is that I need to use it under the browser, but no problem.

Thanks,
Diego


On Tue, Jan 6, 2009 at 12:01 PM, David Kilzer <ddkilzer at webkit.org> wrote:

Did you try the WebKit nightly to see if the issue is fixed there?

Dave




________________________________
From: Diego Taylor <diego.taylor at gmail.com>
To: David Kilzer <ddkilzer at webkit.org>
Sent: Tuesday, January 6, 2009 5:35:00 AM
Subject: Re: [webkit-dev] Edit mode bug inserting <br> ?


Hi Dave,

The Safari where I am testing is: "Version 3.2.1 (5525.27.1)"
Is there any workaround for it?

Thank You,
Diego



On Tue, Jan 6, 2009 at 1:25 AM, David Kilzer <ddkilzer at webkit.org> wrote:

Which version of Safari did you try?

There have been some HTML editing fixes recently in WebKit.  Have you tried a nightly WebKit build?  <http://nightly.webkit.org/>

Dave




________________________________
 From: Diego Taylor <diego.taylor at gmail.com>
To: webkit-dev at lists.webkit.org
Sent: Monday, January 5, 2009 1:49:23 PM
Subject: [webkit-dev] Edit mode bug inserting <br> ?


Hi,

I am intercepting the return key in edit mode and adding a <br> in the cursor position, but the first time I press the return key at the end of the text it doesn't move the cursor after the inserted br. Any help is really appreciated, this is the source code (tested on Safari):

---------- o ----------
<html>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   </head>
   <body>
      <script language='javascript' type='text/javascript'>
         document.body.contentEditable = true;
         document.designMode = 'on';
         function onKeyPress(ev) {
            console.log('Key Pressed');
            if(ev.keyCode==13) {
               insertBR();
               ev.preventDefault();
            }
         }
         document.addEventListener('keypress', onKeyPress);
         function insertBR()
         {
            var s = window.getSelection();
            var r = s.getRangeAt(0);

            var br = document.createElement('br');
            r.insertNode(br);
            var newRange = document.createRange();
            newRange.setStartAfter(br);
            newRange.setEndAfter(br);
            

            s.removeAllRanges();
            r.detach();
            s.addRange(newRange);
         }
      </script>
   <div>Here is the place to play.</div>
   </body>
</html>
---------- o ----------

Thanks,
Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090106/6890a4ea/attachment.html>


More information about the webkit-dev mailing list