From dcd9c0b424f5cfa2243f02d26bf24f59c330739c Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 3 Mar 2025 19:32:19 -0500 Subject: [PATCH] Re-add formatting context menu actions on Compose --- .../ComposeUI/Views/NewMainTextView.swift | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift b/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift index 4f545e54..8505d096 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift @@ -281,8 +281,8 @@ extension WrappedTextViewCoordinator: UITextViewDelegate { if range.length > 0 { let formatMenu = suggestedActions[index] as! UIMenu let newFormatMenu = formatMenu.replacingChildren(StatusFormat.allCases.map { fmt in - return UIAction(title: fmt.accessibilityLabel, image: UIImage(systemName: fmt.imageName)) { _ in - // TODO + return UIAction(title: fmt.accessibilityLabel, image: UIImage(systemName: fmt.imageName)) { [weak self] _ in + self?.applyFormat(fmt) } }) actions[index] = newFormatMenu @@ -290,13 +290,11 @@ extension WrappedTextViewCoordinator: UITextViewDelegate { actions.remove(at: index) } } - // TODO -// if range.length == 0 { -// actions.append(UIAction(title: "Insert Emoji", image: UIImage(systemName: "face.smiling"), handler: { [weak self] _ in -// self?.controller.shouldEmojiAutocompletionBeginExpanded = true -// self?.beginAutocompletingEmoji() -// })) -// } + if range.length == 0 { + actions.append(UIAction(title: "Insert Emoji", image: UIImage(systemName: "face.smiling"), handler: { [weak self] _ in + self?.beginAutocompletingEmoji() + })) + } return UIMenu(children: actions) } }