ADDITIONAL SYSTEM INFORMATION :
This occurs with Windows 10 and Linux, running Java 8 b192 or Java 11 EA + JavaFX 11 EA.
A DESCRIPTION OF THE PROBLEM :
This report concerns the issues and enhancements related to HTMLEditor editing capabilities.
Presently, the patch forJDK-8147476 solves MathML display issues in WebView. Consequently, it solves MathML display in HTMLEditor too. The MathML rendering is pretty good and equivalent to MathML Rendering with Safari.
I think thatJDK-8089878, which describes only rendering issues, is also solved.
Set HTMLEditor content with the following code displays the quadratic formula as expected inJDK-8089878.
<math display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>âÂÂ</mo>
<mi>b </mi>
<mo>ñ</mo>
<msqrt>
<mrow>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>âÂÂ</mo>
<mn>4</mn>
<mi>a</mi>
<mi>c</mi>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</mrow>
</math>
Bugs :
-Trying to modify a formula will occurate some trouble in your document. For example, try to modifiy the previous formula, by removing 2a from the fraction, this will break your formula.
- MathML content is not updated after an insertion. This only occurs when MathML Token are in a table like in the Mozilla MathML Torture Test.
- Cursor disappears in <mi> token when the identifier name has only one character. If the name of the identifier is longer than 1 character, the cursor appears normaly. This not occurs in <mn> and <mo>.
- In <mo>, cursor disappears too.
- Bad selection logic. Some parts of the formula disappear and selection should be only one rectangle not many rectangles.
Enhancements : A common user can not easily and directly use MathML to insert a mathematic formula in HTMLEditor.
- MathML language is too verbose, an interface like AsciiMath for editing would be appreciate.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Each test could be made with the previous MathML code.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
/**
* A sample that demonstrates the HTML Editor. You can make changes to the
* example text, and the resulting generated HTML is displayed.
*
* @related controls/text/SimpleLabel
* @see javafx.scene.web.HTMLEditor
*/
public class HTMLEditorApp extends Application {
private HTMLEditor htmlEditor = null;
private final String INITIAL_TEXT = ""
+ "<html>"
+ "<body>"
+ "<p>A quadratic formula "
+ "<math>"
+ " <mrow>"
+ " <mi>x</mi>"
+ " <mo>=</mo>"
+ " <mfrac>"
+ " <mrow>"
+ " <mo>âÂÂ</mo>"
+ " <mi>b </mi>"
+ " <mo>ñ</mo>"
+ " <msqrt>"
+ " <mrow>"
+ " <msup>"
+ " <mi>b</mi>"
+ " <mn>2</mn>"
+ " </msup>"
+ " <mo>âÂÂ</mo>"
+ " <mn>4</mn>"
+ " <mi>a</mi>"
+ " <mi>c</mi>"
+ " </mrow>"
+ " </msqrt>"
+ " </mrow>"
+ " <mrow>"
+ " <mn>2</mn>"
+ " <mi>a</mi>"
+ " </mrow>"
+ " </mfrac>"
+ " </mrow>"
+ "</math>"
+ " displayed in a presentation text."
+ "</p>"
+ "</body>"
+ "</html>";
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vRoot = new VBox();
vRoot.setPadding(new Insets(8, 8, 8, 8));
vRoot.setSpacing(5);
htmlEditor = new HTMLEditor();
htmlEditor.setPrefSize(500, 245);
htmlEditor.setHtmlText(INITIAL_TEXT);
vRoot.getChildren().add(htmlEditor);
final Label htmlLabel = new Label();
htmlLabel.setMaxWidth(500);
htmlLabel.setWrapText(true);
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setContent(htmlLabel);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(180);
Button showHTMLButton = new Button("Show the HTML below");
vRoot.setAlignment(Pos.CENTER);
showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
htmlLabel.setText(htmlEditor.getHtmlText());
}
});
vRoot.getChildren().addAll(showHTMLButton, scrollPane);
root.getChildren().addAll(vRoot);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
This occurs with Windows 10 and Linux, running Java 8 b192 or Java 11 EA + JavaFX 11 EA.
A DESCRIPTION OF THE PROBLEM :
This report concerns the issues and enhancements related to HTMLEditor editing capabilities.
Presently, the patch for
I think that
Set HTMLEditor content with the following code displays the quadratic formula as expected in
<math display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>âÂÂ</mo>
<mi>b </mi>
<mo>ñ</mo>
<msqrt>
<mrow>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>âÂÂ</mo>
<mn>4</mn>
<mi>a</mi>
<mi>c</mi>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</mrow>
</math>
Bugs :
-Trying to modify a formula will occurate some trouble in your document. For example, try to modifiy the previous formula, by removing 2a from the fraction, this will break your formula.
- MathML content is not updated after an insertion. This only occurs when MathML Token are in a table like in the Mozilla MathML Torture Test.
- Cursor disappears in <mi> token when the identifier name has only one character. If the name of the identifier is longer than 1 character, the cursor appears normaly. This not occurs in <mn> and <mo>.
- In <mo>, cursor disappears too.
- Bad selection logic. Some parts of the formula disappear and selection should be only one rectangle not many rectangles.
Enhancements : A common user can not easily and directly use MathML to insert a mathematic formula in HTMLEditor.
- MathML language is too verbose, an interface like AsciiMath for editing would be appreciate.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Each test could be made with the previous MathML code.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
/**
* A sample that demonstrates the HTML Editor. You can make changes to the
* example text, and the resulting generated HTML is displayed.
*
* @related controls/text/SimpleLabel
* @see javafx.scene.web.HTMLEditor
*/
public class HTMLEditorApp extends Application {
private HTMLEditor htmlEditor = null;
private final String INITIAL_TEXT = ""
+ "<html>"
+ "<body>"
+ "<p>A quadratic formula "
+ "<math>"
+ " <mrow>"
+ " <mi>x</mi>"
+ " <mo>=</mo>"
+ " <mfrac>"
+ " <mrow>"
+ " <mo>âÂÂ</mo>"
+ " <mi>b </mi>"
+ " <mo>ñ</mo>"
+ " <msqrt>"
+ " <mrow>"
+ " <msup>"
+ " <mi>b</mi>"
+ " <mn>2</mn>"
+ " </msup>"
+ " <mo>âÂÂ</mo>"
+ " <mn>4</mn>"
+ " <mi>a</mi>"
+ " <mi>c</mi>"
+ " </mrow>"
+ " </msqrt>"
+ " </mrow>"
+ " <mrow>"
+ " <mn>2</mn>"
+ " <mi>a</mi>"
+ " </mrow>"
+ " </mfrac>"
+ " </mrow>"
+ "</math>"
+ " displayed in a presentation text."
+ "</p>"
+ "</body>"
+ "</html>";
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vRoot = new VBox();
vRoot.setPadding(new Insets(8, 8, 8, 8));
vRoot.setSpacing(5);
htmlEditor = new HTMLEditor();
htmlEditor.setPrefSize(500, 245);
htmlEditor.setHtmlText(INITIAL_TEXT);
vRoot.getChildren().add(htmlEditor);
final Label htmlLabel = new Label();
htmlLabel.setMaxWidth(500);
htmlLabel.setWrapText(true);
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setContent(htmlLabel);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(180);
Button showHTMLButton = new Button("Show the HTML below");
vRoot.setAlignment(Pos.CENTER);
showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
htmlLabel.setText(htmlEditor.getHtmlText());
}
});
vRoot.getChildren().addAll(showHTMLButton, scrollPane);
root.getChildren().addAll(vRoot);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-8147476 Rendering issues with MathML token elements
- Resolved
-
JDK-8089878 HTMLEditor messes up MathML markup
- Closed