-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RichTextAction subscription #129
Changes from 1 commit
722b185
3aec2a0
1493a82
5761c4a
633e354
8a99a0c
d605cbf
4eef162
54294b5
028a6fe
1104c3b
55f9620
c45168f
41c14c0
2533a19
076651f
c48f215
caa3143
fa88c64
d3789d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ public enum RichTextAction: Identifiable, Equatable, RichTextLabelValue { | |
|
||
/// Copy the currently selected text, if any. | ||
case copy | ||
|
||
/// Dismiss any presented software keyboard. | ||
case dismissKeyboard | ||
|
||
|
@@ -48,19 +47,7 @@ public enum RichTextAction: Identifiable, Equatable, RichTextLabelValue { | |
case undoLatestChange | ||
|
||
// Change background color | ||
case setBackgroundColor(ColorRepresentable) | ||
|
||
// Change foreground color | ||
case setForegroundColor(ColorRepresentable) | ||
|
||
// Change underline color | ||
case setUnderlineColor(ColorRepresentable) | ||
|
||
// Change strikethrough color | ||
case setStrikethroughColor(ColorRepresentable) | ||
|
||
// Change stroke color | ||
case setStrokeColor(ColorRepresentable) | ||
case setColor(ColorRepresentable, RichTextColor) | ||
|
||
// Highlighted renge | ||
case setHighlightedRange(NSRange?) | ||
|
@@ -101,11 +88,7 @@ public extension RichTextAction { | |
case .stepSuperscript(let val): .richTextStepSuperscript(val) | ||
case .toggleStyle(let val): val.icon | ||
case .undoLatestChange: .richTextActionUndo | ||
case .setBackgroundColor: .richTextColorBackground | ||
case .setForegroundColor: .richTextColorForeground | ||
case .setUnderlineColor: .richTextColorUnderline | ||
case .setStrikethroughColor: .richTextColorStrikethrough | ||
case .setStrokeColor: .richTextColorStroke | ||
case .setColor(_, let richTextColor): richTextColor.icon ?? .richTextColorBackground | ||
case .setHighlightedRange: .richTextAlignmentCenter | ||
case .setHighlightingStyle: .richTextAlignmentCenter | ||
case .pasteImage: .richTextDocuments | ||
|
@@ -149,11 +132,15 @@ public extension RichTextAction { | |
case .stepSuperscript(let steps): .actionStepSuperscript(steps) | ||
case .toggleStyle(let style): style.titleKey | ||
case .undoLatestChange: .actionUndoLatestChange | ||
case .setBackgroundColor: .backgroundColor | ||
case .setForegroundColor: .foregroundColor | ||
case .setUnderlineColor: .underlineColor | ||
case .setStrikethroughColor: .strikethroughColor | ||
case .setStrokeColor: .strokeColor | ||
case .setColor(_, let richTextColor): | ||
switch richTextColor { | ||
case .foreground: .foregroundColor | ||
case .background: .backgroundColor | ||
case .strikethrough: .strikethroughColor | ||
case .stroke: .strokeColor | ||
case .underline: .underlineColor | ||
case .undefined: .strokeColor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this correct for the undefined? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to return something and this feels a lot better than exception or cascade of optionals. I would personally focus after 1.0 to get away from |
||
} | ||
case .setHighlightedRange: .highlightedRange | ||
case .setHighlightingStyle: .highlightingStyle | ||
case .pasteImage: .pasteImage | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DominikBucher12 I thiiiiink the rich text color has a title that you can return right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually does not :( I wouldn't implement it in there IMHO, but the icons can stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix! :)