package org.rstudio.studio.client.panmirror.ui;

import org.rstudio.core.client.Debug;
import org.rstudio.core.client.widget.ModalDialog;
import org.rstudio.studio.client.panmirror.PanmirrorEditorOptions;
import org.rstudio.studio.client.panmirror.PanmirrorEditorWidget;

import com.google.gwt.aria.client.Roles;
import com.google.gwt.user.client.ui.SimplePanel;

import com.google.gwt.user.client.ui.Widget;

public class PanmirrorTestDialog extends ModalDialog<String>
{
   public PanmirrorTestDialog()
   {
      super("Panmirror", Roles.getDialogRole(), input -> {});
      
      mainWidget_ = new SimplePanel();
      mainWidget_.setSize("500px", "400px");
      
      PanmirrorEditorOptions options = new PanmirrorEditorOptions();
      PanmirrorEditorWidget.create("markdown", options, editorWidget -> {
         if (editorWidget != null) {
            this.editorWidget_ = editorWidget;
            this.editorWidget_.setMarkdown("The *quick* brown **fox** jumped over the lazy dog", true, () -> {
               mainWidget_.add(this.editorWidget_);
               this.editorWidget_.getMarkdown(markdown -> {
                  Debug.logToConsole(markdown);
               });
            });
         }
      });
     
   }

   @Override
   protected String collectInput()
   {
      return "";
   }

   @Override
   protected Widget createMainWidget()
   {
      return mainWidget_;
   }

   private SimplePanel mainWidget_;
   private PanmirrorEditorWidget editorWidget_;
}

@@ -403,16 +403,185 @@
 idget;%0A%0A
+// TODO: should .Prosemirror set postiion: absolute (may need to for footnotes)%0A// TODO: how to handle error conditions? confirm all the flow of control actually works%0A%0A
 public c

add some todo