fix: cmd/ctrl native browser behavior blocked in inputs (#4589)

* fix: cmd/ctrl native browser behavior blocked in inputs

* add basic test for fontSize increase/decrease via keyboard

* add tests for fontSize resizing via keyboard outside wysiwyg

* Update src/element/textWysiwyg.test.tsx

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>

* Update src/tests/resize.test.tsx

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>

* Update src/tests/resize.test.tsx

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
David Luzar 2022-01-13 19:53:22 +01:00 committed by GitHub
parent dba71e358d
commit 1fd2fe56ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 17 deletions

View file

@ -25,7 +25,7 @@ export const actionCut = register({
name: "cut",
perform: (elements, appState, data, app) => {
actionCopy.perform(elements, appState, data, app);
return actionDeleteSelected.perform(elements, appState, data, app);
return actionDeleteSelected.perform(elements, appState);
},
contextItemLabel: "labels.cut",
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.code === CODES.X,

View file

@ -2,7 +2,9 @@ import { Action } from "./types";
export let actions: readonly Action[] = [];
export const register = (action: Action): Action => {
export const register = <T extends Action>(action: T) => {
actions = actions.concat(action);
return action;
return action as T & {
keyTest?: unknown extends T["keyTest"] ? never : T["keyTest"];
};
};