mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:02:10 +00:00
RTE Update (#2446)
This commit is contained in:
@@ -6791,7 +6791,7 @@
|
||||
repositoryURL = "https://github.com/matrix-org/matrix-wysiwyg-composer-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 2.28.0;
|
||||
version = 2.29.0;
|
||||
};
|
||||
};
|
||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||
|
||||
@@ -138,8 +138,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift",
|
||||
"state" : {
|
||||
"revision" : "7b341602195b6527eb34c61cc6bd479f7631409d",
|
||||
"version" : "2.28.0"
|
||||
"revision" : "f788fe2482c0b89019f679a1f43dccf9c25a0782",
|
||||
"version" : "2.29.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
private let wysiwygViewModel: WysiwygComposerViewModel
|
||||
private let completionSuggestionService: CompletionSuggestionServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let mentionDisplayHelper: MentionDisplayHelper
|
||||
private var hasAppeard = false
|
||||
|
||||
private let actionsSubject: PassthroughSubject<ComposerToolbarViewModelAction, Never> = .init()
|
||||
@@ -47,7 +46,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
self.wysiwygViewModel = wysiwygViewModel
|
||||
self.completionSuggestionService = completionSuggestionService
|
||||
self.appSettings = appSettings
|
||||
self.mentionDisplayHelper = mentionDisplayHelper
|
||||
|
||||
super.init(initialViewState: ComposerToolbarViewState(audioPlayerState: .init(id: .recorderPreview, duration: 0),
|
||||
audioRecorderState: .init(),
|
||||
@@ -102,7 +100,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
.weakAssign(to: \.state.suggestions, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
|
||||
setupMentionsHandling(mentionDisplayHelper: mentionDisplayHelper)
|
||||
focusComposerIfHardwareKeyboardConnected()
|
||||
}
|
||||
|
||||
@@ -111,7 +110,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
override func process(viewAction: ComposerToolbarViewAction) {
|
||||
switch viewAction {
|
||||
case .composerAppeared:
|
||||
setupMentionsHandlingIfNecessary()
|
||||
if !hasAppeard {
|
||||
hasAppeard = true
|
||||
wysiwygViewModel.setup()
|
||||
@@ -205,12 +203,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
}
|
||||
|
||||
private func setupMentionsHandlingIfNecessary() {
|
||||
guard let textView = wysiwygViewModel.textView,
|
||||
textView.mentionDisplayHelper == nil else {
|
||||
return
|
||||
}
|
||||
textView.mentionDisplayHelper = mentionDisplayHelper
|
||||
private func setupMentionsHandling(mentionDisplayHelper: MentionDisplayHelper) {
|
||||
wysiwygViewModel.mentionDisplayHelper = mentionDisplayHelper
|
||||
|
||||
let attributedStringBuilder = AttributedStringBuilder(cacheKey: "Composer", permalinkBaseURL: appSettings.permalinkBaseURL, mentionBuilder: MentionBuilder())
|
||||
|
||||
@@ -261,7 +255,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
|
||||
private func set(text: String) {
|
||||
wysiwygViewModel.textView?.flushPills()
|
||||
wysiwygViewModel.textView.flushPills()
|
||||
|
||||
if appSettings.richTextEditorEnabled {
|
||||
wysiwygViewModel.setHtmlContent(text)
|
||||
|
||||
@@ -33,7 +33,6 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
appSettings.richTextEditorEnabled = true
|
||||
ServiceLocator.shared.register(appSettings: appSettings)
|
||||
wysiwygViewModel = WysiwygComposerViewModel()
|
||||
wysiwygViewModel.textView = WysiwygTextView()
|
||||
completionSuggestionServiceMock = CompletionSuggestionServiceMock(configuration: .init())
|
||||
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||
completionSuggestionService: completionSuggestionServiceMock,
|
||||
@@ -150,7 +149,7 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
let suggestion = SuggestionItem.user(item: .init(id: userID, displayName: "Test", avatarURL: nil))
|
||||
viewModel.context.send(viewAction: .selectedSuggestion(suggestion))
|
||||
|
||||
let attachment = wysiwygViewModel.textView?.attributedText.attribute(.attachment, at: 0, effectiveRange: nil) as? PillTextAttachment
|
||||
let attachment = wysiwygViewModel.textView.attributedText.attribute(.attachment, at: 0, effectiveRange: nil) as? PillTextAttachment
|
||||
XCTAssertEqual(attachment?.pillData?.type, .user(userID: userID))
|
||||
}
|
||||
|
||||
@@ -160,7 +159,7 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
let suggestion = SuggestionItem.allUsers(item: .allUsersMention(roomAvatar: nil))
|
||||
viewModel.context.send(viewAction: .selectedSuggestion(suggestion))
|
||||
|
||||
let attachment = wysiwygViewModel.textView?.attributedText.attribute(.attachment, at: 0, effectiveRange: nil) as? PillTextAttachment
|
||||
let attachment = wysiwygViewModel.textView.attributedText.attribute(.attachment, at: 0, effectiveRange: nil) as? PillTextAttachment
|
||||
XCTAssertEqual(attachment?.pillData?.type, .allUsers)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ packages:
|
||||
# path: ../swift-ogg
|
||||
WysiwygComposer:
|
||||
url: https://github.com/matrix-org/matrix-wysiwyg-composer-swift
|
||||
exactVersion: 2.28.0
|
||||
exactVersion: 2.29.0
|
||||
# path: ../matrix-wysiwyg/platforms/ios/lib/WysiwygComposer
|
||||
|
||||
# External dependencies
|
||||
|
||||
Reference in New Issue
Block a user