Open liuchonghui opened 9 years ago
Fixed.I tried this way:
js add:
RE.editor.addEventListener("paste", function(evt) {
evt.preventDefault();
var plain = ClipboardReader.getClipboardDataAsText();
RE.insertHTML(plain);
});
RichEditor.java add:
private class ClipboardReader {
public String getClipboardDataAsText() {
String plainText = "";
ClipboardManager cm = (ClipboardManager) getContext()
.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData cd = cm.getPrimaryClip();
if (cd != null && cd.getItemAt(0) != null) {
Item item = cd.getItemAt(0);
plainText = item.getText().toString();
}
return plainText;
}
}
and regist "ClipboardReader":
addJavascriptInterface(new ClipboardReader(), "ClipboardReader");
RE.editor.addEventListener("paste", function(evt) { evt.preventDefault(); var pasteData = evt.clipboardData; // pasteData getData.length = 0 } How to fix it..I want to remove css style from pasted contents.