Skip to content

Commit

Permalink
rename to setColors
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikBucher12 committed Jan 23, 2024
1 parent b4bd81d commit c990bbf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions Sources/RichTextKit/Actions/RichTextAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions Sources/RichTextKit/Context/RichTextContext+Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions Sources/RichTextKit/Context/RichTextContext+Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c990bbf

Please sign in to comment.