Commit ae00ed14 authored by Matthew Coufal's avatar Matthew Coufal Committed by Evan W. Patton

Convert \n in browser designer page (#1944)

Change-Id: Iffc170ed207d6325663fafc25c4d19fef7dbd4bf
Co-authored-by: default avatarEvan W. Patton <ewpatton@mit.edu>
parent 8b1fdab2
......@@ -25,9 +25,9 @@ public final class MockLabel extends MockVisibleComponent {
// GWT label widget used to mock a Simple Label
private InlineHTML labelWidget;
private String savedText; // Saved text, so if we change from
// text to/from html we have the text
// to set
private String savedText = ""; // Saved text, so if we change from
// text to/from html we have the text
// to set
/**
* Creates a new MockLabel component.
......@@ -100,9 +100,15 @@ public final class MockLabel extends MockVisibleComponent {
private void setTextProperty(String text) {
savedText = text;
if (getPropertyValue(PROPERTY_NAME_HTMLFORMAT).equals("True")) {
labelWidget.setHTML(SimpleHtmlSanitizer.sanitizeHtml(text).asString());
String sanitizedText = SimpleHtmlSanitizer.sanitizeHtml(text).asString();
if (sanitizedText != null) {
sanitizedText = sanitizedText.replaceAll("\\\\n", " ");
}
labelWidget.setHTML(sanitizedText);
} else {
labelWidget.setText(text);
labelWidget.setHTML(text.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
.replaceAll(">", "&gt;").replaceAll("\\\\n", "<br>")
);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment