-
Notifications
You must be signed in to change notification settings - Fork 949
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: able to edit and preview when we have no content #3726
base: main
Are you sure you want to change the base?
fix: able to edit and preview when we have no content #3726
Conversation
|
style={{ | ||
display: | ||
!props.builderContextSignal.value.content && | ||
(isPreviewing() || isEditing()) |
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.
should this be?
style={(isEditing() || isPreviewing() || props.builderContextSignal.value.content)
? {}
: { display: 'none' }}
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.
because we have custom event listeners on the div ref that enable visual editing, we want to visually hide this wrapper div
in editing/preview if content is empty, but still render it. if we don't hide it it might break customer layouts because it'll be an empty div
with no content.
so:
- content exists: render div and
display: undefined
- content does not exist but isEditing/isPreviewing: render div and
display: 'none'
- once inline editing kicks in, it will populate the content and re-render, so
display
style will be removed
- once inline editing kicks in, it will populate the content and re-render, so
your suggestion would display this div in the second case even if we never get content, which we want to avoid.
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.
having said all of that, this logic has a lot of booleans so it would be good to summarize the thought behind it in a comment @sidmohanty11
Description
Jira
https://builder-io.atlassian.net/browse/PLAN-338
Screenshot
If relevant, add a screenshot or two of the changes you made.