Skip to content

Commit 83c3108

Browse files
committed
Added notes and logging for some currently unused JS callbacks
1 parent abcf3e3 commit 83c3108

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

WordPressEditor/src/main/java/org/wordpress/android/editor/JsCallbackHandler.java

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@
1010
public class JsCallbackHandler {
1111
private static final String JS_CALLBACK_DELIMITER = "~";
1212

13-
private static final String CALLBACK_LOG = "callback-log";
14-
1513
private static final String CALLBACK_DOM_LOADED = "callback-dom-loaded";
14+
private static final String CALLBACK_NEW_FIELD = "callback-new-field";
1615

17-
private static final String CALLBACK_SELECTION_STYLE = "callback-selection-style";
16+
private static final String CALLBACK_INPUT = "callback-input";
1817
private static final String CALLBACK_SELECTION_CHANGED = "callback-selection-changed";
18+
private static final String CALLBACK_SELECTION_STYLE = "callback-selection-style";
1919

2020
private static final String CALLBACK_FOCUS_IN = "callback-focus-in";
2121
private static final String CALLBACK_FOCUS_OUT = "callback-focus-out";
2222

2323
private static final String CALLBACK_IMAGE_REPLACED = "callback-image-replaced";
2424
private static final String CALLBACK_IMAGE_TAP = "callback-image-tap";
25-
private static final String CALLBACK_INPUT = "callback-input";
2625
private static final String CALLBACK_LINK_TAP = "callback-link-tap";
2726

28-
private static final String CALLBACK_NEW_FIELD = "callback-new-field";
27+
private static final String CALLBACK_LOG = "callback-log";
2928

3029
private final JsCallbackListener mJsCallbackListener;
3130

@@ -47,12 +46,32 @@ public void executeCallback(String callbackId, String params) {
4746
mJsCallbackListener.onSelectionStyleChanged(Utils.getChangeMapFromSets(mPreviousStyleSet, newStyleSet));
4847
mPreviousStyleSet = newStyleSet;
4948
break;
49+
case CALLBACK_SELECTION_CHANGED:
50+
// Called when changes are made to selection (includes moving the caret without selecting text)
51+
// TODO: Possibly needed for handling WebView scrolling when caret moves (from iOS)
52+
break;
53+
case CALLBACK_INPUT:
54+
// Called on key press
55+
// TODO: Possibly needed for handling WebView scrolling when caret moves (from iOS)
56+
break;
57+
case CALLBACK_FOCUS_IN:
58+
// TODO: Needed to handle displaying/graying the format bar when focus changes between the title and content
59+
AppLog.d(AppLog.T.EDITOR, "Focus in callback received");
60+
break;
61+
case CALLBACK_FOCUS_OUT:
62+
// TODO: Needed to handle displaying/graying the format bar when focus changes between the title and content
63+
AppLog.d(AppLog.T.EDITOR, "Focus out callback received");
64+
break;
65+
case CALLBACK_NEW_FIELD:
66+
// TODO: Used for logging/testing purposes on iOS
67+
AppLog.d(AppLog.T.EDITOR, "New field created, " + params);
68+
break;
5069
case CALLBACK_LOG:
5170
// Strip 'msg=' from beginning of string
5271
AppLog.d(AppLog.T.EDITOR, callbackId + ": " + params.substring(4));
5372
break;
5473
default:
55-
AppLog.d(AppLog.T.EDITOR, "unhandled callback: " + callbackId + ":" + params);
74+
AppLog.d(AppLog.T.EDITOR, "Unhandled callback: " + callbackId + ":" + params);
5675
}
5776
}
5877
}

0 commit comments

Comments
 (0)