mirror of
https://github.com/WenPai-org/wpmind.git
synced 2025-08-03 11:11:27 +08:00
fixed preview properly displaying full and wide sections
remove preview opacity dimm when loading state
This commit is contained in:
parent
16e1913121
commit
1d708eca9d
3 changed files with 31 additions and 28 deletions
|
@ -18,40 +18,37 @@ const AIResponse = memo(
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="mind-popup-response">
|
||||||
className="mind-popup-response"
|
|
||||||
style={{
|
|
||||||
opacity: loading ? 0.85 : 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{response.length > 0 && (
|
{response.length > 0 && (
|
||||||
<div className="mind-popup-response__preview">
|
<div className="mind-popup-response__preview">
|
||||||
<BlockPreview
|
<BlockPreview
|
||||||
blocks={response}
|
// Since the preview does not render properly first block align full, we need to create the wrapper Group block with our custom styles.
|
||||||
|
// Align classes rendered properly only for the inner blocks.
|
||||||
|
blocks={[
|
||||||
|
{
|
||||||
|
name: 'core/group',
|
||||||
|
clientId:
|
||||||
|
'a9b75f7e-55c7-4f2b-93bb-00cf24181278',
|
||||||
|
isValid: true,
|
||||||
|
attributes: {
|
||||||
|
// "tagName": "div",
|
||||||
|
align: 'full',
|
||||||
|
layout: {
|
||||||
|
type: 'constrained',
|
||||||
|
},
|
||||||
|
className: 'alignfull',
|
||||||
|
},
|
||||||
|
innerBlocks: response,
|
||||||
|
},
|
||||||
|
]}
|
||||||
viewportWidth={0}
|
viewportWidth={0}
|
||||||
// TODO: the following container style is hardcoded and should be changed.
|
|
||||||
additionalStyles={[
|
additionalStyles={[
|
||||||
{
|
{
|
||||||
css: `
|
css: `
|
||||||
.is-root-container > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
|
.is-root-container > div {
|
||||||
max-width: var(--wp--style--global--content-size);
|
margin-top: 0;
|
||||||
margin-left: auto !important;
|
}
|
||||||
margin-right: auto !important;
|
`,
|
||||||
}
|
|
||||||
.is-root-container > .alignwide {
|
|
||||||
max-width: var(--wp--style--global--wide-size);
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
.is-root-container > .alignfull {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
:root :where(.is-layout-flow) > *,
|
|
||||||
.is-root-container > * {
|
|
||||||
margin-block-start: 1.2rem;
|
|
||||||
margin-block-end: 0;
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
/* Optimize repaints */
|
/* Optimize repaints */
|
||||||
contain: content;
|
contain: content;
|
||||||
|
|
||||||
|
.block-editor-block-preview__content,
|
||||||
|
.block-editor-block-preview__content iframe {
|
||||||
|
max-height: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes mind-cursor-blink {
|
@keyframes mind-cursor-blink {
|
||||||
|
|
|
@ -9,7 +9,8 @@ $padding: 10px;
|
||||||
padding: $padding $padding * 2;
|
padding: $padding $padding * 2;
|
||||||
|
|
||||||
&:empty,
|
&:empty,
|
||||||
&:has(.mind-popup-request:empty) {
|
&:has(.mind-popup-request:empty),
|
||||||
|
&:has(.mind-popup-request iframe) {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue