mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00

* Add disable sync scroll button Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
31 lines
878 B
TypeScript
31 lines
878 B
TypeScript
import { Reducer } from 'redux'
|
|
import {
|
|
EditorConfig,
|
|
EditorConfigActions,
|
|
EditorConfigActionType,
|
|
SetEditorConfigAction,
|
|
SetEditorSyncScrollAction
|
|
} from './types'
|
|
import { EditorMode } from '../../components/editor/app-bar/editor-view-mode'
|
|
|
|
export const initialState: EditorConfig = {
|
|
editorMode: EditorMode.BOTH,
|
|
syncScroll: true
|
|
}
|
|
|
|
export const EditorConfigReducer: Reducer<EditorConfig, EditorConfigActions> = (state: EditorConfig = initialState, action: EditorConfigActions) => {
|
|
switch (action.type) {
|
|
case EditorConfigActionType.SET_EDITOR_VIEW_MODE:
|
|
return {
|
|
...state,
|
|
editorMode: (action as SetEditorConfigAction).mode
|
|
}
|
|
case EditorConfigActionType.SET_SYNC_SCROLL:
|
|
return {
|
|
...state,
|
|
syncScroll: (action as SetEditorSyncScrollAction).syncScroll
|
|
}
|
|
default:
|
|
return state
|
|
}
|
|
}
|