[Fix] Reset comment mode hotkey (#6401)
This commit is contained in:
parent
a21375e104
commit
4bd1ffb324
|
|
@ -1,13 +1,10 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { Hotkey, Hotkeys } from "@blueprintjs/core";
|
import { Hotkey, Hotkeys } from "@blueprintjs/core";
|
||||||
import { HotkeysTarget } from "@blueprintjs/core/lib/esnext/components/hotkeys/hotkeysTarget.js";
|
import { HotkeysTarget } from "@blueprintjs/core/lib/esnext/components/hotkeys/hotkeysTarget.js";
|
||||||
import { setCommentMode as setCommentModeAction } from "actions/commentActions";
|
|
||||||
|
|
||||||
import { setCommentModeInUrl } from "pages/Editor/ToggleModeButton";
|
import { setCommentModeInUrl } from "pages/Editor/ToggleModeButton";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
resetCommentMode: () => void;
|
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -22,7 +19,7 @@ class GlobalHotKeys extends React.Component<Props> {
|
||||||
group="Canvas"
|
group="Canvas"
|
||||||
label="Reset"
|
label="Reset"
|
||||||
onKeyDown={(e: any) => {
|
onKeyDown={(e: any) => {
|
||||||
this.props.resetCommentMode();
|
setCommentModeInUrl(false);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -30,7 +27,7 @@ class GlobalHotKeys extends React.Component<Props> {
|
||||||
combo="v"
|
combo="v"
|
||||||
global
|
global
|
||||||
label="View Mode"
|
label="View Mode"
|
||||||
onKeyDown={this.props.resetCommentMode}
|
onKeyDown={() => setCommentModeInUrl(false)}
|
||||||
/>
|
/>
|
||||||
<Hotkey
|
<Hotkey
|
||||||
combo="c"
|
combo="c"
|
||||||
|
|
@ -47,10 +44,4 @@ class GlobalHotKeys extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: any) => {
|
export default GlobalHotKeys;
|
||||||
return {
|
|
||||||
resetCommentMode: () => dispatch(setCommentModeAction(false)),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(GlobalHotKeys);
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
|
||||||
import { getSelectedText } from "utils/helpers";
|
import { getSelectedText } from "utils/helpers";
|
||||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||||
import { WIDGETS_SEARCH_ID } from "constants/Explorer";
|
import { WIDGETS_SEARCH_ID } from "constants/Explorer";
|
||||||
import { setCommentMode as setCommentModeAction } from "actions/commentActions";
|
|
||||||
import { resetSnipingMode as resetSnipingModeAction } from "actions/propertyPaneActions";
|
import { resetSnipingMode as resetSnipingModeAction } from "actions/propertyPaneActions";
|
||||||
import { showDebugger } from "actions/debuggerActions";
|
import { showDebugger } from "actions/debuggerActions";
|
||||||
|
|
||||||
|
|
@ -35,7 +34,6 @@ type Props = {
|
||||||
deleteSelectedWidget: () => void;
|
deleteSelectedWidget: () => void;
|
||||||
cutSelectedWidget: () => void;
|
cutSelectedWidget: () => void;
|
||||||
toggleShowGlobalSearchModal: () => void;
|
toggleShowGlobalSearchModal: () => void;
|
||||||
resetCommentMode: () => void;
|
|
||||||
resetSnipingMode: () => void;
|
resetSnipingMode: () => void;
|
||||||
openDebugger: () => void;
|
openDebugger: () => void;
|
||||||
closeProppane: () => void;
|
closeProppane: () => void;
|
||||||
|
|
@ -190,7 +188,7 @@ class GlobalHotKeys extends React.Component<Props> {
|
||||||
group="Canvas"
|
group="Canvas"
|
||||||
label="Deselect all Widget"
|
label="Deselect all Widget"
|
||||||
onKeyDown={(e: any) => {
|
onKeyDown={(e: any) => {
|
||||||
this.props.resetCommentMode();
|
setCommentModeInUrl(false);
|
||||||
this.props.resetSnipingMode();
|
this.props.resetSnipingMode();
|
||||||
this.props.deselectAllWidgets();
|
this.props.deselectAllWidgets();
|
||||||
this.props.closeProppane();
|
this.props.closeProppane();
|
||||||
|
|
@ -203,7 +201,7 @@ class GlobalHotKeys extends React.Component<Props> {
|
||||||
global
|
global
|
||||||
label="Edit Mode"
|
label="Edit Mode"
|
||||||
onKeyDown={(e: any) => {
|
onKeyDown={(e: any) => {
|
||||||
this.props.resetCommentMode();
|
setCommentModeInUrl(false);
|
||||||
this.props.resetSnipingMode();
|
this.props.resetSnipingMode();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
|
@ -245,7 +243,6 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||||
deleteSelectedWidget: () => dispatch(deleteSelectedWidget(true)),
|
deleteSelectedWidget: () => dispatch(deleteSelectedWidget(true)),
|
||||||
cutSelectedWidget: () => dispatch(cutWidget()),
|
cutSelectedWidget: () => dispatch(cutWidget()),
|
||||||
toggleShowGlobalSearchModal: () => dispatch(toggleShowGlobalSearchModal()),
|
toggleShowGlobalSearchModal: () => dispatch(toggleShowGlobalSearchModal()),
|
||||||
resetCommentMode: () => dispatch(setCommentModeAction(false)),
|
|
||||||
resetSnipingMode: () => dispatch(resetSnipingModeAction()),
|
resetSnipingMode: () => dispatch(resetSnipingModeAction()),
|
||||||
openDebugger: () => dispatch(showDebugger()),
|
openDebugger: () => dispatch(showDebugger()),
|
||||||
closeProppane: () => dispatch(closePropertyPane()),
|
closeProppane: () => dispatch(closePropertyPane()),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user