change font-size to be a range input with quick example

This commit is contained in:
Víctor Losada Hernández
2026-09-23 23:59:23 +02:00
parent fc8c6d9955
commit 6ec10d6f6f
3 changed files with 7 additions and 16 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ const Editor = forwardRef(
showImagePreviews : true,
activeLineShading : true,
lineNumbers : true,
fontSize : 13,
fontSize : 1,
editorTheme : 'default',
});
@@ -4,17 +4,7 @@ import React from 'react';
const SettingsEditor = ({ settings, updateSettings = ()=>{}, EditorThemeNameList })=>{
const validations = {
fontSize : [
(value)=>{
const number = Number(value);
if(number < 9 || number > 30) {
return 'Font size must be between 9 and 30.';
}
return null;
},
],
};
const handleFieldChange = (setting, e)=>{
@@ -129,12 +119,13 @@ const SettingsEditor = ({ settings, updateSettings = ()=>{}, EditorThemeNameList
</label>
<div className='value'>
<small>from 9px to 30px</small>
<small style={{ fontSize: `${settings.fontSize || 1}em` }}>from 9px to 30px</small>
<input
id='fontSize'
type='number'
min={9}
max={30}
type='range'
min={.6}
step={.1}
max={2}
name='fontSize'
value={settings.fontSize}
onChange={(e)=>handleFieldChange('fontSize', e)}