-
Notifications
You must be signed in to change notification settings - Fork 58
Updates to library preview #520
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
Updates to library preview #520
Conversation
chrischrischris
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 good! I do wonder if we should open the block previews in a new tab/window instead of in the modal? Looks like css isn't applied in the modal?
Thank you for the review! I originally had them opening in a new tab using anchor links, but @auniverseaway mentioned a using full screen modal. I think it makes sense as it keeps the user in the da editor. The blocks being pulled don't seem to have any css with them, and they look that way in a new window as well. If you try one of the templates, which point to bacom templates and they appear to load with css as expected. |
This is what I was getting at with my other comment. You have three formats of how people will enter their lists of blocks...
For 1 & 2, you will need to detect and convert to the 2nd so you get a proper rendering of the page. Something like... if (url.origin.includes('--') return url.href;
if (url.origin.includes('content.da.live') {
const [, org, site, ...split] = url.pathname.split('/');
return `https://main--${site}--${org}.aem.page/${split.join('/')}`;
}
if (url.origin.includes('admin.da.live') {
return `Similar thing to content, but different`;
} |
Aah. thank you, that clarifies it a lot. Thank you both. I will get those changes made and push them up. Appreciate the review. |
|
Hello @chrischrischris and @auniverseaway, I was enacting the changes to modify the preview url to one that will load the user's repository code for a better preview when I realized there may be a permissions issue that crops up if we normalize the url to use This is what occurs for da-bacom when the url used is We could easily fetch the HEAD to see if a Type Error is thrown, and then try using Thank you, |
|
@JasonHowellSlavin I think we respect what people put in. If someone puts in aem.page, we use it (even if it 401s). If they put in aem.live, we use it. If someone puts in Also: I have Github notifications turned off, so I didn't see this. Feel free to Slack me if you don't hear from us in a day or two. |
chrischrischris
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 good! Some UI thoughts:
- I think it'd be nice to have some sort of title at the top of the modal. "Library Preview"? "Name-of-block Preview"?
- Close button looks weird in top left to me. I personally would prefer an X top right and then also a "Close" or "Ok" at bottom right. Then again I guess with the library on the left side is why you have it there?
- There should be support for Esc key closing of preview
| return `https://main--${site}--${org}.aem.page/${split.join('/')}`; | ||
| } | ||
| } catch { | ||
| return false; |
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.
super nit - can remove this as it will continue to line 270. Not sure if linter is ok with it though
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.
The linter triggers a "no empty catch" rule. Would you prefer I remove that or disable the linter?
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 you can just put a comment.
|
Thank you Chris for the feedback. I made the changes you suggested. I did have one question regarding the last bullet:
It appears that the library modal code closes on esc, but it uses the same functionality that I avoided with the preview initially. That is, it removes the entire modal, library included. See the attached video where I use the button to close out of the preview vs using escape. Let me know what you think, and thank you again. whole.library.removal.esc.mov |
|
Re Closing with Esc, I personally rather have the key do something vs requiring a mouse.... but I'll defer to @auniverseaway |
Modifies the previous branch to include better UX
Description
Related Issue
Motivation and Context
Adds parity for template and block previews - changes made on code review comments for better UX
How Has This Been Tested?
Screenshots (if appropriate):
Screen.Recording.2025-09-18.at.9.14.43.AM.mov
Types of changes
Checklist: