org.xwiki.gwt.wysiwyg.client.plugin.readonly
Class SafariReadOnlyKeyboardHandler

java.lang.Object
  extended by org.xwiki.gwt.wysiwyg.client.plugin.readonly.ReadOnlyKeyboardHandler
      extended by org.xwiki.gwt.wysiwyg.client.plugin.readonly.SafariReadOnlyKeyboardHandler
All Implemented Interfaces:
com.google.gwt.event.dom.client.KeyDownHandler, com.google.gwt.event.dom.client.KeyPressHandler, com.google.gwt.event.dom.client.KeyUpHandler, com.google.gwt.event.shared.EventHandler

public class SafariReadOnlyKeyboardHandler
extends ReadOnlyKeyboardHandler

Custom implementation of ReadOnlyKeyboardHandler for WebKit-based browsers.

Version:
$Id$

Constructor Summary
SafariReadOnlyKeyboardHandler()
           
 
Method Summary
protected  void onDelete(Event event, Element element)
          Deletes a read-only element when it is the only target of the given event.
protected  void onDelete(Event event, Element element, Range range, boolean start)
          Deletes a read-only element when it is not the only target of the given event.
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.plugin.readonly.ReadOnlyKeyboardHandler
onKeyDown, onKeyPress, onKeyUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafariReadOnlyKeyboardHandler

public SafariReadOnlyKeyboardHandler()
Method Detail

onDelete

protected void onDelete(Event event,
                        Element element)
Deletes a read-only element when it is the only target of the given event.

WebKit browsers don't restore the selection after an element that contained or was touched by the selection is removed. Instead of manually removing the read-only element we select it and let the browser remove it.

Overrides:
onDelete in class ReadOnlyKeyboardHandler
Parameters:
event - the native event that was fired
element - the read-only element to be deleted
See Also:
ReadOnlyKeyboardHandler.onDelete(Event, Element)

onDelete

protected void onDelete(Event event,
                        Element element,
                        Range range,
                        boolean start)
Deletes a read-only element when it is not the only target of the given event.

WebKit browsers don't restore the selection after an element that contained or was touched by the selection is removed. Instead of manually removing the read-only element we extend the given range to include the element and let the browser remove it.

Overrides:
onDelete in class ReadOnlyKeyboardHandler
Parameters:
event - the native event that was fired
element - the read-only element to be deleted
range - the range that touches the read-only element
start - true if the start point of the given range is inside the read-only element, false if the end point is inside the read-only element
See Also:
ReadOnlyKeyboardHandler.onDelete(Event, Element, Range, boolean)


Copyright © 2004-2012 XWiki. All Rights Reserved.