|
@@ -36,13 +36,15 @@ const datas = [
|
|
|
|
|
|
export const EditorsPage = (
|
|
|
data = { type: "", name: "", text: "", index: "", theme: "", font: "" },
|
|
|
- onSave,
|
|
|
- onChange
|
|
|
+ onSave
|
|
|
+ // onChange
|
|
|
) => {
|
|
|
const [editors, setEditors] = useState(datas);
|
|
|
const [title, setTitle] = useState("");
|
|
|
const [description, setDescription] = useState("");
|
|
|
const [srcDoc, setSrcDoc] = useState("");
|
|
|
+ const [theme, setTheme] = useState();
|
|
|
+ const [font, setFont] = useState();
|
|
|
|
|
|
useEffect(() => {
|
|
|
const timeout = setTimeout(() => {
|
|
@@ -64,18 +66,14 @@ export const EditorsPage = (
|
|
|
return () => clearTimeout(timeout);
|
|
|
}, [editors]);
|
|
|
|
|
|
- const changeTheme = (theme) => onChange({ theme });
|
|
|
-
|
|
|
- const changeFont = (font) => onChange({ font });
|
|
|
-
|
|
|
return (
|
|
|
<>
|
|
|
<div className="styles">
|
|
|
{"Theme: "}
|
|
|
- <SelectTheme onChange={() => changeTheme} value={data.theme} />
|
|
|
+ <SelectTheme onChange={setTheme} value={theme} />
|
|
|
<br />
|
|
|
{"FontSize: "}
|
|
|
- <SelectFontSize onChange={() => changeFont} value={data.font} />
|
|
|
+ <SelectFontSize onChange={setFont} value={font} />
|
|
|
<br />
|
|
|
</div>
|
|
|
{editors.map((data, index) => {
|
|
@@ -83,8 +81,8 @@ export const EditorsPage = (
|
|
|
<Editor
|
|
|
data={data}
|
|
|
key={index}
|
|
|
- theme='monokai'
|
|
|
- font={16}
|
|
|
+ theme={theme}
|
|
|
+ font={font}
|
|
|
onChange={(newData) => {
|
|
|
let editor = [...editors];
|
|
|
editor.splice(index, 1, newData);
|