< prev index next >

modules/javafx.web/src/main/java/javafx/scene/web/HTMLEditorSkin.java

Print this page

        

@@ -67,10 +67,11 @@
 import javafx.scene.text.Font;
 import javafx.util.Callback;
 
 import com.sun.javafx.scene.control.skin.FXVK;
 import com.sun.javafx.scene.web.behavior.HTMLEditorBehavior;
+import com.sun.webkit.dom.HTMLDocumentImpl;
 import com.sun.webkit.WebPage;
 import com.sun.javafx.webkit.Accessor;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;

@@ -441,10 +442,11 @@
 
             double totalWork = webView.getEngine().getLoadWorker().getTotalWork();
             if (newValue.doubleValue() == totalWork) {
                 cachedHTMLText = null;
                 Platform.runLater(() -> {
+                    setDesignMode("on");
                     setContentEditable(true);
                     updateToolbarState(true);
                     updateNodeOrientation();
                 });
             }

@@ -1102,10 +1104,15 @@
         HTMLElement htmlDocumentElement = (HTMLElement)htmlDocument.getDocumentElement();
         HTMLElement htmlBodyElement = (HTMLElement)htmlDocumentElement.getElementsByTagName("body").item(0);
         htmlBodyElement.setAttribute("contenteditable", Boolean.toString(b));
     }
 
+    private void setDesignMode(String mode) {
+        HTMLDocumentImpl htmlDocumentImpl = (HTMLDocumentImpl)webPage.getDocument(webPage.getMainFrame());
+        htmlDocumentImpl.setDesignMode(mode);
+    }
+
     private boolean getCommandState(String command) {
         return webPage.queryCommandState(command);
     }
 
     private String getCommandValue(String command) {
< prev index next >