Spaces:
Running
Running
try a fix
Browse files
app/api/me/projects/[namespace]/[repoId]/images/route.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { NextRequest, NextResponse } from "next/server";
|
|
| 2 |
import { RepoDesignation, spaceInfo, uploadFiles } from "@huggingface/hub";
|
| 3 |
|
| 4 |
import { isAuthenticated } from "@/lib/auth";
|
| 5 |
-
import Project from "@/models/Project";
|
| 6 |
-
import dbConnect from "@/lib/mongodb";
|
| 7 |
|
| 8 |
export async function POST(
|
| 9 |
req: NextRequest,
|
|
|
|
| 2 |
import { RepoDesignation, spaceInfo, uploadFiles } from "@huggingface/hub";
|
| 3 |
|
| 4 |
import { isAuthenticated } from "@/lib/auth";
|
|
|
|
|
|
|
| 5 |
|
| 6 |
export async function POST(
|
| 7 |
req: NextRequest,
|
components/editor/preview/index.tsx
CHANGED
|
@@ -735,7 +735,7 @@ export const Preview = ({
|
|
| 735 |
<div
|
| 736 |
className="cursor-pointer absolute bg-sky-500/10 border-[2px] border-dashed border-sky-500 rounded-r-lg rounded-b-lg p-3 z-10 pointer-events-none"
|
| 737 |
style={{
|
| 738 |
-
top: hoveredElement.rect.top,
|
| 739 |
left: hoveredElement.rect.left,
|
| 740 |
width: hoveredElement.rect.width,
|
| 741 |
height: hoveredElement.rect.height,
|
|
@@ -796,11 +796,7 @@ export const Preview = ({
|
|
| 796 |
}
|
| 797 |
)}
|
| 798 |
src={
|
| 799 |
-
|
| 800 |
-
!isNew &&
|
| 801 |
-
!hasUnsavedChanges &&
|
| 802 |
-
project?.space_id &&
|
| 803 |
-
!project?.private
|
| 804 |
? `https://${project.space_id.replaceAll(
|
| 805 |
"/",
|
| 806 |
"-"
|
|
@@ -809,14 +805,15 @@ export const Preview = ({
|
|
| 809 |
}
|
| 810 |
srcDoc={
|
| 811 |
currentCommit
|
| 812 |
-
?
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
|
|
|
| 816 |
? isNew
|
| 817 |
? throttledHtml || defaultHTML
|
| 818 |
: stableHtml
|
| 819 |
-
:
|
| 820 |
}
|
| 821 |
onLoad={() => {
|
| 822 |
if (
|
|
|
|
| 735 |
<div
|
| 736 |
className="cursor-pointer absolute bg-sky-500/10 border-[2px] border-dashed border-sky-500 rounded-r-lg rounded-b-lg p-3 z-10 pointer-events-none"
|
| 737 |
style={{
|
| 738 |
+
top: hoveredElement.rect.top + 40,
|
| 739 |
left: hoveredElement.rect.left,
|
| 740 |
width: hoveredElement.rect.width,
|
| 741 |
height: hoveredElement.rect.height,
|
|
|
|
| 796 |
}
|
| 797 |
)}
|
| 798 |
src={
|
| 799 |
+
currentCommit && project?.space_id && !project?.private
|
|
|
|
|
|
|
|
|
|
|
|
|
| 800 |
? `https://${project.space_id.replaceAll(
|
| 801 |
"/",
|
| 802 |
"-"
|
|
|
|
| 805 |
}
|
| 806 |
srcDoc={
|
| 807 |
currentCommit
|
| 808 |
+
? undefined
|
| 809 |
+
: isNew ||
|
| 810 |
+
hasUnsavedChanges ||
|
| 811 |
+
project?.private ||
|
| 812 |
+
!project?.space_id
|
| 813 |
? isNew
|
| 814 |
? throttledHtml || defaultHTML
|
| 815 |
: stableHtml
|
| 816 |
+
: stableHtml || defaultHTML
|
| 817 |
}
|
| 818 |
onLoad={() => {
|
| 819 |
if (
|
hooks/useAi.ts
CHANGED
|
@@ -66,6 +66,7 @@ export const useAi = (onScrollToBottom?: () => void) => {
|
|
| 66 |
});
|
| 67 |
const setSelectedElement = (newSelectedElement: HTMLElement | null) => {
|
| 68 |
client.setQueryData(["ai.selectedElement"], newSelectedElement);
|
|
|
|
| 69 |
};
|
| 70 |
|
| 71 |
const { data: isEditableModeEnabled = false } = useQuery({
|
|
|
|
| 66 |
});
|
| 67 |
const setSelectedElement = (newSelectedElement: HTMLElement | null) => {
|
| 68 |
client.setQueryData(["ai.selectedElement"], newSelectedElement);
|
| 69 |
+
setIsEditableModeEnabled(false);
|
| 70 |
};
|
| 71 |
|
| 72 |
const { data: isEditableModeEnabled = false } = useQuery({
|