Package org.waveprotocol.wave.client.editor.content

Examples of org.waveprotocol.wave.client.editor.content.FocusedContentRange


      // to go has been deleted, so they may not want to upload it anymore).
      return;
    }
    EditorContext context = edit.getEditor();
    CMutableDocument doc = context.getDocument();
    FocusedContentRange selection = context.getSelectionHelper().getSelectionPoints();
    Point<ContentNode> point;
    if (selection != null) {
      point = selection.getFocus();
    } else {
      // Focus was probably lost.  Bring it back.
      context.focus(false);
      selection = context.getSelectionHelper().getSelectionPoints();
      if (selection != null) {
        point = selection.getFocus();
      } else {
        // Still no selection.  Oh well, put it at the end.
        point = doc.locate(doc.size() - 1);
      }
    }
View Full Code Here


      // Uncomment for verbose debugging
      // if (Debug.isOn(LogSeverity.DEBUG)) {
      //   logger.logXml("SELECTION: " + start + " - " + end);
      // }

      FocusedContentRange ret = range.isCollapsed()
          ? new FocusedContentRange(anchor) : new FocusedContentRange(anchor, focus);

      if (needsCorrection && ret != null) {
        setSelectionPoints(ret.getAnchor(), ret.getFocus());
      }

      return ret;
    } finally {
      needsCorrection = false;
View Full Code Here

    }
  }

  @Override
  public ContentRange getOrderedSelectionPoints() {
    FocusedContentRange selection = getSelectionPoints();
    return selection == null ? null : selection.asOrderedRange(NativeSelectionUtil.isOrdered());
  }
View Full Code Here

    return selection == null ? null : selection.asOrderedRange(NativeSelectionUtil.isOrdered());
  }

  /** {@inheritDoc} */
  public FocusedRange getSelectionRange() {
    FocusedContentRange contentRange = getSelectionPoints();
    if (contentRange == null) {
      return null;
    }
    return new FocusedRange(
        mapper.getLocation(contentRange.getAnchor()),
        mapper.getLocation(contentRange.getFocus())
    );
  }
View Full Code Here

    if (keySignalType == KeySignalType.DELETE) {
      refreshEditorWithCaret(event);
      caret = cachedSelection.getFocus();
      ContentNode node = caret.getContainer();

      editorInteractor.checkpoint(new FocusedContentRange(caret));

      switch (EventWrapper.getKeyCombo(event)) {
        case BACKSPACE:
        case SHIFT_BACKSPACE:
          editorInteractor.rebiasSelection(CursorDirection.FROM_RIGHT);
View Full Code Here

    // TODO(danilatos): This is still a slight anomaly, to call a
    // node.handleXYZ method here.
    if (event.isOnly(KeyCodes.KEY_ENTER)) {
      refreshEditorWithCaret(event);
      caret = event.getCaret().asPoint();
      editorInteractor.checkpoint(new FocusedContentRange(caret));
      router.handleEnter(caret.getContainer(), event);
      editorInteractor.rebiasSelection(CursorDirection.FROM_LEFT);
      return true;
    } else if (event.isCombo(KeyCodes.KEY_ENTER, KeyModifier.SHIFT)) {
      // shift+enter inserts a "newline" (such as a <br/>) by default
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.content.FocusedContentRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.