Skip to content

Commit

Permalink
Added support for strikethrough tag in EditorFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
aforcier committed Apr 29, 2015
1 parent efcde28 commit 9b89d36
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class EditorFragment extends EditorFragmentAbstract implements View.OnCli
private static final String TAG_FORMAT_BAR_BUTTON_UL = "unorderedList";
private static final String TAG_FORMAT_BAR_BUTTON_OL = "orderedList";
private static final String TAG_FORMAT_BAR_BUTTON_LINK = "link";
private static final String TAG_FORMAT_BAR_BUTTON_STRIKETHROUGH = "strikeThrough";

private static final float TOOLBAR_ALPHA_ENABLED = 1;
private static final float TOOLBAR_ALPHA_DISABLED = 0.5f;
Expand Down Expand Up @@ -96,6 +97,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
ToggleButton linkButton = (ToggleButton) view.findViewById(R.id.format_bar_button_link);
mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_LINK, linkButton);

// Tablet-only
ToggleButton strikethroughButton = (ToggleButton) view.findViewById(R.id.format_bar_button_strikethrough);
if (strikethroughButton != null) {
mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_STRIKETHROUGH, strikethroughButton);
}

ToggleButton htmlButton = (ToggleButton) view.findViewById(R.id.format_bar_button_html);
htmlButton.setOnClickListener(this);

Expand Down Expand Up @@ -128,6 +135,8 @@ public void onClick(View v) {
mWebView.execJavaScriptFromString("ZSSEditor.setBold();");
} else if (id == R.id.format_bar_button_italic) {
mWebView.execJavaScriptFromString("ZSSEditor.setItalic();");
} else if (id == R.id.format_bar_button_strikethrough) {
mWebView.execJavaScriptFromString("ZSSEditor.setStrikeThrough();");
} else if (id == R.id.format_bar_button_quote) {
mWebView.execJavaScriptFromString("ZSSEditor.setBlockquote();");
} else if (id == R.id.format_bar_button_ul) {
Expand Down

0 comments on commit 9b89d36

Please sign in to comment.