mirror of
https://github.com/usebruno/bruno.git
synced 2025-08-20 05:38:58 +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 EditorKeymapSettings = ({ close }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const preferences = useSelector((state) => state.app.preferences);
|
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) => {
|
const handleKeymapChange = (e) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
savePreferences({
|
savePreferences({
|
||||||
...preferences,
|
...preferences,
|
||||||
editor: { keymap: e.target.value }
|
editor: { ...editorPreferences, keymap: e.target.value }
|
||||||
})
|
})
|
||||||
).catch(console.error);
|
).catch(console.error);
|
||||||
};
|
};
|
||||||
|
@@ -97,6 +97,7 @@ export const {
|
|||||||
updateSystemProxyEnvVariables
|
updateSystemProxyEnvVariables
|
||||||
} = appSlice.actions;
|
} = appSlice.actions;
|
||||||
|
|
||||||
|
// TODO: Need a equivalent method which allows setting preferences for individual sub-section
|
||||||
export const savePreferences = (preferences) => (dispatch, getState) => {
|
export const savePreferences = (preferences) => (dispatch, getState) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const { ipcRenderer } = window;
|
const { ipcRenderer } = window;
|
||||||
|
@@ -58,6 +58,9 @@ const preferencesSchema = Yup.object().shape({
|
|||||||
codeFont: Yup.string().nullable(),
|
codeFont: Yup.string().nullable(),
|
||||||
codeFontSize: Yup.number().min(1).max(32).nullable()
|
codeFontSize: Yup.number().min(1).max(32).nullable()
|
||||||
}),
|
}),
|
||||||
|
editor: Yup.object().shape({
|
||||||
|
keymap: Yup.string().oneOf(['sublime', 'vim', 'emacs']).nullable(),
|
||||||
|
}),
|
||||||
proxy: Yup.object({
|
proxy: Yup.object({
|
||||||
mode: Yup.string().oneOf(['off', 'on', 'system']),
|
mode: Yup.string().oneOf(['off', 'on', 'system']),
|
||||||
protocol: Yup.string().oneOf(['http', 'https', 'socks4', 'socks5']),
|
protocol: Yup.string().oneOf(['http', 'https', 'socks4', 'socks5']),
|
||||||
|
Reference in New Issue
Block a user