feat: add image block type (#709)
This commit is contained in:
parent
6c23a8a604
commit
df449a408a
13 changed files with 229 additions and 92 deletions
|
|
@ -34,8 +34,9 @@ import { Console } from './console';
|
|||
import { useSidebar } from './ui/sidebar';
|
||||
import { useBlock } from '@/hooks/use-block';
|
||||
import equal from 'fast-deep-equal';
|
||||
import { ImageEditor } from './image-editor';
|
||||
|
||||
export type BlockKind = 'text' | 'code';
|
||||
export type BlockKind = 'text' | 'code' | 'image';
|
||||
|
||||
export interface UIBlock {
|
||||
title: string;
|
||||
|
|
@ -476,7 +477,7 @@ function PureBlock({
|
|||
})}
|
||||
>
|
||||
{isDocumentsFetching && !block.content ? (
|
||||
<DocumentSkeleton />
|
||||
<DocumentSkeleton blockKind={block.kind} />
|
||||
) : block.kind === 'code' ? (
|
||||
<CodeEditor
|
||||
content={
|
||||
|
|
@ -512,9 +513,22 @@ function PureBlock({
|
|||
newContent={getDocumentContentById(currentVersionIndex)}
|
||||
/>
|
||||
)
|
||||
) : block.kind === 'image' ? (
|
||||
<ImageEditor
|
||||
title={block.title}
|
||||
content={
|
||||
isCurrentVersion
|
||||
? block.content
|
||||
: getDocumentContentById(currentVersionIndex)
|
||||
}
|
||||
isCurrentVersion={isCurrentVersion}
|
||||
currentVersionIndex={currentVersionIndex}
|
||||
status={block.status}
|
||||
isInline={false}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{suggestions ? (
|
||||
{suggestions && suggestions.length > 0 ? (
|
||||
<div className="md:hidden h-dvh w-12 shrink-0" />
|
||||
) : null}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue