Skip to content

Commit

Permalink
Fixed MaterialLabel does not escape the given text. #497
Browse files Browse the repository at this point in the history
  • Loading branch information
kevzlou7979 committed Nov 11, 2016
1 parent 3a52dca commit 5b43969
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.addins.client.richeditor.base.HasPasteHandlers;
import gwt.material.design.addins.client.richeditor.base.MaterialRichEditorBase;
Expand Down Expand Up @@ -185,7 +187,7 @@ public void insertText(String text) {
* Insert custom text inside the note zone.
*/
protected void insertText(Element e, String text) {
$(e).materialnote("insertText", text);
$(e).materialnote("insertText", SafeHtmlUtils.fromString(text).asString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.ui.HasHTML;
import gwt.material.design.addins.client.base.constants.AddinsCssName;
import gwt.material.design.addins.client.richeditor.base.constants.ToolbarButton;
Expand Down Expand Up @@ -203,7 +204,7 @@ public String getText() {

@Override
public void setText(String text) {
getElement().setInnerText(text);
getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(text));
}

protected String getHTMLCode(Element e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.addins.client.base.constants.AddinsCssName;
import gwt.material.design.client.base.*;
Expand Down Expand Up @@ -135,13 +136,13 @@ public int getStep() {

public void setStep(int step) {
this.step = step;
divCircle.getElement().setInnerHTML(String.valueOf(step));
divCircle.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(String.valueOf(step)));
}

@Override
public void setTitle(String title) {
this.title = title;
divTitle.getElement().setInnerHTML(title);
divTitle.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(title));
}

public String getTitle() {
Expand All @@ -152,7 +153,7 @@ public String getTitle() {
public void setDescription(String description) {
this.description = description;
divDescription.setStyleName(AddinsCssName.DESCRIPTION);
divDescription.getElement().setInnerHTML(description);
divDescription.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(description));
conBody.insert(divDescription, 1);
}

Expand Down Expand Up @@ -203,7 +204,7 @@ protected void applyIconStatus(MaterialIcon icon, String description) {
iconSuccess.removeFromParent();
divCircle.removeFromParent();
conCircle.insert(icon, 0);
divDescription.getElement().setInnerHTML(description);
divDescription.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(description));
}

public Div getDivBody() {
Expand Down

0 comments on commit 5b43969

Please sign in to comment.