Skip to content

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

Merged
merged 34 commits into from
Jan 26, 2017

Conversation

QuinnDamerell
Copy link
Contributor

@QuinnDamerell QuinnDamerell commented Jan 9, 2017

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

…. Added the control to the sample, added the unit test to the test folder, started some cleanup work of the code style.
@dnfclas
Copy link

dnfclas commented Jan 9, 2017

Hi @QuinnDamerell, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@dnfclas
Copy link

dnfclas commented Jan 9, 2017

@QuinnDamerell, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

@hermitdave
Copy link
Contributor

@QuinnDamerell you seem to be missing a csproj in commit

@QuinnDamerell
Copy link
Contributor Author

@hermitdave any idea which? The only new project file is the unit test project. Is that not showing up?

@hermitdave
Copy link
Contributor

MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.

C:\Users\appveyor\AppData\Local\Temp\1\NuGet-Scratch\0uxgbmhn.nn5.targets(37,5): error MSB3202: The project file "..\UniversalMarkdown\UniversalMarkdown.csproj" was not found. [C:\projects\uwpcommunitytoolkit\UnitTests\UnitTests.MarkdownTextBlock\MarkdownTextBlockUnitTests.csproj]

@QuinnDamerell
Copy link
Contributor Author

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
@deltakosh
Copy link
Contributor

I have an issue compiling the project:
image

@@ -0,0 +1,44 @@
using System;
Copy link
Contributor

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" />
Copy link
Contributor

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 :)

Copy link
Contributor Author

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.

Copy link
Contributor

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)
Copy link
Contributor

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;
Copy link
Contributor

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 @@
// ******************************************************************
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

Copy link
Contributor

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:)

Copy link
Contributor Author

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.

Copy link
Contributor

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);
Copy link
Contributor

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)

Copy link
Contributor Author

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?

Copy link
Contributor

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 :)

Copy link
Contributor Author

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(
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no xmldoc

Copy link
Contributor Author

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
@paulbartrum
Copy link

By the way, there were two compile errors when I tried to build this branch. I had to prepend this. to FindDescendant() and FindVisualAscendant() to fix it. dev doesn't seem to have this problem so I'm guessing this was the result of a bad merge.

@paulbartrum
Copy link

// This test is ignored because it test the true markdown standard, while currently this parser
// only supports the "reddit" flavor of markdown currently. (this difference is quite small)

@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).

@QuinnDamerell
Copy link
Contributor Author

@paulbartrum ah, so it's the other way around? I thought from looking at them it looked like that.

@QuinnDamerell
Copy link
Contributor Author

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. :)

@deltakosh
Copy link
Contributor

Excellent! Did you see my responses regarding Style?

@deltakosh
Copy link
Contributor

Let me push an update for you :)

@QuinnDamerell
Copy link
Contributor Author

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.

@deltakosh
Copy link
Contributor

I did it :) but now I need you to allow me to push on your repo :)

@QuinnDamerell
Copy link
Contributor Author

Done and Thanks!

@deltakosh
Copy link
Contributor

Done
Please give me your thoughts

# Conflicts:
#	Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj
#	Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj
@QuinnDamerell
Copy link
Contributor Author

@deltakosh looks great! thanks for doing that.

Anything else we need to do?

@deltakosh
Copy link
Contributor

Nope we are good to go:) I'll merge tomorrow

Fantastic job. Thank you so much!

@QuinnDamerell
Copy link
Contributor Author

Woot! We did it! Thanks for all of your help!

@deltakosh
Copy link
Contributor

Please send me your address for a tshirt :) ([email protected])

@deltakosh deltakosh merged commit 896b20a into CommunityToolkit:dev Jan 26, 2017
@xied75
Copy link
Contributor

xied75 commented Jan 26, 2017

"your" including?

@QuinnDamerell
Copy link
Contributor Author

Omg there's a shirt!?!?

Thanks again to everyone who helped out with this. 😀

@deltakosh
Copy link
Contributor

deltakosh commented Jan 26, 2017

@xied75 both of you OF COURSE :)

@deltakosh deltakosh deleted the markdowntextblock branch January 26, 2017 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants