Ejemplo n.º 1
0
 @Override
 public void execute() {
   if (focus) {
     // Rich text area needs to be focused in order to have a proper selection or caret.
     rta.setFocus(true);
   }
   if (rta.getCommandManager().isEnabled(command)) {
     rta.getCommandManager().execute(command, parameter);
   }
 }
Ejemplo n.º 2
0
 /**
  * Overwrites the default rich text area behavior when the user releases the mouse button.
  *
  * @param event the native event that was fired
  */
 protected void onBeforeMouseUp(Event event) {
   // The height of the body element is given by its content. When the height of the body element
   // is less than the
   // rich text area height the user can click outside of the body element, on the HTML element.
   // When this happens
   // the selection can be lost. To prevent this we give the focus back to the body element.
   if (Element.is(event.getEventTarget())
       && "html".equalsIgnoreCase(Element.as(event.getEventTarget()).getTagName())) {
     textArea.setFocus(true);
   }
 }