mirror of
https://github.com/usebruno/bruno.git
synced 2025-08-19 17:35:36 +02:00
Fix: Review fixes and add schema for editor-preferences
This commit is contained in:
@@ -14,13 +14,14 @@ const codemirrorKeymaps = [
|
||||
const EditorKeymapSettings = ({ close }) => {
|
||||
const dispatch = useDispatch();
|
||||
const preferences = useSelector((state) => state.app.preferences);
|
||||
const keymap = useMemo(() => get(preferences, 'editor.keymap', 'sublime'), [preferences]);
|
||||
const editorPreferences = preferences.editor || {};
|
||||
const keymap = editorPreferences.keymap || 'sublime';
|
||||
|
||||
const handleKeymapChange = (e) => {
|
||||
dispatch(
|
||||
savePreferences({
|
||||
...preferences,
|
||||
editor: { keymap: e.target.value }
|
||||
editor: { ...editorPreferences, keymap: e.target.value }
|
||||
})
|
||||
).catch(console.error);
|
||||
};
|
||||
|
@@ -97,6 +97,7 @@ export const {
|
||||
updateSystemProxyEnvVariables
|
||||
} = appSlice.actions;
|
||||
|
||||
// TODO: Need a equivalent method which allows setting preferences for individual sub-section
|
||||
export const savePreferences = (preferences) => (dispatch, getState) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const { ipcRenderer } = window;
|
||||
|
@@ -58,6 +58,9 @@ const preferencesSchema = Yup.object().shape({
|
||||
codeFont: Yup.string().nullable(),
|
||||
codeFontSize: Yup.number().min(1).max(32).nullable()
|
||||
}),
|
||||
editor: Yup.object().shape({
|
||||
keymap: Yup.string().oneOf(['sublime', 'vim', 'emacs']).nullable(),
|
||||
}),
|
||||
proxy: Yup.object({
|
||||
mode: Yup.string().oneOf(['off', 'on', 'system']),
|
||||
protocol: Yup.string().oneOf(['http', 'https', 'socks4', 'socks5']),
|
||||
|
Reference in New Issue
Block a user