summaryrefslogtreecommitdiff
path: root/apps/web/src/actions/keybindings/migrations/v6-to-v7.ts
blob: 9c05db2329308fd092454274302bbc479ef66075 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { getPersistedKeybindingsState } from "../persisted-state";

export function v6ToV7({ state }: { state: unknown }): unknown {
	const v6 = getPersistedKeybindingsState({ state });
	if (!v6) return state;
	const keybindings = { ...v6.keybindings };

	for (const [key, action] of Object.entries(keybindings)) {
		if (action === "split-element") {
			keybindings[key] = "split";
		}
	}

	return { ...v6, keybindings };
}