diff --git a/plugins/ascii/src/App.tsx b/plugins/ascii/src/App.tsx index b982e6dbb..50f766448 100644 --- a/plugins/ascii/src/App.tsx +++ b/plugins/ascii/src/App.tsx @@ -55,7 +55,10 @@ function ASCIIPlugin({ framerCanvasImage }: { framerCanvasImage: ImageAsset | nu const asciiRef = useRef(null) const { gl, toBytes, program, setProgram, setResolution } = useOGLPipeline() - const isAllowedToUpsertImage = useIsAllowedTo("addImage", "setImage") + const isAllowedToAddImage = useIsAllowedTo("addImage") + const isAllowedToSetImage = useIsAllowedTo("setImage") + const isAllowedToUpsertImage = + framer.mode === "canvas" ? isAllowedToAddImage && isAllowedToSetImage : isAllowedToSetImage useEffect(() => { asciiRef.current?.setPixelSize(exportSize * 0.02) diff --git a/plugins/dither/src/App.tsx b/plugins/dither/src/App.tsx index b9bf1d2bf..8009a20aa 100644 --- a/plugins/dither/src/App.tsx +++ b/plugins/dither/src/App.tsx @@ -42,7 +42,10 @@ export interface DroppedAsset { } function DitherImage({ image }: { image: ImageAsset | null }) { - const isAllowedToUpsertImage = useIsAllowedTo("addImage", "setImage") + const isAllowedToAddImage = useIsAllowedTo("addImage") + const isAllowedToSetImage = useIsAllowedTo("setImage") + const isAllowedToUpsertImage = + framer.mode === "canvas" ? isAllowedToAddImage && isAllowedToSetImage : isAllowedToSetImage const canvasContainerRef = useRef(null) const [droppedAsset, setDroppedAsset] = useState() diff --git a/plugins/unsplash/src/App.tsx b/plugins/unsplash/src/App.tsx index 13dc41def..c8c84b8bb 100644 --- a/plugins/unsplash/src/App.tsx +++ b/plugins/unsplash/src/App.tsx @@ -22,7 +22,7 @@ const minWindowWidth = mode === "canvas" ? 260 : 600 const minColumnWidth = 100 const columnGap = 5 const sidePadding = 15 * 2 -const resizable = framer.mode === "canvas" +const resizable = mode === "canvas" void framer.showUI({ position: "top right", @@ -34,7 +34,7 @@ void framer.showUI({ }) export function App() { - const isAllowedToUpsertImage = useIsAllowedTo("addImage", "setImage") + const isAllowedToUpsertImage = useIsAllowedTo(mode === "canvas" ? "addImage" : "setImage") const [query, setQuery] = useState("") @@ -42,7 +42,6 @@ export function App() { const addRandomMutation = useMutation({ mutationFn: async (query: string) => { - const mode = framer.mode const randomPhoto = await getRandomPhoto(query) if (mode === "canvas") { @@ -83,7 +82,7 @@ export function App() { - +