diff --git a/app/src/main/assets/android-quill-sample.json b/app/src/main/assets/android-quill-sample.json index 1484a09..2f27598 100644 --- a/app/src/main/assets/android-quill-sample.json +++ b/app/src/main/assets/android-quill-sample.json @@ -1,48 +1,51 @@ { "spans": [ { - "insert": "Android Quill Editor", + "insert": "RichEditor", "attributes": { "bold": true, "header": 1 } }, { - "insert": "\n", + "insert": "\nAndroid ", "attributes": {} }, { - "insert": "\nRich text editor for Android", + "insert": "WYSIWYG ", "attributes": { "bold": true, - "header": 2 + "italic": true } }, { - "insert": "\n", + "insert": "Rich editor for ", "attributes": {} }, { - "insert": "Quill component for Android\n", + "insert": "Jetpack compose.\n\n", "attributes": { - "header": 3, - "italic": true + "bold": true, + "underline": true } }, { - "insert": "Bullet Journal :\nTrack personal and group journals (ToDo, Note, Ledger) from multiple views with timely reminders", + "insert": "Features", "attributes": { - "bold": true + "bold": true, + "header": 3 } }, { - "insert": "\nShare your tasks and notes with teammates, and see changes as they happen in real-time, across all devices\n", + "insert": "\nThe editor offers the following ", "attributes": {} }, { - "insert": "Splitting bills with friends can never be easier.", + "insert": "options:\n", "attributes": { - "list": "bullet" + "bold": true, + "italic": true, + "underline": true } }, { @@ -50,34 +53,66 @@ "attributes": {} }, { - "insert": "Testing span addition to the editor.", + "insert": "Bold\n", + "attributes": { + "bold": true + } + }, + { + "insert": "Italic\n", "attributes": { - "list": "bullet" + "italic": true } }, { - "insert": "\n", + "insert": "Underline\n", + "attributes": { + "underline": true + } + }, + { + "insert": "Different ", "attributes": {} }, { - "insert": "Start creating a group and invite your friends to join.", + "insert": "Headings\n\n", "attributes": { - "list": "bullet" + "bold": true, + "italic": true, + "underline": true } }, { - "insert": "\n", + "insert": "Credits", + "attributes": { + "bold": true, + "header": 3 + } + }, + { + "insert": "\n\n", "attributes": {} }, { - "insert": "Create a BuJo of Ledger type to see expense or balance summary.", + "insert": "RichEditor ", + "attributes": { + "bold": true + } + }, + { + "insert": "for compose is developed and maintained by the ", + "attributes": {} + }, + { + "insert": "canopas team.\n\n", "attributes": { "bold": true, - "list": "bullet" + "italic": true, + "underline": true } }, { - "insert": "\n", + "insert": "Thank You! 😊", "attributes": {} } ] diff --git a/editor/src/main/java/com/canopas/editor/ui/data/QuillTextManager.kt b/editor/src/main/java/com/canopas/editor/ui/data/QuillTextManager.kt index 325822b..b013faa 100644 --- a/editor/src/main/java/com/canopas/editor/ui/data/QuillTextManager.kt +++ b/editor/src/main/java/com/canopas/editor/ui/data/QuillTextManager.kt @@ -108,20 +108,9 @@ class QuillTextManager(quillSpan: QuillSpan) { val nextSpan = quillTextSpans.getOrNull(index + 1) val nextInsert = nextSpan?.let { editableText.substring(nextSpan.from, nextSpan.to + 1) } - val previousSpan = quillTextSpans.getOrNull(index - 1) - val previousInsert = - previousSpan?.let { - editableText.substring( - previousSpan.from, - previousSpan.to + 1 - ) - } if (nextInsert == " " || nextInsert == "") { insert += nextInsert } - if (!previousInsert.isNullOrEmpty() && previousInsert.last() == ' ') { - insert += ' ' - } var attributes = Attributes( header = if (span.style.any { it.isHeaderStyle() }) span.style.find { it.isHeaderStyle() } ?.headerLevel() else null,