Skip to content

Commit

Permalink
Integrate lists to the rich text editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyandrew committed Jan 4, 2023
1 parent 5e97134 commit 624c5d6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/7887.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add your info here
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ext.libs = [
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0",
'wysiwyg' : "io.element.android:wysiwyg:0.10.0"
'wysiwyg' : "io.element.android:wysiwyg:0.13.0"
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",
Expand Down
2 changes: 2 additions & 0 deletions library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3485,6 +3485,8 @@
<string name="rich_text_editor_format_strikethrough">Apply strikethrough format</string>
<string name="rich_text_editor_format_underline">Apply underline format</string>
<string name="rich_text_editor_link">Set link</string>
<string name="rich_text_editor_numbered_list">Toggle numbered list</string>
<string name="rich_text_editor_bullet_list">Toggle bullet list</string>
<string name="rich_text_editor_full_screen_toggle">Toggle full screen mode</string>

<string name="set_link_text">Text</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ internal class RichTextComposerLayout @JvmOverloads constructor(
}
}
}
addRichTextMenuItem(R.drawable.ic_composer_bullet_list, R.string.rich_text_editor_bullet_list, ComposerAction.UNORDERED_LIST) {
views.richTextComposerEditText.toggleList(false)
}
addRichTextMenuItem(R.drawable.ic_composer_numbered_list, R.string.rich_text_editor_numbered_list, ComposerAction.ORDERED_LIST) {
views.richTextComposerEditText.toggleList(true)
}
}

fun setLink(link: String?) =
Expand Down
13 changes: 13 additions & 0 deletions vector/src/main/res/drawable/ic_composer_bullet_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<group>
<clip-path
android:pathData="M10,10h24v24h-24z"/>
<path
android:pathData="M14,20.5C13.17,20.5 12.5,21.17 12.5,22C12.5,22.83 13.17,23.5 14,23.5C14.83,23.5 15.5,22.83 15.5,22C15.5,21.17 14.83,20.5 14,20.5ZM14,14.5C13.17,14.5 12.5,15.17 12.5,16C12.5,16.83 13.17,17.5 14,17.5C14.83,17.5 15.5,16.83 15.5,16C15.5,15.17 14.83,14.5 14,14.5ZM14,26.5C13.17,26.5 12.5,27.18 12.5,28C12.5,28.82 13.18,29.5 14,29.5C14.82,29.5 15.5,28.82 15.5,28C15.5,27.18 14.83,26.5 14,26.5ZM18,29H30C30.55,29 31,28.55 31,28C31,27.45 30.55,27 30,27H18C17.45,27 17,27.45 17,28C17,28.55 17.45,29 18,29ZM18,23H30C30.55,23 31,22.55 31,22C31,21.45 30.55,21 30,21H18C17.45,21 17,21.45 17,22C17,22.55 17.45,23 18,23ZM17,16C17,16.55 17.45,17 18,17H30C30.55,17 31,16.55 31,16C31,15.45 30.55,15 30,15H18C17.45,15 17,15.45 17,16Z"
android:fillColor="#8D97A5"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions vector/src/main/res/drawable/ic_composer_numbered_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<group>
<clip-path
android:pathData="M10,10h24v24h-24z"/>
<path
android:pathData="M18,17H30C30.55,17 31,16.55 31,16C31,15.45 30.55,15 30,15H18C17.45,15 17,15.45 17,16C17,16.55 17.45,17 18,17ZM30,27H18C17.45,27 17,27.45 17,28C17,28.55 17.45,29 18,29H30C30.55,29 31,28.55 31,28C31,27.45 30.55,27 30,27ZM30,21H18C17.45,21 17,21.45 17,22C17,22.55 17.45,23 18,23H30C30.55,23 31,22.55 31,22C31,21.45 30.55,21 30,21ZM14.5,26H12.5C12.22,26 12,26.22 12,26.5C12,26.78 12.22,27 12.5,27H14V27.5H13.5C13.22,27.5 13,27.72 13,28C13,28.28 13.22,28.5 13.5,28.5H14V29H12.5C12.22,29 12,29.22 12,29.5C12,29.78 12.22,30 12.5,30H14.5C14.78,30 15,29.78 15,29.5V26.5C15,26.22 14.78,26 14.5,26ZM12.5,15H13V17.5C13,17.78 13.22,18 13.5,18C13.78,18 14,17.78 14,17.5V14.5C14,14.22 13.78,14 13.5,14H12.5C12.22,14 12,14.22 12,14.5C12,14.78 12.22,15 12.5,15ZM14.5,20H12.5C12.22,20 12,20.22 12,20.5C12,20.78 12.22,21 12.5,21H13.8L12.12,22.96C12.04,23.05 12,23.17 12,23.28V23.5C12,23.78 12.22,24 12.5,24H14.5C14.78,24 15,23.78 15,23.5C15,23.22 14.78,23 14.5,23H13.2L14.88,21.04C14.96,20.95 15,20.83 15,20.72V20.5C15,20.22 14.78,20 14.5,20Z"
android:fillColor="#8D97A5"/>
</group>
</vector>

0 comments on commit 624c5d6

Please sign in to comment.