Skip to content

Commit

Permalink
Update sample and getter code
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-megh-l committed Feb 13, 2024
1 parent d14563b commit 3f66824
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 33 deletions.
79 changes: 57 additions & 22 deletions app/src/main/assets/android-quill-sample.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,118 @@
{
"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
}
},
{
"insert": "\n",
"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": {}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3f66824

Please sign in to comment.