wip: migrate to ark

This commit is contained in:
reya
2023-12-07 18:09:00 +07:00
parent 95124e5ded
commit 7507cd9ba1
29 changed files with 206 additions and 454 deletions
+6 -4
View File
@@ -2,12 +2,12 @@ import { message } from '@tauri-apps/plugin-dialog';
import { Editor } from '@tiptap/react';
import { useState } from 'react';
import { useArk } from '@libs/ark';
import { MediaIcon } from '@shared/icons';
import { useNostr } from '@utils/hooks/useNostr';
export function MediaUploader({ editor }: { editor: Editor }) {
const { upload } = useNostr();
const { ark } = useArk();
const [loading, setLoading] = useState(false);
const uploadToNostrBuild = async () => {
@@ -15,7 +15,9 @@ export function MediaUploader({ editor }: { editor: Editor }) {
// start loading
setLoading(true);
const image = await upload(['mp4', 'mp3', 'webm', 'mkv', 'avi', 'mov']);
const image = await ark.upload({
fileExts: ['mp4', 'mp3', 'webm', 'mkv', 'avi', 'mov'],
});
if (image) {
editor.commands.setImage({ src: image });