Skip to content

Commit

Permalink
Some EditorFragment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aforcier committed Apr 14, 2015
1 parent db3bd70 commit 418d4b3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.wordpress.android.editor;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -37,6 +38,8 @@ public class EditorFragment extends EditorFragmentAbstract implements View.OnCli

private String mParamTitle;
private String mParamContent;

private Activity mActivity;
private EditorWebView mWebView;

private final Map<String, ToggleButton> mTagToggleButtonMap = new HashMap<>();
Expand All @@ -56,6 +59,7 @@ public EditorFragment() {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = getActivity();
if (getArguments() != null) {
mParamTitle = getArguments().getString(ARG_PARAM_TITLE);
mParamContent = getArguments().getString(ARG_PARAM_CONTENT);
Expand Down Expand Up @@ -104,7 +108,7 @@ public boolean onJsAlert(WebView view, String url, String message, JsResult resu
}
});

String htmlEditor = Utils.getHtmlFromFile(getActivity(), "android-editor.html");
String htmlEditor = Utils.getHtmlFromFile(mActivity, "android-editor.html");

mWebView.addJavascriptInterface(new JsCallbackReceiver(this), JS_CALLBACK_HANDLER);

Expand Down Expand Up @@ -170,7 +174,7 @@ public void onDomLoaded() {
mWebView.post(new Runnable() {
public void run() {
String title = "I'm editing a post!";
String contentHtml = Utils.getHtmlFromFile(getActivity(), "example-content.html");
String contentHtml = Utils.getHtmlFromFile(mActivity, "example-content.html");

mWebView.execJavaScriptFromString("ZSSEditor.getField('zss_field_content').setMultiline('true');");

Expand Down

0 comments on commit 418d4b3

Please sign in to comment.