mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
refatoring image upload error
This commit is contained in:
@@ -51,6 +51,7 @@ export default function Modal({
|
||||
: " bg-opacity-0 -z-50 ")
|
||||
}
|
||||
onClick={modalControl.closeModal}
|
||||
// if mouse up here, do not, if mouse down then still do
|
||||
>
|
||||
<div
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -39,7 +39,7 @@ export const useUpdateImageSettingsForAssignment = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (!enable_images) {
|
||||
console.log("not uploading images, FILE_POLLING is not set to true");
|
||||
console.log("not uploading images, NEXT_PUBLIC_ENABLE_FILE_SYNC is not set to true");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ export const useAddNewImagesToCanvasMutation = () => {
|
||||
return useMutation({
|
||||
mutationFn: async ({ markdownString }: { markdownString: string }) => {
|
||||
const imageSources = extractImageSources(markdownString);
|
||||
// console.log("original image urls", imageSources);
|
||||
const newImages = imageSources.filter((source) =>
|
||||
settings.assets.every((a) => a.sourceUrl !== source)
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { marked } from "marked";
|
||||
import DOMPurify from "isomorphic-dompurify";
|
||||
import { LocalCourseSettings } from "@/models/local/localCourseSettings";
|
||||
import markedKatex from "marked-katex-extension";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
marked.use(
|
||||
markedKatex({
|
||||
@@ -37,8 +38,12 @@ export function convertImagesToCanvasImages(
|
||||
for (const imageSrc of imageSources) {
|
||||
const destinationUrl = imageLookup[imageSrc];
|
||||
if (typeof destinationUrl === "undefined") {
|
||||
throw `cannot convert to html, no canvas url for ${imageSrc} in settings`;
|
||||
console.log(`No image in settings for ${imageSrc}, do you have NEXT_PUBLIC_ENABLE_FILE_SYNC=true in your settings?`)
|
||||
}
|
||||
// could error check here, but better to just not display an image...
|
||||
// if (typeof destinationUrl === "undefined") {
|
||||
// throw `cannot convert to html, no canvas url for ${imageSrc} in settings`;
|
||||
// }
|
||||
mutableHtml = mutableHtml.replaceAll(imageSrc, destinationUrl);
|
||||
}
|
||||
return mutableHtml;
|
||||
|
||||
Reference in New Issue
Block a user