Rich Text Composer: Enable bulleted & numbered lists support

This commit is contained in:
aringenbach 2023-01-05 15:56:04 +01:00
parent 3284437fc0
commit 8b2693284b
7 changed files with 72 additions and 36 deletions

View file

@ -23,7 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift",
"state" : {
"revision" : "534ee5bae5e8de69ed398937b5edb7b5f21551d2"
"revision" : "2f101426d9df13b830e87a5e6f0ac672e8118ca0",
"version" : "0.15.0"
}
},
{

View file

@ -2559,6 +2559,8 @@ To enable access, tap Settings> Location and select Always";
"wysiwyg_composer_format_action_strikethrough" = "Apply underline format";
"wysiwyg_composer_format_action_link" = "Apply link format";
"wysiwyg_composer_format_action_inline_code" = "Apply inline code format";
"wysiwyg_composer_format_action_unordered_list" = "Toggle bulleted list";
"wysiwyg_composer_format_action_ordered_list" = "Toggle numbered list";
// Links
"wysiwyg_composer_link_action_text" = "Text";

View file

@ -9359,6 +9359,10 @@ public class VectorL10n: NSObject {
public static var wysiwygComposerFormatActionLink: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_link")
}
/// Toggle numbered list
public static var wysiwygComposerFormatActionOrderedList: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_ordered_list")
}
/// Apply underline format
public static var wysiwygComposerFormatActionStrikethrough: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_strikethrough")
@ -9367,6 +9371,10 @@ public class VectorL10n: NSObject {
public static var wysiwygComposerFormatActionUnderline: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_underline")
}
/// Toggle bulleted list
public static var wysiwygComposerFormatActionUnorderedList: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_unordered_list")
}
/// Create a link
public static var wysiwygComposerLinkActionCreateTitle: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_link_action_create_title")

View file

@ -35,6 +35,8 @@ enum FormatType {
case underline
case strikethrough
case inlineCode
case unorderedList
case orderedList
case link
}
@ -54,14 +56,18 @@ extension FormatItem {
return Asset.Images.bold.name
case .italic:
return Asset.Images.italic.name
case .strikethrough:
return Asset.Images.strikethrough.name
case .underline:
return Asset.Images.underlined.name
case .link:
return Asset.Images.link.name
case .strikethrough:
return Asset.Images.strikethrough.name
case .inlineCode:
return Asset.Images.code.name
case .unorderedList:
return Asset.Images.bulletList.name
case .orderedList:
return Asset.Images.numberedList.name
case .link:
return Asset.Images.link.name
}
}
@ -71,14 +77,18 @@ extension FormatItem {
return "boldButton"
case .italic:
return "italicButton"
case .strikethrough:
return "strikethroughButton"
case .underline:
return "underlineButton"
case .link:
return "linkButton"
case .strikethrough:
return "strikethroughButton"
case .inlineCode:
return "inlineCodeButton"
case .unorderedList:
return "unorderedListButton"
case .orderedList:
return "orderedListButton"
case .link:
return "linkButton"
}
}
@ -88,14 +98,18 @@ extension FormatItem {
return VectorL10n.wysiwygComposerFormatActionBold
case .italic:
return VectorL10n.wysiwygComposerFormatActionItalic
case .strikethrough:
return VectorL10n.wysiwygComposerFormatActionStrikethrough
case .underline:
return VectorL10n.wysiwygComposerFormatActionUnderline
case .link:
return VectorL10n.wysiwygComposerFormatActionLink
case .strikethrough:
return VectorL10n.wysiwygComposerFormatActionStrikethrough
case .inlineCode:
return VectorL10n.wysiwygComposerFormatActionInlineCode
case .unorderedList:
return VectorL10n.wysiwygComposerFormatActionUnorderedList
case .orderedList:
return VectorL10n.wysiwygComposerFormatActionOrderedList
case .link:
return VectorL10n.wysiwygComposerFormatActionLink
}
}
}
@ -108,14 +122,18 @@ extension FormatType {
return .bold
case .italic:
return .italic
case .strikethrough:
return .strikeThrough
case .underline:
return .underline
case .link:
return .link
case .strikethrough:
return .strikeThrough
case .inlineCode:
return .inlineCode
case .unorderedList:
return .unorderedList
case .orderedList:
return .orderedList
case .link:
return .link
}
}
@ -127,14 +145,18 @@ extension FormatType {
return .bold
case .italic:
return .italic
case .strikethrough:
return .strikeThrough
case .underline:
return .underline
case .link:
return .link
case .strikethrough:
return .strikeThrough
case .unorderedList:
return .unorderedList
case .orderedList:
return .orderedList
case .inlineCode:
return .inlineCode
case .link:
return .link
}
}
}

View file

@ -32,21 +32,23 @@ struct FormattingToolbar: View {
var formatAction: (FormatType) -> Void
var body: some View {
HStack(spacing: 4) {
ForEach(formatItems) { item in
Button {
formatAction(item.type)
} label: {
Image(item.icon)
.renderingMode(.template)
.foregroundColor(getForegroundColor(for: item))
ScrollView(.horizontal) {
HStack(spacing: 4) {
ForEach(formatItems) { item in
Button {
formatAction(item.type)
} label: {
Image(item.icon)
.renderingMode(.template)
.foregroundColor(getForegroundColor(for: item))
}
.disabled(item.state == .disabled)
.frame(width: 44, height: 44)
.background(getBackgroundColor(for: item))
.cornerRadius(8)
.accessibilityIdentifier(item.accessibilityIdentifier)
.accessibilityLabel(item.accessibilityLabel)
}
.disabled(item.state == .disabled)
.frame(width: 44, height: 44)
.background(getBackgroundColor(for: item))
.cornerRadius(8)
.accessibilityIdentifier(item.accessibilityIdentifier)
.accessibilityLabel(item.accessibilityLabel)
}
}
}

1
changelog.d/7238.feature Normal file
View file

@ -0,0 +1 @@
Rich Text Composer: Enable bulleted/numbered lists support

View file

@ -53,7 +53,7 @@ packages:
branch: main
WysiwygComposer:
url: https://github.com/matrix-org/matrix-wysiwyg-composer-swift
revision: 534ee5bae5e8de69ed398937b5edb7b5f21551d2
version: 0.15.0
DeviceKit:
url: https://github.com/devicekit/DeviceKit
majorVersion: 4.7.0