/** * 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; }