Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labs: Rich text editor: enable list items indentation #7317

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ end

def import_MatrixKit_pods
pod 'libPhoneNumber-iOS', '~> 0.9.13'
pod 'DTCoreText', '~> 1.6.25'
#pod 'DTCoreText/Extension', '~> 1.6.25'
pod 'Down', '~> 0.11.0'
end

Expand Down
22 changes: 20 additions & 2 deletions Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
"version" : "4.7.0"
}
},
{
"identity" : "dtcoretext",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/DTCoreText",
"state" : {
"revision" : "9d2d4d2296e5d2d852a7d3c592b817d913a5d020",
"version" : "1.6.27"
}
},
{
"identity" : "dtfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/DTFoundation.git",
"state" : {
"revision" : "76062513434421cb6c8a1ae1d4f8368a7ebc2da3",
"version" : "1.7.18"
}
},
{
"identity" : "maplibre-gl-native-distribution",
"kind" : "remoteSourceControl",
Expand All @@ -23,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift",
"state" : {
"revision" : "6927cb878376136c4a03d919b689af8dfbdad080",
"version" : "0.19.0"
"revision" : "3f72aeab7d7e04b52ff3f735ab79a75993f97ef2",
"version" : "0.22.0"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2579,8 +2579,8 @@ To enable access, tap Settings> Location and select Always";
"wysiwyg_composer_format_action_ordered_list" = "Toggle numbered list";
"wysiwyg_composer_format_action_code_block" = "Toggle code block";
"wysiwyg_composer_format_action_quote" = "Toggle quote";


"wysiwyg_composer_format_action_indent" = "Increase indentation";
"wysiwyg_composer_format_action_un_indent" = "Decrease indentation";

// Links
"wysiwyg_composer_link_action_text" = "Text";
Expand Down
8 changes: 8 additions & 0 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9403,6 +9403,10 @@ public class VectorL10n: NSObject {
public static var wysiwygComposerFormatActionCodeBlock: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_code_block")
}
/// Increase indentation
public static var wysiwygComposerFormatActionIndent: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_indent")
}
/// Apply inline code format
public static var wysiwygComposerFormatActionInlineCode: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_inline_code")
Expand All @@ -9427,6 +9431,10 @@ public class VectorL10n: NSObject {
public static var wysiwygComposerFormatActionStrikethrough: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_strikethrough")
}
/// Decrease indentation
public static var wysiwygComposerFormatActionUnIndent: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_un_indent")
}
/// Apply strikethrough format
public static var wysiwygComposerFormatActionUnderline: String {
return VectorL10n.tr("Vector", "wysiwyg_composer_format_action_underline")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ class HTMLFormatter: NSObject {

var options: [AnyHashable: Any] = [
DTUseiOS6Attributes: true,
DTDefaultFontFamily: font.familyName,
DTDefaultFontName: font.fontName,
DTDefaultFontSize: font.pointSize,
DTDefaultFontDescriptor: font.fontDescriptor,
DTDefaultLinkDecoration: false,
DTDefaultLinkColor: ThemeService.shared().theme.colors.links,
DTWillFlushBlockCallBack: sanitizeCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import Foundation
import Reusable
import WysiwygComposer
import HTMLParser
import SwiftUI
import Combine
import UIKit
Expand All @@ -43,9 +44,14 @@ class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, HtmlRoomInp
private var voiceMessageBottomConstraint: NSLayoutConstraint?
private var hostingViewController: VectorHostingController!
private var wysiwygViewModel = WysiwygComposerViewModel(
textColor: ThemeService.shared().theme.colors.primaryContent,
linkColor: ThemeService.shared().theme.colors.links,
codeBackgroundColor: ThemeService.shared().theme.selectedBackgroundColor
parserStyle: HTMLParserStyle(textColor: ThemeService.shared().theme.colors.primaryContent,
linkColor: ThemeService.shared().theme.colors.links,
codeBackgroundColor: ThemeService.shared().theme.selectedBackgroundColor,
codeBorderColor: ThemeService.shared().theme.textQuinaryColor,
quoteBackgroundColor: ThemeService.shared().theme.selectedBackgroundColor,
quoteBorderColor: ThemeService.shared().theme.textQuinaryColor,
borderWidth: 1.0,
cornerRadius: 4.0)
)
private var viewModel: ComposerViewModelProtocol!

Expand Down Expand Up @@ -298,9 +304,14 @@ class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, HtmlRoomInp

private func update(theme: Theme) {
hostingViewController.view.backgroundColor = theme.colors.background
wysiwygViewModel.textColor = theme.colors.primaryContent
wysiwygViewModel.linkColor = theme.colors.links
wysiwygViewModel.codeBackgroundColor = theme.selectedBackgroundColor
wysiwygViewModel.parserStyle = HTMLParserStyle(textColor: ThemeService.shared().theme.colors.primaryContent,
linkColor: ThemeService.shared().theme.colors.links,
codeBackgroundColor: ThemeService.shared().theme.selectedBackgroundColor,
codeBorderColor: ThemeService.shared().theme.textQuinaryColor,
quoteBackgroundColor: ThemeService.shared().theme.selectedBackgroundColor,
quoteBorderColor: ThemeService.shared().theme.textQuinaryColor,
borderWidth: 1.0,
cornerRadius: 4.0)
}

private func updateTextViewHeight() {
Expand Down
30 changes: 0 additions & 30 deletions Riot/Utils/EventFormatter+DTCoreTextFix.h

This file was deleted.

80 changes: 0 additions & 80 deletions Riot/Utils/EventFormatter+DTCoreTextFix.m

This file was deleted.

6 changes: 0 additions & 6 deletions Riot/Utils/EventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#import "MXDecryptionResult.h"
#import "DecryptionFailureTracker.h"

#import "EventFormatter+DTCoreTextFix.h"
#import <MatrixSDK/MatrixSDK.h>

#pragma mark - Constants definitions
Expand All @@ -50,11 +49,6 @@ @interface EventFormatter ()

@implementation EventFormatter

+ (void)load
{
[self fixDTCoreTextFont];
}

- (void)initDateTimeFormatters
{
[super initDateTimeFormatters];
Expand Down
1 change: 1 addition & 0 deletions Riot/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ targets:
- package: SwiftOGG
- package: WysiwygComposer
- package: DeviceKit
- package: DTCoreText

configFiles:
Debug: Debug.xcconfig
Expand Down
1 change: 1 addition & 0 deletions RiotNSE/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ targets:

dependencies:
- package: DeviceKit
- package: DTCoreText

configFiles:
Debug: Debug.xcconfig
Expand Down
1 change: 1 addition & 0 deletions RiotShareExtension/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ targets:

dependencies:
- package: DeviceKit
- package: DTCoreText

configFiles:
Debug: Debug.xcconfig
Expand Down
22 changes: 22 additions & 0 deletions RiotSwiftUI/Modules/Room/Composer/Model/ComposerModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ enum FormatType {
case strikethrough
case unorderedList
case orderedList
case indent
case unIndent
case inlineCode
case codeBlock
case quote
Expand Down Expand Up @@ -66,6 +68,10 @@ extension FormatItem {
return Asset.Images.bulletList.name
case .orderedList:
return Asset.Images.numberedList.name
case .indent:
return Asset.Images.indentIncrease.name
case .unIndent:
return Asset.Images.indentDecrease.name
case .inlineCode:
return Asset.Images.code.name
case .codeBlock:
Expand All @@ -91,6 +97,10 @@ extension FormatItem {
return "unorderedListButton"
case .orderedList:
return "orderedListButton"
case .indent:
return "indentListButton"
case .unIndent:
return "unIndentButton"
case .inlineCode:
return "inlineCodeButton"
case .codeBlock:
Expand All @@ -116,6 +126,10 @@ extension FormatItem {
return VectorL10n.wysiwygComposerFormatActionUnorderedList
case .orderedList:
return VectorL10n.wysiwygComposerFormatActionOrderedList
case .indent:
return VectorL10n.wysiwygComposerFormatActionIndent
case .unIndent:
return VectorL10n.wysiwygComposerFormatActionUnIndent
case .inlineCode:
return VectorL10n.wysiwygComposerFormatActionInlineCode
case .codeBlock:
Expand Down Expand Up @@ -144,6 +158,10 @@ extension FormatType {
return .unorderedList
case .orderedList:
return .orderedList
case .indent:
return .indent
case .unIndent:
return .unIndent
case .inlineCode:
return .inlineCode
case .codeBlock:
Expand Down Expand Up @@ -171,6 +189,10 @@ extension FormatType {
return .unorderedList
case .orderedList:
return .orderedList
case .indent:
return .indent
case .unIndent:
return .unIndent
case .inlineCode:
return .inlineCode
case .codeBlock:
Expand Down
1 change: 1 addition & 0 deletions SiriIntents/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ targets:
dependencies:
- sdk: Intents.framework
- package: DeviceKit
- package: DTCoreText

configFiles:
Debug: Debug.xcconfig
Expand Down
1 change: 1 addition & 0 deletions changelog.d/7316.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Labs: Rich text editor: enable list items indentation
5 changes: 4 additions & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ packages:
branch: main
WysiwygComposer:
url: https://github.com/matrix-org/matrix-wysiwyg-composer-swift
version: 0.19.0
version: 0.22.0
DeviceKit:
url: https://github.com/devicekit/DeviceKit
majorVersion: 4.7.0
DTCoreText:
url: https://github.com/Cocoanetics/DTCoreText
version: 1.6.27