Skip to content

Commit

Permalink
Fix issue with Android 4.4 where ChromeWebView returns copied text in as
Browse files Browse the repository at this point in the history
a SpannableString type.
Add error message (Exception.toString()) to PluginResult
  • Loading branch information
matt committed Feb 14, 2014
1 parent ac4363e commit d70fe8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/android/Clipboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
} catch (JSONException e) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
} catch (Exception e) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR,e.toString()));
}
} else if (action.equals(actionPaste)) {
if (!clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
Expand All @@ -43,15 +43,15 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo

try {
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
String text = (String) item.getText();
String text = item.getText().toString() ;

if (text == null) text = "";

callbackContext.success(text);

return true;
} catch (Exception e) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR,e.toString()));
}
}

Expand Down

0 comments on commit d70fe8c

Please sign in to comment.