Skip to content

Commit

Permalink
[#54612] Enable redo with ctrl shift z
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejWas committed Feb 1, 2024
1 parent d6f0c3b commit 3c21da3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/CodeMirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'preact/hooks';
import { html } from "htm/preact";
import { basicSetup, EditorView } from "codemirror";
import { keymap } from "@codemirror/view";
import { indentWithTab } from "@codemirror/commands";
import { indentWithTab, redo } from "@codemirror/commands";
import { EditorState } from "@codemirror/state";
import styled from 'styled-components';
import { yCollab } from "y-codemirror.next";
Expand Down Expand Up @@ -133,7 +133,8 @@ const CodeMirror = ({ text, setText, id, name, className, mode, syncText, setSyn
const extensions = [
collaboration.enabled ? basicSetupWithoutHistory : basicSetup,
keymap.of([
indentWithTab
indentWithTab,
{ key: "Mod-Z", run: redo }
]),
markdown(),
spellcheck(spellcheckOpts),
Expand All @@ -151,6 +152,7 @@ const CodeMirror = ({ text, setText, id, name, className, mode, syncText, setSyn
extensions.push(keymap.of([
{ key: "Mod-z", run: () => undoManager.undo(), preventDefault: true },
{ key: "Mod-y", run: () => undoManager.redo(), preventDefault: true },
{ key: "Mod-Z", run: () => undoManager.redo(), preventDefault: true },
]));
}

Expand Down

0 comments on commit 3c21da3

Please sign in to comment.