Composer and RTE polish (#1719)

* Move link button

* Always show indent buttons

* Fix code blocks and quote block styles

* Fix code blocks and quotes style

* Update composer attachment icon

* Fix send message icon

* Fix composer border

* Fix rte border

* Update RTE button assets

* Update close rte icon

* Refactor RTE and composer layout

* more padding fixes

* Update compound

* Update WysiwygComposer to 2.11.0

* Fix ui tests

* Fix composer bottom padding

* Update snapshot tests
This commit is contained in:
Alfonso Grillo
2023-09-18 16:11:22 +02:00
committed by GitHub
parent 38107b7b2c
commit 8ca3500981
108 changed files with 338 additions and 226 deletions
@@ -15,6 +15,7 @@
//
import Combine
import HTMLParser
import SwiftUI
import WysiwygComposer
@@ -63,7 +64,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
wysiwygViewModel = WysiwygComposerViewModel(minHeight: ComposerConstant.minHeight,
maxCompressedHeight: ComposerConstant.maxHeight,
maxExpandedHeight: ComposerConstant.maxHeight)
maxExpandedHeight: ComposerConstant.maxHeight,
parserStyle: .elementX)
composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel)
}
@@ -133,3 +135,20 @@ enum ComposerConstant {
static let allowedHeightRange = minHeight...maxHeight
static let translationThreshold: CGFloat = 60
}
private extension HTMLParserStyle {
static let elementX = HTMLParserStyle(textColor: UIColor.label,
linkColor: UIColor.link,
codeBlockStyle: BlockStyle(backgroundColor: UIColor(.compound._bgCodeBlock),
borderColor: UIColor(.compound.borderInteractiveSecondary),
borderWidth: 0.0,
cornerRadius: 0.0,
padding: BlockStyle.Padding(horizontal: 10, vertical: 12),
type: .background),
quoteBlockStyle: BlockStyle(backgroundColor: UIColor(.compound.iconTertiary),
borderColor: UIColor(.compound.borderInteractiveSecondary),
borderWidth: 0.0,
cornerRadius: 0.0,
padding: BlockStyle.Padding(horizontal: 25, vertical: 12),
type: .side(offset: 5, width: 4)))
}
@@ -23,8 +23,6 @@ struct RoomScreen: View {
@State private var dragOver = false
let composerToolbar: ComposerToolbar
private let attachmentButtonPadding = 10.0
init(context: RoomScreenViewModel.Context, composerToolbar: ComposerToolbar) {
self.context = context
self.composerToolbar = composerToolbar
@@ -36,13 +34,13 @@ struct RoomScreen: View {
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
.safeAreaInset(edge: .bottom, spacing: 0) {
composerToolbar
.padding(.leading, attachmentButtonPadding)
.padding(.trailing, 12)
.padding(.bottom)
.padding(.leading, 5)
.padding(.trailing, 8)
.padding(.bottom, composerToolbarContext.composerActionsEnabled ? 8 : 12)
.background {
if composerToolbarContext.composerActionsEnabled {
RoundedRectangle(cornerRadius: 20)
.stroke(Color.compound._borderTextFieldFocused, lineWidth: 1)
.stroke(Color.compound.borderInteractiveSecondary, lineWidth: 0.5)
.ignoresSafeArea()
}
}