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

fix: fix element thumbnail visual issues #3329

Merged
merged 14 commits into from Aug 7, 2023
Merged

Conversation

neatbyte-vnobis
Copy link
Collaborator

Changes

Fix issue "Block Thumbnail visual issues"

How Has This Been Tested?

Manual

Documentation

None

@SvenAlHamad
Copy link
Contributor

Hey @neatbyte-vnobis - I don't think we want to add the font definitions into the global.scss file...several reasons for that.

Can we explore another potential approach. Instead of generating thumbnails, can we render the block content directly inside the preview container. Similarly how the page preview is rendered in the drawer, would that be possbile?
The benefit of this approach is that if a user updates the theme file, say they change the primary color, currently the image previews don't get updated with that new information. Rendering the preview directly would reflect this change immediately.

@adrians5j
Copy link
Member

Did a quick POC for @neatbyte-vnobis here, let's see how far we get.

Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

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

Starting the review with a couple of quick comments.

Additional questions below.

1. Image issue

Adding an image works:

But when saving, I get this error:

image

Wondering if simply pulling in all changes from next would resolve this issue? 🤔

2. Still using image?

Also, shouldn't this modal also be rendering the block, instead of displaying its sshot? Did I miss smt here? 🤔
image

@neatbyte-ivelychko
Copy link

neatbyte-ivelychko commented Jul 11, 2023

Additional questions below.

1. Image issue

About this one
I've double checked it locally and on the admin app, and seems like it works as expected (saving image and not throwning an error)

But I want to say that I was having the same issue as this one when I was working on Dynamic Images (Dynamic Pages).

@neatbyte-ivelychko
Copy link

neatbyte-ivelychko commented Jul 11, 2023

2. Still using image?

Regarding this question, I've double checked and I want to say that we do use Component Preview instead of Image Preview. Maybe you need to try to re-deploy admin, because for me it works as expected

Знімок екрана 2023-07-12 о 16 25 16

...meta,
private: true
}
formData.preview = {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this on the backend? 🤔

I think not, maybe I'm wrong?

Copy link
Member

Choose a reason for hiding this comment

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

This question still remains.

Choose a reason for hiding this comment

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

Maybe we don't. But I need to spend a little bit more time on this question

Copy link

Choose a reason for hiding this comment

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

@adrians5j I have removed preview form the API, as we no longer need it

@@ -46,6 +45,9 @@ const BlockPreview: React.FC<BlockPreviewProps> = props => {
{onDelete && (
<Styled.DeleteBlock>
<ConfirmationDialog
// We need to have this z-index because without it Delete Block Dialog will be rendered below.
Copy link
Member

Choose a reason for hiding this comment

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

Please recheck this grammar. I think the dot after the rendered below is a mistake?

Sorry for the nitpick, but yeah, we're OSS, and companies tend to check our code sometimes before making their decision. I know this is just a drop in the sea, but yeah, gotta start somewhere. :)

width: 600,
minWidth: 600
const StyledDialog = styled(Dialog)`
// We need to have this z-index because without it Edit Block Dialog will be rendered below.
Copy link
Member

Choose a reason for hiding this comment

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

Same comment re grammar.

...meta,
private: true
}
formData.preview = {
Copy link
Member

Choose a reason for hiding this comment

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

This question still remains.

Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

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

Close!

Left minor comment and there's a question that's still unanswered.

Tested it manually, looks good. Glad we've managed to deleted some of those dom-to-image files.

One final thing to check on the UI side:

image

This list is rendered a bit weirdly. Can we double check that before merging?

Thanks!

@neatbyte-ivelychko
Copy link

One final thing to check on the UI side:
This list is rendered a bit weirdly. Can we double check that before merging?

Sure, will check it

Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

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

Looks good. We just need to revisit this question.

@neatbyte-ivelychko
Copy link

neatbyte-ivelychko commented Jul 26, 2023

@adrians5j l've checked whether we need to save preview on the back-end, and it looks like we don't, because we are rendering element itself instead of image. I will remove preview from the api.

@neatbyte-ivelychko
Copy link

@adrians5j I've removed preview from the api

@neatbyte-vnobis
Copy link
Collaborator Author

/cypress

@github-actions
Copy link

github-actions bot commented Aug 4, 2023

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link

github-actions bot commented Aug 4, 2023

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link

github-actions bot commented Aug 4, 2023

Cypress E2E tests have been initiated (for more information, click here). ✨

@@ -632,8 +632,7 @@ export type PbEditorBlockPlugin = Plugin & {
blockCategory: string;
tags: string[];
create(): PbEditorElement;
image?: Partial<File>;
preview?(): ReactElement;
preview(): ReactElement;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this still here? 🤔

@adrians5j adrians5j merged commit 770012a into next Aug 7, 2023
58 checks passed
@adrians5j adrians5j added this to the 5.38.0 milestone Aug 7, 2023
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.

None yet

4 participants