-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bringing UniversalMarkdown to the party #772
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
Bringing UniversalMarkdown to the party #772
Conversation
…. Added the control to the sample, added the unit test to the test folder, started some cleanup work of the code style.
… of the style errors in the main code.
Hi @QuinnDamerell, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! TTYL, DNFBOT; |
@QuinnDamerell, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
@QuinnDamerell you seem to be missing a csproj in commit |
@hermitdave any idea which? The only new project file is the unit test project. Is that not showing up? |
|
Good catch, idk why my computer didn't blow up about that. It is fixed now. |
# Conflicts: # Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj
@@ -0,0 +1,44 @@ | |||
using System; |
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.
This file is not required as the control is pretty obvious :)
</Grid.RowDefinitions> | ||
|
||
<TextBlock Grid.Row="0" Text="Regular Text" Margin="12,12,12,0" FontSize="18"/> | ||
<TextBox x:Name="ui_unformattedText" Grid.Row="1" Margin="12" AcceptsReturn="True" TextWrapping="Wrap" /> |
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 should add a scrollviewer and bind its content to the makrdowntextblock to allow users to test it live :)
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 actually tried that, but there was an issue where when I got the text back out of the TextBox it was missing some of the new lines required to keep the formatting of the markdown correct. I looked for a little while but couldn't figure it out, which is really confusing because this is exactly how I do it in Baconit, and how the old markdown sample app does it.
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 have a look this afternoon :)
@@ -22,7 +22,7 @@ public MosaicControlPage() | |||
InitializeComponent(); | |||
} | |||
|
|||
protected override async void OnNavigatedTo(NavigationEventArgs e) |
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.
Good catch!
/// </summary> | ||
internal class MarkdownTable : Panel | ||
{ | ||
private int columnCount; |
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.
private members must starts with _ (sorry)
@@ -0,0 +1,174 @@ | |||
// ****************************************************************** |
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 you can leverage the WeakEventListener: https://github.com/Microsoft/UWPCommunityToolkit/blob/dev/Microsoft.Toolkit.Uwp/Helpers/WeakEventListener.cs ?
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.
Correct me if I'm wrong, but the WeakEventListener looks like something the consumer would have to do. The smart weak events allow the consumer to register just like normal events, but not have to worry about removing the registration when they clean up.
I could remove the SmartWeakEvent logic and just make them normal events, but then the consumer would have to use the WeakEventListener to get the same effect.
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.
You're right...But then the WeakEvent should be moved to Helpers as it could be useful even outside the markdowntextblock:)
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'm fine with it either way. I could move the smart weak events or remove them all together. Whatever you would like, whatever you think feels best for the project.
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 would say: go with regular events. We need to stick with what is already in the toolkit and in the SDK.
If people want weak event they can use the WeakEventListener :)
/// <summary> | ||
/// The default color used for backgrounds of sub elements. | ||
/// </summary> | ||
private static Color _defaultSubElementBgColor = Color.FromArgb(255, 224, 224, 224); |
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 think these two properties could be in the template (as a setter)
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.
How does that work exactly? I make them setters in the .xaml and then how do I access them in the cs?
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.
Because you use them as default value for CodeBackGround for instance I would just set CodeBackground to this value in XAML and that's it :)
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.
Fixed
set { SetValue(TextProperty, value); } | ||
} | ||
|
||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( |
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.
W try to have all DP at the beginning of the file
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.
(check to make sure I did it right.)
|
||
namespace Microsoft.Toolkit.Uwp.UI.Controls | ||
{ | ||
public class OnMarkdownReadyArgs : EventArgs |
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.
Missing xmldoc
For some reasons the analyzer is not flagging it. Pinging @onovotny and @pedrolamas for help
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.
Added docs
|
||
namespace Microsoft.Toolkit.Uwp.UI.Controls | ||
{ | ||
public class OnMarkdownLinkTappedArgs : EventArgs |
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.
no xmldoc
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.
Added docs
# Conflicts: # Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
By the way, there were two compile errors when I tried to build this branch. I had to prepend |
# Conflicts: # Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
@QuinnDamerell: That's not quite right. There are some known cases where we parse differently from Reddit, and that's what the tests are checking. They're all pretty small, nit-picky type stuff (but not necessarily easy to fix). |
@paulbartrum ah, so it's the other way around? I thought from looking at them it looked like that. |
I think I have all of the unit test issues resolved now (@pualbartum let me know if I'm wrong). The last thing I have to resolve is the styling issues, which I hope to get more clarity on. :) |
Excellent! Did you see my responses regarding Style? |
Let me push an update for you :) |
DO IT. JUST DO IT. 😁 Yeah I saw the comment but I still don't quite get it. Feel free to fix it yourself or let me know how to fix it. |
I did it :) but now I need you to allow me to push on your repo :) |
Done and Thanks! |
Done |
# Conflicts: # Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj # Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj
@deltakosh looks great! thanks for doing that. Anything else we need to do? |
Nope we are good to go:) I'll merge tomorrow Fantastic job. Thank you so much! |
Woot! We did it! Thanks for all of your help! |
Please send me your address for a tshirt :) ([email protected]) |
"your" including? |
Omg there's a shirt!?!? Thanks again to everyone who helped out with this. 😀 |
@xied75 both of you OF COURSE :) |
Starting the process of bringing UniversalMarkdown into the toolkit as MarkdownTextBlock. I believe everything is in order except for the style issues in the unit tests and adding a documentation page for the control.
#268