-
Notifications
You must be signed in to change notification settings - Fork 149
[Dark Mode] Expose editor html storage as property #1209
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
Conversation
etoledom
left a comment
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.
Looks great to me!
Tested via wordpress-mobile/WordPress-iOS#12462 and it works perfectly 🎉
I added a comment but nothing really blocking. 👍
WordPress-Aztec-iOS.podspec
Outdated
| Pod::Spec.new do |s| | ||
| s.name = 'WordPress-Aztec-iOS' | ||
| s.version = '1.8.1' | ||
| s.version = '1.9.0' |
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.
We probably should be using 1.9.0-beta.1
| XCTAssertEqual(closingTagColor, HTMLStorage.Styles.defaultTagColor) | ||
| } | ||
|
|
||
| func testSetTextColor() { |
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.
Thanks for the tests! 🙏
| public class EditorView: UIView { | ||
| public let htmlTextView: UITextView | ||
| public let richTextView: TextView | ||
| public let htmlStorage: HTMLStorage |
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.
Do you think it would be better to have a computed property instead? Something like
public var htmlStorage: HTMLStorage {
guard let htmlStorage = htmlTextView.textStorage as? HTMLStorage else {
fatalError("If this happens, something is very off on the init config")
}
return htmlStorage
}I don't particularly like the fatalError, even though the guard should always succeed. Alternatively we can make it an optional, but that wouldn't make much sense for the "user", and how to handle the hypothetical nil case?
But it would remove the hassle with the coder init.
None look like a great option to me really, so I'm happy to keep it as it is if you think it is the best one 🙂
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.
Yep I like it!
|
Thanks @etoledom for reviewing this! I updated the property and the Podspecs. Tests passed successfully! |
etoledom
left a comment
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.
Looks great!
Thanks for the updates 🙏
Refs. WPiOS #12462
This PR exposes the Editor html storage as let property in order to customize its colors due to the introduction of DarkMode. This is required for implementing dark mode in WPiOS.
To test:
• Run the Unit Tests
• Run WPiOS #12462