浏览代码

improvement: adding zen mode to context menu (#2734)

Carl Sverre 4 年之前
父节点
当前提交
629341da4d
共有 4 个文件被更改,包括 10 次插入0 次删除
  1. 2 0
      src/actions/shortcuts.ts
  2. 6 0
      src/components/App.tsx
  3. 1 0
      src/packages/excalidraw/CHANGELOG.md
  4. 1 0
      src/tests/regressionTests.test.tsx

+ 2 - 0
src/actions/shortcuts.ts

@@ -20,6 +20,7 @@ export type ShortcutName =
   | "group"
   | "ungroup"
   | "gridMode"
+  | "zenMode"
   | "stats"
   | "addToLibrary";
 
@@ -52,6 +53,7 @@ const shortcutMap: Record<ShortcutName, string[]> = {
   group: [getShortcutKey("CtrlOrCmd+G")],
   ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")],
   gridMode: [getShortcutKey("CtrlOrCmd+'")],
+  zenMode: [getShortcutKey("Alt+Z")],
   stats: [],
   addToLibrary: [],
 };

+ 6 - 0
src/components/App.tsx

@@ -3639,6 +3639,12 @@ class App extends React.Component<ExcalidrawProps, AppState> {
             action: this.toggleGridMode,
           },
           {
+            checked: this.state.zenModeEnabled,
+            shortcutName: "zenMode",
+            label: t("buttons.zenMode"),
+            action: this.toggleZenMode,
+          },
+          {
             checked: this.state.showStats,
             shortcutName: "stats",
             label: t("stats.title"),

+ 1 - 0
src/packages/excalidraw/CHANGELOG.md

@@ -44,6 +44,7 @@ Please add the latest change on the top under the correct section.
 
 ### Improvements
 
+- Added Zen Mode to the context menu [#2734](https://github.com/excalidraw/excalidraw/pull/2734)
 - Do not reset to selection when using the draw tool [#2721](https://github.com/excalidraw/excalidraw/pull/2721)
 - Display proper tooltip for 2-point lines during resize, and normalize modifier key labels in hints [#2655](https://github.com/excalidraw/excalidraw/pull/2655)
 - Improve error message around importing images [#2619](https://github.com/excalidraw/excalidraw/pull/2619)

+ 1 - 0
src/tests/regressionTests.test.tsx

@@ -621,6 +621,7 @@ describe("regression tests", () => {
     const expectedShortcutNames: ShortcutName[] = [
       "selectAll",
       "gridMode",
+      "zenMode",
       "stats",
     ];