Skip to content
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

[BUGFIX] Minor UI tweaks #128

Merged
merged 10 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Demo/iOS/EditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private extension EditorScreen {
trailingButtons: {}
DominikBucher12 marked this conversation as resolved.
Show resolved Hide resolved
) {
var sheet = $0
// sheet.colorPickers = .all
sheet.colorPickers = .all
return sheet
}
}
Expand Down
1 change: 0 additions & 1 deletion Sources/RichTextKit/Actions/RichTextAction+Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public extension RichTextAction {
use and configure it as a normal button.
*/
struct Button: View {

/**
Create a rich text action button.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public extension RichTextAlignment {
be styled and configured with plain SwiftUI.
*/
struct Picker: View {

/**
Create a rich text alignment picker.

Expand Down
17 changes: 17 additions & 0 deletions Sources/RichTextKit/Colors/Color+SystemSpecificTextColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Color+SystemSpecificTextColor.swift
//
//
// Created by Dominik Bucher on 22.01.2024.
//

import SwiftUI

extension Color {
#if macOS
// on macOS
static let systemSpecificTextColor: Color? = Color(NSColor.textColor)
#else
static let systemSpecificTextColor: Color? = nil
#endif
}
9 changes: 7 additions & 2 deletions Sources/RichTextKit/Colors/RichTextColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ public extension RichTextColor {
}
}

public extension Collection where Element == RichTextColor {
public extension Collection where Element == RichTextColor {
static var all: [RichTextColor] { Element.allCases - .undefined }
}

static var all: [RichTextColor] { Element.allCases }
extension Array where Element == RichTextColor {
static func - (lhs: [RichTextColor], rhs: RichTextColor) -> [RichTextColor] {
return lhs.filter { $0 != rhs }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ internal extension RichTextCoordinator {
}
}

private extension ColorRepresentable {
extension ColorRepresentable {

#if iOS || os(tvOS) || os(visionOS)
static var textColor: ColorRepresentable { .label }
Expand Down
2 changes: 1 addition & 1 deletion Sources/RichTextKit/Styles/RichTextStyle+Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension View {
if cond {
self.foregroundStyle(Color.accentColor)
} else {
self
self.foregroundStyle(color)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/RichTextKit/Styles/RichTextStyle+Toggle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public extension RichTextStyle {
style.icon
.frame(maxHeight: fillVertically ? .infinity : nil)
}
.foreground(Color(ColorRepresentable.textColor), if: isOn)
.keyboardShortcut(for: style)
.accessibilityLabel(style.title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public extension RichTextViewComponent {
setRichTextAttributes(attributes)
}


@available(*, deprecated, message: "richTextAlignment")
var currentTextAlignment: RichTextAlignment? {
richTextAlignment
Expand Down