@firecms/core 3.0.0-canary.205 → 3.0.0-canary.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.205",
4
+ "version": "3.0.0-canary.206",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -50,9 +50,9 @@
50
50
  "./package.json": "./package.json"
51
51
  },
52
52
  "dependencies": {
53
- "@firecms/editor": "^3.0.0-canary.205",
54
- "@firecms/formex": "^3.0.0-canary.205",
55
- "@firecms/ui": "^3.0.0-canary.205",
53
+ "@firecms/editor": "^3.0.0-canary.206",
54
+ "@firecms/formex": "^3.0.0-canary.206",
55
+ "@firecms/ui": "^3.0.0-canary.206",
56
56
  "@hello-pangea/dnd": "^17.0.0",
57
57
  "@radix-ui/react-portal": "^1.1.3",
58
58
  "clsx": "^2.1.1",
@@ -104,7 +104,7 @@
104
104
  "dist",
105
105
  "src"
106
106
  ],
107
- "gitHead": "b3a2a795ce5eb7edc68efea5caa69b8d477901be",
107
+ "gitHead": "1e2b2703b9a4c0b7282a2a489193f57f1754730e",
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
@@ -131,7 +131,7 @@ export function EntityForm<M extends Record<string, any>>({
131
131
  entityId: entityIdProp,
132
132
  collection,
133
133
  path,
134
- values: valuesToBeSaved,
134
+ values: valuesToBeSaved
135
135
  });
136
136
  }, false, 2000);
137
137
 
@@ -222,6 +222,29 @@ export function EntityForm<M extends Record<string, any>>({
222
222
  }
223
223
  });
224
224
 
225
+
226
+ useEffect(() => {
227
+
228
+ const handleKeyDown = (e: KeyboardEvent) => {
229
+ const isUndo = (e.metaKey || e.ctrlKey) && !e.shiftKey && e.key.toLowerCase() === "z";
230
+ const isRedo =
231
+ ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key.toLowerCase() === "z") ||
232
+ ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.key.toLowerCase() === "y");
233
+
234
+ if (isUndo && formex.canUndo) {
235
+ e.preventDefault();
236
+ formex.undo();
237
+ } else if (isRedo && formex.canRedo) {
238
+ e.preventDefault();
239
+ formex.redo();
240
+ }
241
+ };
242
+
243
+ window.addEventListener("keydown", handleKeyDown);
244
+ return () => window.removeEventListener("keydown", handleKeyDown);
245
+
246
+ }, [formex]);
247
+
225
248
  const resolvedCollection = useMemo(() => resolveCollection<M>({
226
249
  collection,
227
250
  path,
@@ -349,7 +372,7 @@ export function EntityForm<M extends Record<string, any>>({
349
372
  path,
350
373
  entityId,
351
374
  values,
352
- previousValues,
375
+ previousValues
353
376
  });
354
377
  }
355
378
  };
@@ -656,7 +679,7 @@ export function EntityForm<M extends Record<string, any>>({
656
679
  <form
657
680
  onSubmit={formContext.formex.handleSubmit}
658
681
  onReset={() => formex.resetForm({
659
- values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs) as M,
682
+ values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs) as M
660
683
  })}
661
684
  noValidate
662
685
  className={cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className)}>