From 5c875228d9025f4c779ffc26c3eb0f7b561061e5 Mon Sep 17 00:00:00 2001 From: Maciej PrzepioĢra Date: Wed, 16 Sep 2015 10:48:31 +0200 Subject: Support HTML entities when reading/writing declarative format #18882 Change-Id: I08099673c5dd0d688d3243e5fd169edb05f046f3 --- server/src/com/vaadin/ui/OptionGroup.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'server/src/com/vaadin/ui/OptionGroup.java') diff --git a/server/src/com/vaadin/ui/OptionGroup.java b/server/src/com/vaadin/ui/OptionGroup.java index 10c263aca0..183fc36500 100644 --- a/server/src/com/vaadin/ui/OptionGroup.java +++ b/server/src/com/vaadin/ui/OptionGroup.java @@ -33,6 +33,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.shared.ui.optiongroup.OptionGroupConstants; import com.vaadin.ui.declarative.DesignContext; +import com.vaadin.ui.declarative.DesignFormatter; /** * Configures select to be used as an option group. @@ -276,6 +277,14 @@ public class OptionGroup extends AbstractSelect implements if (!isItemEnabled(itemId)) { elem.attr("disabled", ""); } + if (isHtmlContentAllowed()) { + // need to unencode HTML entities. AbstractSelect.writeDesign can't + // check if HTML content is allowed, so it always encodes entities + // like '>', '<' and '&'; in case HTML content is allowed this is + // undesirable so we need to unencode entities. Entities other than + // '<' and '>' will be taken care by Jsoup. + elem.html(DesignFormatter.unencodeFromTextNode(elem.html())); + } return elem; } -- cgit v1.2.3