Esempio n. 1
0
 /**
  * Creates an editor.
  *
  * @return New Editor instance
  */
 public static Editor create() {
   Element e = Document.get().createDivElement();
   e.setClassName("editor");
   return UserAgent.isMobileWebkit()
       ? // \u2620
       new EditorImplWebkitMobile(true, e)
       : new EditorImpl(true, e);
 }
Esempio n. 2
0
 /**
  * Creates a new editor attached to an existing document. {@link Editor#reset() Resetting} this
  * editor will preserve the document to which it is attached.
  *
  * @return New Editor instance
  */
 public static Editor attachTo(ContentDocument doc) {
   Element e = doc.getFullContentView().getDocumentElement().getImplNodelet();
   Preconditions.checkArgument(e != null);
   e = e.getParentElement();
   Preconditions.checkArgument(e != null);
   EditorImpl editor =
       UserAgent.isMobileWebkit()
           ? new EditorImplWebkitMobile(false, e)
           : new EditorImpl(false, e);
   editor.setContent(doc);
   return editor;
 }