Replies: 6 comments 8 replies
-
Hey @lohi212! To be honest, we've never wondered about the need for this possibility. Would you mind describing how you would take advantage of this feature? What are the use cases? Thanks, looking forward to helping you with this. |
Beta Was this translation helpful? Give feedback.
-
hi @danilowoz , did code sandbox feature SandpackFileExplorer , we can add more files or not. |
Beta Was this translation helpful? Give feedback.
-
Hi ma'am, I am facing a problem. I am using sanpack packages to create a
react environment. I built an react online editor for my application where
code is written and then stored in the database. When the code is stored in
the database then the react editor disappears. Now when I retrieve(code)
from the database I want it to show me a widget instead of code. Like that
i write a code for making buttons it will show button widget instead of
code. I have got an api and everything works smoothly but the data(Code)
present in the database does not convert it to a widget.I am very thankful
for that If you help me.
…On Mon, Sep 11, 2023 at 1:22 PM Danilo Woznica ***@***.***> wrote:
Closed #464 <#464> as
resolved.
—
Reply to this email directly, view it on GitHub
<#464>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXCASLUK56OLUQQDK6AFG43XZ3C4NANCNFSM5VNLA66A>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Sure, first I will explain my application behaviour.
In my application there is a React editor. i want that when a user writes
code in react editor then it clicks on the save button after clicking on
the save button its code stored in the database and gives a widget .The
user uses this widget by drag and drop functionality. i want to make my
project (like Hostinger) where react is written and in response to it give
me a widget.
Now my problem is that I saved my code in the database by making a react
environment but in return did not give me a widget.
here is my react editor environment
import React from "react";
import { CustomAceEditor } from "./CustomAceEditor";
import { SandpackProvider, SandpackPreview } from
***@***.***/sandpack-react";
export const CustomSandpack = () => (
<SandpackProvider template="react">
<CustomAceEditor />
<SandpackPreview showRefreshButton={false} showOpenInCodeSandbox={false}
/>
</SandpackProvider>
);
and here is my CustomAceEditor
import React from "react";
import axios from "axios";
import AceEditor from "react-ace";
import { useActiveCode } from ***@***.***/sandpack-react";
import "ace-builds/src-noconflict/mode-javascript";
import "ace-builds/src-noconflict/theme-textmate";
export const CustomAceEditor = () => {
const { code, updateCode } = useActiveCode();
const handleSaveCode = async () => {
try {
await axios.post("http://localhost:3005/api/code", { code });
alert("Code snippet saved successfully");
} catch (error) {
console.error("Error:", error);
alert("An error occurred while saving the code snippet");
}
console.log("Code :", code);
};
return (
<div>
<AceEditor
mode="javascript"
defaultValue={code}
onChange={updateCode}
fontSize={14}
height="300px"
width="100%"
setOptions={{ useWorker: false }}
/>
<button onClick={handleSaveCode}>Save Code</button>
</div>
);
};
…On Thu, Sep 14, 2023 at 12:04 PM lohi ***@***.***> wrote:
Hi @bilalahmed2500sxs <https://github.com/bilalahmed2500sxs>, Can you
please provide a codesandbox link or some example with your use case?
—
Reply to this email directly, view it on GitHub
<#464 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXCASLWIS3ERUADI46HZKY3X2KUBXANCNFSM5VNLA66A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@danilowoz hi, will we stored both code and its output in the database by using sandpack packages? |
Beta Was this translation helpful? Give feedback.
-
@lohi212 @danilowoz const MySandpackComponent = () => { will we use CustomAceEditor with it or not, instead of |
Beta Was this translation helpful? Give feedback.
-
Hey, I was using the FileExplorer as mentioned here: https://codesandbox.io/s/file-explorer-1ffn6?file=/src/App.tsx:547-565, #98.
Is adding a new Folder possible on top of this?
Beta Was this translation helpful? Give feedback.
All reactions