Skip to content

Commit 8295946

Browse files
authored
android - parser improvements (#65)
1 parent f4a03d0 commit 8295946

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

android/src/main/java/com/swmansion/reactnativerichtexteditor/ReactNativeRichTextEditorView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class ReactNativeRichTextEditorView : AppCompatEditText {
167167
val isHtml = isHtmlTagRecognized || isPTagRecognized
168168
if (isHtml) {
169169
val parsed = EditorParser.fromHtml(value, EditorParser.FROM_HTML_MODE_COMPACT, richTextStyle, null, null)
170-
setText(parsed)
170+
val withoutLastNewLine = parsed.trimEnd('\n')
171+
setText(withoutLastNewLine)
171172
} else {
172173
setText(value)
173174
}

android/src/main/java/com/swmansion/reactnativerichtexteditor/utils/EditorParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public static String toHtml(Spanned text, int option) {
202202
StringBuilder out = new StringBuilder();
203203
withinHtml(out, text, option);
204204
String outString = out.toString();
205-
return "<html>" + outString + "</html>";
205+
return "<html>\n" + outString + "</html>";
206206
}
207207
/**
208208
* Returns an HTML escaped representation of the given plain text.

0 commit comments

Comments
 (0)