[Fix] Reset comment mode hotkey (#6401)

This commit is contained in:
Rishabh Saxena 2021-08-05 18:57:48 +05:30 committed by GitHub
parent a21375e104
commit 4bd1ffb324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View File

@ -1,13 +1,10 @@
import React from "react";
import { connect } from "react-redux";
import { Hotkey, Hotkeys } from "@blueprintjs/core";
import { HotkeysTarget } from "@blueprintjs/core/lib/esnext/components/hotkeys/hotkeysTarget.js";
import { setCommentMode as setCommentModeAction } from "actions/commentActions";
import { setCommentModeInUrl } from "pages/Editor/ToggleModeButton";
type Props = {
resetCommentMode: () => void;
children: React.ReactNode;
};
@ -22,7 +19,7 @@ class GlobalHotKeys extends React.Component<Props> {
group="Canvas"
label="Reset"
onKeyDown={(e: any) => {
this.props.resetCommentMode();
setCommentModeInUrl(false);
e.preventDefault();
}}
/>
@ -30,7 +27,7 @@ class GlobalHotKeys extends React.Component<Props> {
combo="v"
global
label="View Mode"
onKeyDown={this.props.resetCommentMode}
onKeyDown={() => setCommentModeInUrl(false)}
/>
<Hotkey
combo="c"
@ -47,10 +44,4 @@ class GlobalHotKeys extends React.Component<Props> {
}
}
const mapDispatchToProps = (dispatch: any) => {
return {
resetCommentMode: () => dispatch(setCommentModeAction(false)),
};
};
export default connect(null, mapDispatchToProps)(GlobalHotKeys);
export default GlobalHotKeys;

View File

@ -22,7 +22,6 @@ import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
import { getSelectedText } from "utils/helpers";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { WIDGETS_SEARCH_ID } from "constants/Explorer";
import { setCommentMode as setCommentModeAction } from "actions/commentActions";
import { resetSnipingMode as resetSnipingModeAction } from "actions/propertyPaneActions";
import { showDebugger } from "actions/debuggerActions";
@ -35,7 +34,6 @@ type Props = {
deleteSelectedWidget: () => void;
cutSelectedWidget: () => void;
toggleShowGlobalSearchModal: () => void;
resetCommentMode: () => void;
resetSnipingMode: () => void;
openDebugger: () => void;
closeProppane: () => void;
@ -190,7 +188,7 @@ class GlobalHotKeys extends React.Component<Props> {
group="Canvas"
label="Deselect all Widget"
onKeyDown={(e: any) => {
this.props.resetCommentMode();
setCommentModeInUrl(false);
this.props.resetSnipingMode();
this.props.deselectAllWidgets();
this.props.closeProppane();
@ -203,7 +201,7 @@ class GlobalHotKeys extends React.Component<Props> {
global
label="Edit Mode"
onKeyDown={(e: any) => {
this.props.resetCommentMode();
setCommentModeInUrl(false);
this.props.resetSnipingMode();
e.preventDefault();
}}
@ -245,7 +243,6 @@ const mapDispatchToProps = (dispatch: any) => {
deleteSelectedWidget: () => dispatch(deleteSelectedWidget(true)),
cutSelectedWidget: () => dispatch(cutWidget()),
toggleShowGlobalSearchModal: () => dispatch(toggleShowGlobalSearchModal()),
resetCommentMode: () => dispatch(setCommentModeAction(false)),
resetSnipingMode: () => dispatch(resetSnipingModeAction()),
openDebugger: () => dispatch(showDebugger()),
closeProppane: () => dispatch(closePropertyPane()),