mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2025-03-26 07:13:59 +01:00
30 lines
722 B
TypeScript
30 lines
722 B
TypeScript
import { createSlice } from "@reduxjs/toolkit";
|
|
import { RootState } from "./rootReducer";
|
|
|
|
export interface EditorState {
|
|
hotkeysEnabled: boolean;
|
|
}
|
|
|
|
const initialState: EditorState = {
|
|
hotkeysEnabled: true,
|
|
};
|
|
|
|
export const editorSlice = createSlice({
|
|
name: 'editor',
|
|
initialState: initialState,
|
|
reducers: {
|
|
disableHotkeys(state) {
|
|
state.hotkeysEnabled = false;
|
|
},
|
|
enableHotkeys(state) {
|
|
state.hotkeysEnabled = true;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const hotkeysEnabled = (state: RootState): boolean => {
|
|
return state.editor.hotkeysEnabled;
|
|
};
|
|
|
|
export const { disableHotkeys, enableHotkeys } = editorSlice.actions;
|
|
export default editorSlice.reducer; |