This commit is contained in:
Víctor Losada Hernández
2026-08-23 18:36:38 +02:00
parent f88d6fd844
commit 689aef910f
2 changed files with 64 additions and 0 deletions
+9
View File
@@ -8,6 +8,7 @@ import dedent from 'dedent';
import CodeEditor from '@components/codeEditor/codeEditor.jsx';
import SnippetBar from './snippetbar/snippetbar.jsx';
import MetadataEditor from './metadataEditor/metadataEditor.jsx';
import SettingsEditor from './settingsEditor/settingsEditor.jsx';
const EDITOR_THEME_KEY = 'HB_editor_theme';
@@ -297,6 +298,14 @@ const Editor = createReactClass({
style={{ height: `calc(100% - 25px)` }}/>
</>;
}
if(this.isSettings()){
return <>
<CodeEditor key='codeEditor'
view={this.state.view}
style={{ display: 'none' }}/>
<SettingsEditor />
</>
}
},
redo : function(){
@@ -0,0 +1,55 @@
import "./metadataEditor.less";
import React, { useState } from "react";
const SettingsEditor = () => {
const [settings, setSettings] = useState({
blockShading: false,
activeLineShading: true,
showLineNumbers: true,
});
const handleFieldChange = (setting, e) => {
setSettings((prevSettings) => ({
...prevSettings,
[setting]: e.target.checked,
}));
};
return (
<div className="settingsEditor">
<h1>Editor Settings</h1>
<label>
Background Shading of blocks in editor
<input
type="checkbox"
name="blockShading"
checked={settings.blockShading}
onChange={(e) => handleFieldChange("blockShading", e)}
/>
</label>
<label>
Shading of active line
<input
type="checkbox"
name="activeLineShading"
checked={settings.activeLineShading}
onChange={(e) => handleFieldChange("activeLineShading", e)}
/>
</label>
<label>
Show Line Numbers
<input
type="checkbox"
name="showLineNumbers"
checked={settings.showLineNumbers}
onChange={(e) => handleFieldChange("showLineNumbers", e)}
/>
</label>
</div>
);
};
export default SettingsEditor;