Merge branch 'langleyd/6830_wysiwyg_core_formatting' into mauroromito/wysiwyg_edit_reply_UI

# Conflicts:
#	RiotSwiftUI/Modules/Room/Composer/View/Composer.swift
This commit is contained in:
Mauro Romito
2022-10-12 16:48:43 +02:00
9 changed files with 81 additions and 41 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,12 +18,19 @@ import Foundation
import SwiftUI
import WysiwygComposer
// MARK: View
/// An item in the toolbar
struct FormatItem {
/// The type of the item
let type: FormatType
/// Whether it is active(highlighted)
let active: Bool
/// Whether it is disabled or enabled
let disabled: Bool
}
/// The types of formatting actions
enum FormatType {
case bold
case italic
@@ -35,12 +42,12 @@ extension FormatType: CaseIterable, Identifiable {
var id: Self { self }
}
extension FormatItem: Identifiable {
var id: FormatType { type }
}
extension FormatItem {
/// The icon for the item
var icon: String {
switch type {
case .bold:
@@ -69,6 +76,7 @@ extension FormatItem {
}
extension FormatType {
/// Convenience method to map it to the external ViewModel action
var action: WysiwygAction {
switch self {
case .bold:
@@ -82,6 +90,9 @@ extension FormatType {
}
}
// TODO: We probably don't need to expose this, clean up.
/// Convenience method to map it to the external rust binging action
var composerAction: ComposerAction {
switch self {
case .bold: