Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Add support for styleWithSpan setting. This allows the developer to
Browse files Browse the repository at this point in the history
choose between CSS styles (default) or HTML styles (eg, <b>, <i> tags)
  • Loading branch information
mharray committed Apr 30, 2015
1 parent a576cbb commit 9ca9ce7
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand All @@ -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());
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
},
Expand Down

0 comments on commit 9ca9ce7

Please sign in to comment.