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

Improve creating posts/comments #1359

Merged
merged 9 commits into from
May 13, 2024

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented May 8, 2024

Pull Request Description

This PR includes a few changes related to creating posts/comments.

  • Improve selectability of posts/comments when replying.
    • I found that the MarkdownWidget's selectable flag doesn't support selecting across multiple paragraphs, so I wrapped it in a SelectableRegion which is more flexible.
    • I added the ability to view the raw contents of a post/comment when replying. This gives you the ability to quote the original poster while preserving their markdown formatting within your quote.
      • The next step in my plan is to automatically populate the post/comment selection into the comment editor when pressing the "quote" markdown option. This will make it even easier to quote something (without copying/pasting) and to optionally preserve the markdown formatting.
  • Made the new post preview look more like the new comment preview.

Hide whitespace

Screenshots / Recordings

qemu-system-x86_64_2nQKIqtlHs.mp4

@hjiangsu
Copy link
Member

hjiangsu commented May 9, 2024

I found that the MarkdownWidget's selectable flag doesn't support selecting across multiple paragraphs, so I wrapped it in a SelectableRegion which is more flexible.

This is an aside, but we might be able to completely remove the selectable parameter in MarkdownWidget if that's the case! I believe we initially used it in the old comment page only (but check to see if there are any existing references to it)

I'm also wondering if we can adjust the positioning of the view source button! From the demo, it feels like it's lumped up with the metadata information which might reduce discovery of the feature.

Some ideas:

  • We can play around with padding to make it feel like it's not part of the metadata
  • Make a new section under the preview for additional actions (we could even potentially add another action to just copy the whole contents)

These are just some initial points. I haven't taken a look at the implementation yet but will do so soon! 😄

@micahmo
Copy link
Member Author

micahmo commented May 9, 2024

This is an aside, but we might be able to completely remove the selectable parameter in MarkdownWidget if that's the case! I believe we initially used it in the old comment page only (but check to see if there are any existing references to it)

Good idea! I've removed it from CommonMarkdownBody, but not from ExtendedMarkdownBody as that maps to ExtendedMarkdownWidget which maps to MarkdownWidget which comes from a package, and I figured there's no need to hide legitimate parameters via our wrapper widgets.

I'm also wondering if we can adjust the positioning of the view source button!

Sure, I'll play around with it!

@micahmo
Copy link
Member Author

micahmo commented May 9, 2024

Alright, I added a divider, and also a copy option. Thoughts?

qemu-system-x86_64_VS90Yj4YzL.mp4

@hjiangsu
Copy link
Member

Alright, I added a divider, and also a copy option

I think that looks better! Thanks for making the change 😄

Copy link
Member

@hjiangsu hjiangsu left a comment

Choose a reason for hiding this comment

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

Just did a quick review of this and had some points of discussion!

lib/shared/divider.dart Show resolved Hide resolved
lib/comment/view/create_comment_page.dart Outdated Show resolved Hide resolved
lib/post/widgets/post_view.dart Show resolved Hide resolved
body: post.body ?? '',
isSelectableText: widget.selectable,
),
child: ConditionalParentWidget(
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we need to apply the SelectableRegion here, or would it be more suited as part of the create comment page? (same thing with the comment SelectableRegion)

I guess the main discussion point is whether or not we're expecting to make the post selectable in other areas outside of the create comment page. We already have a way to copy post/comments from #1327!

Copy link
Member Author

Choose a reason for hiding this comment

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

I originally put the SelectableRegion around the whole PostSubview and CommentContent widgets, but that had a couple of weird side-effects. For one, I couldn't see the drag handles or the selection highlight color. But the bigger issue is that it allows everything in those widgets to be selectable, including the metadata, which I thought was weird! It seemed to be behave much better when wrapped directly around the CommonMarkdownBody, and I don't think it causes any harm, even if this is the only place we use it. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Ahh okay, you make a good point about allowing metadata to be selected! We'll keep it as it!

lib/community/pages/create_post_page.dart Outdated Show resolved Hide resolved
@micahmo
Copy link
Member Author

micahmo commented May 13, 2024

This should be ready to go, depending on your thoughts on the unresolved comment!

@hjiangsu hjiangsu merged commit 7ac0649 into thunder-app:develop May 13, 2024
1 check passed
@micahmo micahmo deleted the feature/improve-post-comment branch May 13, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants