fix: restore code block loading states (#728)
This commit is contained in:
parent
38527ff92e
commit
085f4a8ac4
6 changed files with 269 additions and 136 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Block } from '@/components/create-block';
|
||||
import { CopyIcon, RedoIcon, UndoIcon } from '@/components/icons';
|
||||
import { ImageEditor } from '@/components/image-editor';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export const imageBlock = new Block({
|
||||
kind: 'image',
|
||||
|
|
@ -23,6 +24,13 @@ export const imageBlock = new Block({
|
|||
onClick: ({ handleVersionChange }) => {
|
||||
handleVersionChange('prev');
|
||||
},
|
||||
isDisabled: ({ currentVersionIndex }) => {
|
||||
if (currentVersionIndex === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: <RedoIcon size={18} />,
|
||||
|
|
@ -30,6 +38,13 @@ export const imageBlock = new Block({
|
|||
onClick: ({ handleVersionChange }) => {
|
||||
handleVersionChange('next');
|
||||
},
|
||||
isDisabled: ({ isCurrentVersion }) => {
|
||||
if (isCurrentVersion) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: <CopyIcon size={18} />,
|
||||
|
|
@ -52,6 +67,8 @@ export const imageBlock = new Block({
|
|||
}
|
||||
}, 'image/png');
|
||||
};
|
||||
|
||||
toast.success('Copied image to clipboard!');
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue