Enhance TemplateEditor component with new features and UI improvements
- Added a disabled state to the info button based on global object data. - Adjusted preview scale increment and decrement values for finer control. - Introduced a read-only button to display the current preview scale. - Wrapped the ObjectProperty component in a scrollable div for better visibility in the modal. - Increased modal width for improved layout and user experience.
This commit is contained in:
parent
97d5bfcee7
commit
296fbe55df
@ -100,6 +100,7 @@ const TemplateEditor = ({
|
|||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
icon={<InfoCircleIcon />}
|
icon={<InfoCircleIcon />}
|
||||||
|
disabled={objectData?.global}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTestObjectOpen(true)
|
setTestObjectOpen(true)
|
||||||
}}
|
}}
|
||||||
@ -107,15 +108,24 @@ const TemplateEditor = ({
|
|||||||
<Button
|
<Button
|
||||||
icon={<PlusIcon />}
|
icon={<PlusIcon />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPreviewScale((prev) => prev + 0.1)
|
setPreviewScale((prev) => prev + 0.05)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
icon={<MinusIcon />}
|
icon={<MinusIcon />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPreviewScale((prev) => prev - 0.1)
|
setPreviewScale((prev) => prev - 0.05)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
readOnly={true}
|
||||||
|
style={{ width: '65px' }}
|
||||||
|
onClick={() => {
|
||||||
|
setPreviewScale(1)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{previewScale.toFixed(2)}x
|
||||||
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<iframe
|
<iframe
|
||||||
@ -178,6 +188,7 @@ const TemplateEditor = ({
|
|||||||
<Modal
|
<Modal
|
||||||
open={testObjectOpen}
|
open={testObjectOpen}
|
||||||
closeIcon={null}
|
closeIcon={null}
|
||||||
|
width={800}
|
||||||
footer={
|
footer={
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -188,13 +199,20 @@ const TemplateEditor = ({
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ObjectProperty
|
<div
|
||||||
type={'codeBlock'}
|
style={{
|
||||||
name='testObject'
|
maxHeight: 'calc(var(--unit-100vh) - 280px)',
|
||||||
language='json'
|
overflowY: 'scroll'
|
||||||
objectData={objectData}
|
}}
|
||||||
isEditing={true}
|
>
|
||||||
/>
|
<ObjectProperty
|
||||||
|
type={'codeBlock'}
|
||||||
|
name='testObject'
|
||||||
|
language='json'
|
||||||
|
objectData={objectData}
|
||||||
|
isEditing={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user