diff --git a/Sources/RichTextKit/Actions/RichTextAction.swift b/Sources/RichTextKit/Actions/RichTextAction.swift index be57a0e22..5bfa2002b 100644 --- a/Sources/RichTextKit/Actions/RichTextAction.swift +++ b/Sources/RichTextKit/Actions/RichTextAction.swift @@ -48,19 +48,19 @@ public enum RichTextAction: Identifiable, Equatable, RichTextLabelValue { case undoLatestChange // Change background color - case backgroundColor(ColorRepresentable) + case setBackgroundColor(ColorRepresentable) // Change foreground color - case foregroundColor(ColorRepresentable) + case setForegroundColor(ColorRepresentable) // Change underline color - case underlineColor(ColorRepresentable) + case setUnderlineColor(ColorRepresentable) // Change strikethrough color - case strikethroughColor(ColorRepresentable) + case setStrikethroughColor(ColorRepresentable) // Change stroke color - case strokeColor(ColorRepresentable) + case setStrokeColor(ColorRepresentable) // Highlighted renge case highlightedRange(NSRange?) @@ -101,11 +101,11 @@ public extension RichTextAction { case .stepSuperscript(let val): .richTextStepSuperscript(val) case .toggleStyle(let val): val.icon case .undoLatestChange: .richTextActionUndo - case .backgroundColor: .richTextColorBackground - case .foregroundColor: .richTextColorForeground - case .underlineColor: .richTextColorUnderline - case .strikethroughColor: .richTextColorStrikethrough - case .strokeColor: .richTextColorStroke + case .setBackgroundColor: .richTextColorBackground + case .setForegroundColor: .richTextColorForeground + case .setUnderlineColor: .richTextColorUnderline + case .setStrikethroughColor: .richTextColorStrikethrough + case .setStrokeColor: .richTextColorStroke case .highlightedRange: .richTextAlignmentCenter case .highlightingStyle: .richTextAlignmentCenter case .pasteImage: .richTextDocuments @@ -149,11 +149,11 @@ public extension RichTextAction { case .stepSuperscript(let steps): .actionStepSuperscript(steps) case .toggleStyle(let style): style.titleKey case .undoLatestChange: .actionUndoLatestChange - case .backgroundColor: .backgroundColor - case .foregroundColor: .foregroundColor - case .underlineColor: .underlineColor - case .strikethroughColor: .strikethroughColor - case .strokeColor: .strokeColor + case .setBackgroundColor: .backgroundColor + case .setForegroundColor: .foregroundColor + case .setUnderlineColor: .underlineColor + case .setStrikethroughColor: .strikethroughColor + case .setStrokeColor: .strokeColor case .highlightedRange: .highlightedRange case .highlightingStyle: .highlightingStyle case .pasteImage: .pasteImage diff --git a/Sources/RichTextKit/Context/RichTextContext+Actions.swift b/Sources/RichTextKit/Context/RichTextContext+Actions.swift index 5799badc4..e07d275cc 100644 --- a/Sources/RichTextKit/Context/RichTextContext+Actions.swift +++ b/Sources/RichTextKit/Context/RichTextContext+Actions.swift @@ -34,11 +34,11 @@ public extension RichTextContext { case .stepSuperscript: return false case .toggleStyle: return true case .undoLatestChange: return canUndoLatestChange - case .backgroundColor: return true - case .foregroundColor: return true - case .underlineColor: return true - case .strikethroughColor: return true - case .strokeColor: return true + case .setBackgroundColor: return true + case .setForegroundColor: return true + case .setUnderlineColor: return true + case .setStrikethroughColor: return true + case .setStrokeColor: return true case .highlightedRange: return true case .highlightingStyle: return true case .pasteImage: return true diff --git a/Sources/RichTextKit/Context/RichTextContext+Colors.swift b/Sources/RichTextKit/Context/RichTextContext+Colors.swift index f3c5c30fe..9674121ca 100644 --- a/Sources/RichTextKit/Context/RichTextContext+Colors.swift +++ b/Sources/RichTextKit/Context/RichTextContext+Colors.swift @@ -37,11 +37,11 @@ public extension RichTextContext { ) { guard self.color(for: val) != color else { return } switch val { - case .foreground: userActionPublisher.send(.foregroundColor(color)); foregroundColor = color - case .background: userActionPublisher.send(.backgroundColor(color)); backgroundColor = color - case .strikethrough: userActionPublisher.send(.strikethroughColor(color)); strikethroughColor = color - case .stroke: userActionPublisher.send(.strokeColor(color)); strokeColor = color - case .underline: userActionPublisher.send(.underlineColor(color)); underlineColor = color + case .foreground: userActionPublisher.send(.setForegroundColor(color)); foregroundColor = color + case .background: userActionPublisher.send(.setBackgroundColor(color)); backgroundColor = color + case .strikethrough: userActionPublisher.send(.setStrikethroughColor(color)); strikethroughColor = color + case .stroke: userActionPublisher.send(.setStrokeColor(color)); strokeColor = color + case .underline: userActionPublisher.send(.setUnderlineColor(color)); underlineColor = color case .undefined: return } } diff --git a/Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift b/Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift index 44a433589..8f6d80821 100644 --- a/Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift +++ b/Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift @@ -46,15 +46,15 @@ private extension RichTextCoordinator { case .undoLatestChange: textView.undoLatestChange() syncContextWithTextView() - case .backgroundColor(let color): + case .setBackgroundColor(let color): setColor(color, for: .background) - case .foregroundColor(let color): + case .setForegroundColor(let color): setColor(color, for: .foreground) - case .underlineColor(let color): + case .setUnderlineColor(let color): setColor(color, for: .underline) - case .strikethroughColor(let color): + case .setStrikethroughColor(let color): setColor(color, for: .strikethrough) - case .strokeColor(let color): + case .setStrokeColor(let color): setColor(color, for: .stroke) case .highlightedRange(let range): setHighlightedRange(to: range)