fix editor file handling

This commit is contained in:
Philipinho
2024-06-22 03:33:54 +01:00
parent 2aec5a3fe7
commit df1840cf67
12 changed files with 71 additions and 75 deletions

View File

@ -1,7 +1,7 @@
import { NodeViewProps, NodeViewWrapper } from "@tiptap/react";
import { useMemo } from "react";
import { Image } from "@mantine/core";
import { getBackendUrl } from "@/lib/config.ts";
import { getFileUrl } from "@/lib/config.ts";
export default function ImageView(props: NodeViewProps) {
const { node, selected } = props;
@ -23,9 +23,9 @@ export default function ImageView(props: NodeViewProps) {
>
<Image
radius="md"
src={getBackendUrl() + src}
fit="contain"
w={width}
src={getFileUrl(src)}
className={selected && "ProseMirror-selectednode"}
/>
</NodeViewWrapper>

View File

@ -4,7 +4,6 @@ import { uploadFile } from "@/features/page/services/page-service.ts";
export const uploadImageAction = handleImageUpload({
onUpload: async (file: File, pageId: string): Promise<any> => {
try {
console.log("dont upload");
return await uploadFile(file, pageId);
} catch (err) {
console.error("failed to upload image", err);