Skip to content

Commit

Permalink
处理插入图片位置不对的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yuruiyin committed May 17, 2019
1 parent 6d32a90 commit 270cc25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {

implementation 'com.google.code.gson:gson:2.8.5'

// implementation 'com.github.yuruiyin:RichEditor:0.0.2'
// implementation 'com.github.yuruiyin:RichEditor:0.0.5'

implementation 'com.google.android:flexbox:1.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ private RichEditorBlock getRichEditorBlock(

List<RichEditorBlock> getContent() {
List<RichEditorBlock> richEditorBlockList = new ArrayList<>();
//为了代码容易处理,如果文本末尾不是'\n',则强制在末尾增加一个回车
Editable editableTmp = mRichEditText.getEditableText();
if (editableTmp.length() <= 0) {
return richEditorBlockList;
}
if (editableTmp.charAt(editableTmp.length() - 1) != '\n') {
insertStringIntoEditText("\n", editableTmp.length());
}

String editTextContent = mRichEditText.getEditableText().toString();
//为了代码容易处理,如果文本末尾不是'\n',则强制在末尾增加一个回车
if (editTextContent.charAt(editableTmp.length() - 1) != '\n') {
editTextContent += "\n";
}
Editable editable = mRichEditText.getEditableText();
int editTextLen = editTextContent.length();

Expand Down

0 comments on commit 270cc25

Please sign in to comment.