From 9ca9ce7bccc97b8c85b996e295b1c6d46b8c9bd1 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 30 Apr 2015 17:26:48 +1200 Subject: [PATCH] Add support for styleWithSpan setting. This allows the developer to choose between CSS styles (default) or HTML styles (eg, , tags) --- .../summernote/client/ui/base/SummernoteBase.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/SummernoteBase.java b/src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/SummernoteBase.java index 0814ab4d..3470468e 100644 --- a/src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/SummernoteBase.java +++ b/src/main/java/org/gwtbootstrap3/extras/summernote/client/ui/base/SummernoteBase.java @@ -42,6 +42,7 @@ public class SummernoteBase extends TextArea { private boolean hasFocus = false; private String code; private Toolbar toolbar = buildDefaultToolbar(); + private boolean styleWithSpan = true; public SummernoteBase() { } @@ -61,6 +62,10 @@ public void setToolbar(final Toolbar toolbar) { public void setCode(final String code) { this.code = code; } + + public void setStyleWithSpan(final boolean styleWithSpan) { + this.styleWithSpan = styleWithSpan; + } public HandlerRegistration addInitializedHandler(final SummernoteInitializedHandler handler) { return addHandler(handler, SummernoteInitializedEvent.getType()); @@ -126,7 +131,7 @@ private Toolbar buildDefaultToolbar() { } private void initialize() { - initialize(getElement(), height, hasFocus, toolbar.build()); + initialize(getElement(), height, hasFocus, styleWithSpan, toolbar.build()); if (code != null) { setCode(getElement(), code); @@ -181,13 +186,14 @@ protected void onPaste(final Event evt) { fireEvent(new SummernoteOnPasteEvent(this, evt)); } - private native void initialize(Element e, int height, boolean hasFocus, JavaScriptObject toolbar) /*-{ + private native void initialize(Element e, int height, boolean hasFocus, boolean styleWithSpan, JavaScriptObject toolbar) /*-{ var target = this; $wnd.jQuery(e).summernote({ height: height, focus: hasFocus, toolbar: toolbar, + styleWithSpan: styleWithSpan, oninit: function (evt) { target.@org.gwtbootstrap3.extras.summernote.client.ui.base.SummernoteBase::onInitialize(Lcom/google/gwt/user/client/Event;)(evt); },