Fix: using space in shortcuts table break the app
This commit is contained in:
parent
a58f0b0c7e
commit
a7187ff723
3 changed files with 24 additions and 19 deletions
|
|
@ -46,8 +46,8 @@ export default function NodeToolbarComponent({
|
||||||
setShowState,
|
setShowState,
|
||||||
onCloseAdvancedModal,
|
onCloseAdvancedModal,
|
||||||
isOutdated,
|
isOutdated,
|
||||||
openWDoubleClick,
|
// openWDoubleClick,
|
||||||
setOpenWDoubleClick,
|
// setOpenWDoubleClick,
|
||||||
}: nodeToolbarPropsType): JSX.Element {
|
}: nodeToolbarPropsType): JSX.Element {
|
||||||
const nodeLength = Object.keys(data.node!.template).filter(
|
const nodeLength = Object.keys(data.node!.template).filter(
|
||||||
(templateField) =>
|
(templateField) =>
|
||||||
|
|
@ -206,9 +206,9 @@ export default function NodeToolbarComponent({
|
||||||
createFlowComponent(cloneDeep(data), version),
|
createFlowComponent(cloneDeep(data), version),
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (openWDoubleClick) setShowModalAdvanced(true);
|
// if (openWDoubleClick) setShowModalAdvanced(true);
|
||||||
}, [openWDoubleClick, setOpenWDoubleClick]);
|
// }, [openWDoubleClick, setOpenWDoubleClick]);
|
||||||
|
|
||||||
const openInNewTab = (url) => {
|
const openInNewTab = (url) => {
|
||||||
window.open(url, "_blank", "noreferrer");
|
window.open(url, "_blank", "noreferrer");
|
||||||
|
|
@ -697,7 +697,7 @@ export default function NodeToolbarComponent({
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
{showModalAdvanced && (
|
{showModalAdvanced && (
|
||||||
<EditNodeModal
|
<EditNodeModal
|
||||||
setOpenWDoubleClick={setOpenWDoubleClick}
|
// setOpenWDoubleClick={setOpenWDoubleClick}
|
||||||
data={data}
|
data={data}
|
||||||
nodeLength={nodeLength}
|
nodeLength={nodeLength}
|
||||||
open={showModalAdvanced}
|
open={showModalAdvanced}
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ export default function EditShortcutButton({
|
||||||
const unavaliableShortcuts = useShortcutsStore(
|
const unavaliableShortcuts = useShortcutsStore(
|
||||||
(state) => state.unavailableShortcuts,
|
(state) => state.unavailableShortcuts,
|
||||||
);
|
);
|
||||||
const a = useShortcutsStore((state) => state.advanced);
|
|
||||||
console.log(a);
|
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
|
||||||
function canEditCombination(newCombination: string): boolean {
|
function canEditCombination(newCombination: string): boolean {
|
||||||
|
|
@ -138,6 +136,11 @@ export default function EditShortcutButton({
|
||||||
if (e.key?.toLowerCase() === "meta") {
|
if (e.key?.toLowerCase() === "meta") {
|
||||||
fixedKey = "Cmd";
|
fixedKey = "Cmd";
|
||||||
}
|
}
|
||||||
|
if (e.key?.toLowerCase() === " ") {
|
||||||
|
fixedKey = "Space";
|
||||||
|
}
|
||||||
|
if (shortcutInitialValue?.toUpperCase().includes(fixedKey.toUpperCase()))
|
||||||
|
return;
|
||||||
setKey((oldKey) =>
|
setKey((oldKey) =>
|
||||||
getFixedCombination({ oldKey: oldKey!, key: fixedKey }),
|
getFixedCombination({ oldKey: oldKey!, key: fixedKey }),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -68,17 +68,19 @@ export default function ShortcutsPage() {
|
||||||
<div>
|
<div>
|
||||||
<div className="align-end mb-4 flex w-full justify-end">
|
<div className="align-end mb-4 flex w-full justify-end">
|
||||||
<div className="justify center flex items-center">
|
<div className="justify center flex items-center">
|
||||||
<EditShortcutButton
|
{open && (
|
||||||
disable={selectedRows.length === 0}
|
<EditShortcutButton
|
||||||
defaultCombination={combinationToEdit[0]?.shortcut}
|
disable={selectedRows.length === 0}
|
||||||
shortcut={selectedRows}
|
defaultCombination={combinationToEdit[0]?.shortcut}
|
||||||
defaultShortcuts={shortcuts}
|
shortcut={selectedRows}
|
||||||
open={open}
|
defaultShortcuts={shortcuts}
|
||||||
setOpen={setOpen}
|
open={open}
|
||||||
setSelected={setSelectedRows}
|
setOpen={setOpen}
|
||||||
>
|
setSelected={setSelectedRows}
|
||||||
<div style={{ display: "none" }} />
|
>
|
||||||
</EditShortcutButton>
|
<div style={{ display: "none" }} />
|
||||||
|
</EditShortcutButton>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
className="ml-3"
|
className="ml-3"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue