Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/encode #9

Merged
merged 3 commits into from
Jun 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Attribute change of editor
- [x] Width
- [x] Height
- [x] Placeholder
- [x] Load CSS

**Milestone**

Expand Down Expand Up @@ -71,7 +72,7 @@ repositories {
}

dependencies {
compile 'jp.wasabeef:richeditor-android:0.0.7@aar'
compile 'jp.wasabeef:richeditor-android:0.0.8@aar'
}
```

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=0.0.7
VERSION_CODE=7
VERSION_NAME=0.0.8
VERSION_CODE=8
GROUP=jp.wasabeef
ARTIFACT_ID=richeditor-android

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
* Copyright (C) 2015 Wasabeef
Expand Down Expand Up @@ -113,7 +114,11 @@ public void setHtml(String contents) {
if (contents == null) {
contents = "";
}
exec("javascript:RE.setHtml('" + contents + "');");
try {
exec("javascript:RE.setHtml('" + URLEncoder.encode(contents, "UTF-8") + "');");
} catch (UnsupportedEncodingException e) {
// No handling
}
mContents = contents;
}

Expand Down
2 changes: 1 addition & 1 deletion richeditor/src/main/res/raw/rich_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RE.callback = function() {
RE.editor.addEventListener("input", RE.callback);

RE.setHtml = function(contents) {
RE.editor.innerHTML = contents;
RE.editor.innerHTML = decodeURIComponent(contents.replace(/\+/g, '%20'));
}

RE.getHtml = function() {
Expand Down