-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[MM-12290] inline image collapse #7352
[MM-12290] inline image collapse #7352
Conversation
…webapp into MM-12290-inline-image-collapse
… MarkdownImage, added handling for both imageMetadata.height and regular height for MarkdownImageExpand
Hello @TheDarkestDay, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
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 @TheDarkestDay! This is great. Just a few tweaks from my standpoint:
- The image has a border on it when you hover on it. Can we remove that?
- Is it possible to animate the collapsing transition? This would help orient users. If not, we could look at that in a separate PR
- Can we reduce the margin on the top of
.markdown-inline-img
to 2px instead of 5px? That should even out the positioning of the arrow button
&:hover { | ||
border: 1px solid var(--center-channel-color-24); | ||
|
||
@include box-shadow($elevation-2); |
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.
For some reason $elevation-2
is rendering the shadow opacity at 0.012
and it should be rendering as 0.12
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.
Alright. I'll fix this. By the way, all of the elevations starting from 2 to 6 have an opacity like this. Probably we have here some sort of wide spread issue.
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.
Seems like a mistake to me. Not sure when this was added
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 only $elevation-2
for now.
@asaadmahmood I am sorry to bother you but according to Git blame you were the author of these elevation
settings. May I request some assistance from you - are these opacity values incorrect or there were some reasoning behind this?
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.
@TheDarkestDay The opacity values are updated on master.
I did them on this PR:
https://github.com/mattermost/mattermost-webapp/pull/7696/files
Thanks @matthewbirtch! Okay, let me try to tackle this step by step. I've been digging around point 3 and the only question I am currently having - should we apply this change universally to all of the Markdown inline images or should just create some special edge case for this one? I tried applying this thing globally and I didn't manage to find any specific issues caused by this change. On the other hand, for sure I might be missing some use case which would really explain the purpose of this margin setting. What do you think, does it make sense to apply this change universally, push it here and let you and the team check it? |
Oh, that's the same story, actually. The thing is that each inline Markdown image is supposed to be clickable - and on click it should be shown in full size in a modal window. And I guess the reason for this shadow-on-hover effect is exactly to give a hint that this image is clickable. So, the question is - should we treat these "images with expand" somehow different? Should we remove this thing for them or rework somehow? |
I think at least I can try. The only thing I am concerned about here is performance of height change animation - but we will only find it out if we try it in the wild. May I kindly ask you to share some assets for this animation? Things like duration, easing function, maybe even some gif would be helpful. |
Ok, let's leave this as-is for now and we can look in to it later if we feel strongly that it needs to change.
Makes sense. Let's leave the border and shadow effect
Give these a go:
We may need to tweak the above, but we'll see when it's in the wild. |
…webapp into MM-12290-inline-image-collapse
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.
Thank you @TheDarkestDay
Tested, looks good to merge.
- Verified inline image collapse for images 100px or more in height; heights change animations when using slash commands for expand/collapse are happening in view; underline is removed when inline image is linked.
Test server destroyed |
@hmhealey Can you please help merge. Thanks 🙂 |
Merged! Thanks again for the PR, @TheDarkestDay. This will be on Mattermost Cloud some time in the next couple weeks and then in (I think) Mattermost 5.35 after that. |
/cherry-pick cloud |
Cherry pick is scheduled. |
* MM-12290. More or less done with the concept, visuals and components design * MM-12290. Added hover styles for both collapse and expand icons * MM-12290. Changed hover style for expand button * MM-12290. Added snapshot tests for MarkdownImageExpand * MM-12290. Integrated proper icons for both expand and collapse buttons * MM-12290. Added corresponding tests for Expand insertion logic inside MarkdownImage, added handling for both imageMetadata.height and regular height for MarkdownImageExpand * MM-12290. Formatting fixes * MM-12290. Fixed snapshots for MarkdownImageExpand * MM-12290. An attempt to implement simple expand/collapse transition * MM-12290. Fixed wrong shadow props for elevation-2 * MM-12290. Auto-formatting * MM-12290. Inline image expand now properly captures settings values changed via slash commands like /expand or /collapse. Therefore, postId is now also provided for MarkdownImageExpand * [MM-12290] Got rid of local expand state in favor of Redux one, removed animations for now * [MM-12290] Moved inline image collapse/expand state to the corresponding storage field * [MM-12290] Fixed snapshots for html-to-component * [MM-12290] Fixed color usage to use setting opacity with rgba instead of using variables with opacities * [MM-12290] Reverted package-lock fully * [MM-12290] Missing newlinew for package-lock added back * [MM-12290] Minor codestyle fixes, now we use image src as its expand/collapse state key instead of index * [MM-12290] Added separate callback to let MarkdownImage notify consumers about some inner height change * [MOB-12290] Reverted package-lock changes, fixed missing heading for MarkdiwnImage test, fixed snapshots * [MM-12290] Written back a missing snapshot for fixed test * [MM-12290] Hopefully finally removed obsolete snapshot * [MM-12290] Removed redundant license information from MarkdownImageExpand * [MM-12290] Tried migrating expand-button display to inline-block to avoid displaying underline text decoration caused by parent link * [MM-12290] Fixed linting errors Co-authored-by: Aleksandr Brenchev <[email protected]> Co-authored-by: Mattermod <[email protected]> (cherry picked from commit 66b49a4)
* MM-12290. More or less done with the concept, visuals and components design * MM-12290. Added hover styles for both collapse and expand icons * MM-12290. Changed hover style for expand button * MM-12290. Added snapshot tests for MarkdownImageExpand * MM-12290. Integrated proper icons for both expand and collapse buttons * MM-12290. Added corresponding tests for Expand insertion logic inside MarkdownImage, added handling for both imageMetadata.height and regular height for MarkdownImageExpand * MM-12290. Formatting fixes * MM-12290. Fixed snapshots for MarkdownImageExpand * MM-12290. An attempt to implement simple expand/collapse transition * MM-12290. Fixed wrong shadow props for elevation-2 * MM-12290. Auto-formatting * MM-12290. Inline image expand now properly captures settings values changed via slash commands like /expand or /collapse. Therefore, postId is now also provided for MarkdownImageExpand * [MM-12290] Got rid of local expand state in favor of Redux one, removed animations for now * [MM-12290] Moved inline image collapse/expand state to the corresponding storage field * [MM-12290] Fixed snapshots for html-to-component * [MM-12290] Fixed color usage to use setting opacity with rgba instead of using variables with opacities * [MM-12290] Reverted package-lock fully * [MM-12290] Missing newlinew for package-lock added back * [MM-12290] Minor codestyle fixes, now we use image src as its expand/collapse state key instead of index * [MM-12290] Added separate callback to let MarkdownImage notify consumers about some inner height change * [MOB-12290] Reverted package-lock changes, fixed missing heading for MarkdiwnImage test, fixed snapshots * [MM-12290] Written back a missing snapshot for fixed test * [MM-12290] Hopefully finally removed obsolete snapshot * [MM-12290] Removed redundant license information from MarkdownImageExpand * [MM-12290] Tried migrating expand-button display to inline-block to avoid displaying underline text decoration caused by parent link * [MM-12290] Fixed linting errors Co-authored-by: Aleksandr Brenchev <[email protected]> Co-authored-by: Mattermod <[email protected]> (cherry picked from commit 66b49a4) Co-authored-by: Alexander Brenchev <[email protected]>
Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Messaging > Formatting Text > In-line Images - Added introduction to explain what in-line images are and clarify that in-line images over 100px in height are subject to the **Default Appearance of Image Previews** user preference and the equivalent slash commands - Applied readability and consistency updates to existing content - Corrected formatting where needed
Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Settings > Account Settings > Display > Link Previews - Updated the existing subsection title from "Link Previews" to "Default Appearance of Image Previews" - Updated impact scope of user preference to include in-line images over 100px in height
Documentation for: mattermost/mattermost-webapp#7352 Updated: - Cloud Admin Guide > Configuration > Site Configuration - Applied Style Guide, consistency, and navigation updates to content throughout this page - Under **Posts**, added documentation for users to control whether in-line images over 100px in height can be automatically collapsed or expanded
Documentation for: mattermost/mattermost-webapp#7352 Updated: - Cloud Admin Guide > Integrations > Slash Commands > Built-in Commands - Updated descriptions for both ``/expand`` and ``/collapse`` to include image previews, image attachments, and inline images over 100px in height, and included links to the in-line images user documentation
Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Messaging > Executing Commands > Built-in Commands - Updated descriptions for both ``/expand`` and ``/collapse`` to include image previews, image attachments, and inline images over 100px in height, and included links to the in-line images user documentation
* MM-12290 inline image collapse Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Messaging > Formatting Text > In-line Images - Added introduction to explain what in-line images are and clarify that in-line images over 100px in height are subject to the **Default Appearance of Image Previews** user preference and the equivalent slash commands - Applied readability and consistency updates to existing content - Corrected formatting where needed * MM-12290 inline image collapse Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Settings > Account Settings > Display > Link Previews - Updated the existing subsection title from "Link Previews" to "Default Appearance of Image Previews" - Updated impact scope of user preference to include in-line images over 100px in height * Update source/help/settings/account-settings.rst * Update source/help/messaging/formatting-text.rst * MM-12290 inline image collapse Documentation for: mattermost/mattermost-webapp#7352 Updated: - Cloud Admin Guide > Configuration > Site Configuration - Applied Style Guide, consistency, and navigation updates to content throughout this page - Under **Posts**, added documentation for users to control whether in-line images over 100px in height can be automatically collapsed or expanded * Update source/help/messaging/formatting-text.rst * Update source/cloud/cloud-administration/site-configuration.rst * Update source/cloud/cloud-administration/site-configuration.rst * MM-12290 inline image collapse Documentation for: mattermost/mattermost-webapp#7352 Updated: - Cloud Admin Guide > Integrations > Slash Commands > Built-in Commands - Updated descriptions for both ``/expand`` and ``/collapse`` to include image previews, image attachments, and inline images over 100px in height, and included links to the in-line images user documentation * MM-12290 inline image collapse Documentation for: mattermost/mattermost-webapp#7352 Updated: - User's Guide > Messaging > Executing Commands > Built-in Commands - Updated descriptions for both ``/expand`` and ``/collapse`` to include image previews, image attachments, and inline images over 100px in height, and included links to the in-line images user documentation * Formatting fixes * Alignment fixes * Changed Note to Tip * Update source/cloud/cloud-administration/site-configuration.rst * MM-12290 inline image collapse Applied reviewer feedback * MM-12290 inline image collapse Applied reviewer feedback * MM-12290 inline image collapse Applied reviewer feedback. * MM-12290 inline image collapse Applied reviewer feedback. * MM-12290-inline-image-collapse Formatting fixes * MM-12290 inline image collapse Formatting fixes * MM-12290 inline image collapse Formatting fixes * formatting fixes * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/help/messaging/formatting-text.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/help/messaging/formatting-text.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/help/messaging/formatting-text.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/help/messaging/formatting-text.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/help/messaging/formatting-text.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> * Update source/cloud/cloud-administration/site-configuration.rst Co-authored-by: Justine Geffen <[email protected]> Co-authored-by: Justine Geffen <[email protected]>
@TheDarkestDay: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. I understand the commands that are listed here |
Summary
The purpose of this PR is to introduce capability for inline Markdown image to be expanded/collapsed. Moreover, they should take into account user preferences in terms of default embedded content display mode - either collapsed or expanded.
Ticket Link
mattermost/mattermost#16636
Related Pull Requests
N/A
Screenshots
Hovering large inline image now displays a special "Collapse" button in the top-left corner of the image:
You can collapse it by clicking on the button and then expand it again by clicking on a special collapsed view of the inline image: