Skip to content

Commit

Permalink
Add formatter extension to toggle formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tonisevener committed Dec 15, 2023
1 parent c23d425 commit 7de2c81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import ComponentsObjC

extension WKSourceEditorFormatterStrikethrough {
func toggleStrikethroughFormatting(action: WKSourceEditorFormatterButtonAction, in textView: UITextView) {
toggleFormatting(startingFormattingString: "<s>", endingFormattingString: "</s>", action: action, in: textView)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ extension WKSourceEditorViewController: WKEditorInputViewDelegate {
}

func didTapStrikethrough(isSelected: Bool) {
let action: WKSourceEditorFormatterButtonAction = isSelected ? .remove : .add
textFrameworkMediator.strikethroughFormatter?.toggleStrikethroughFormatting(action: action, in: textView)
}

func didTapClose() {
Expand Down

0 comments on commit 7de2c81

Please sign in to comment.