-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddc035b
commit 7aa6b9c
Showing
4 changed files
with
182 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
web/next-example/src/components/examples/withStarterKit/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { uploadToCloudinary } from '@/utils/cloudinary'; | ||
import { YooptaContentValue } from '@yoopta/editor'; | ||
import YooptaStarterKit from '@yoopta/starter-kit'; | ||
import { useRef, useState } from 'react'; | ||
|
||
const WithStarterKit = () => { | ||
const [value, setValue] = useState<YooptaContentValue>(); | ||
const selectionRef = useRef<HTMLDivElement | null>(null); | ||
|
||
return ( | ||
<div | ||
ref={selectionRef} | ||
className="md:py-[100px] md:pl-[200px] md:pr-[80px] px-[20px] pt-[80px] pb-[40px] flex justify-center" | ||
> | ||
<YooptaStarterKit | ||
value={value} | ||
onChange={(data) => setValue(data)} | ||
style={{ width: 650 }} | ||
selectionRef={selectionRef} | ||
placeholder="Start typing here..." | ||
media={{ | ||
imageUpload: async (file) => { | ||
const data = await uploadToCloudinary(file, 'image'); | ||
|
||
return { | ||
src: data.secure_url, | ||
alt: 'cloudinary', | ||
sizes: { | ||
width: data.width, | ||
height: data.height, | ||
}, | ||
}; | ||
}, | ||
fileUpload: async (file) => { | ||
const response = await uploadToCloudinary(file, 'auto'); | ||
return { src: response.url, name: response.name }; | ||
}, | ||
videoUpload: async (file) => { | ||
const data = await uploadToCloudinary(file, 'video'); | ||
return { | ||
src: data.secure_url, | ||
alt: 'cloudinary', | ||
sizes: { | ||
width: data.width, | ||
height: data.height, | ||
}, | ||
}; | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WithStarterKit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters