Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v5] [core] fix: add back HotkeysDialogLegacy functions to public API #6140

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export * from "./hooks";
/* eslint-disable deprecation/deprecation */
export {
HotkeysTargetLegacy as HotkeysTarget,
HotkeysTargetLegacyComponent as IHotkeysTargetComponent,
type HotkeysTargetLegacyComponent as IHotkeysTargetComponent,
} from "./legacy/hotkeysTargetLegacy";
export {
isHotkeysDialogShowing,
setHotkeysDialogProps,
showHotkeysDialog,
hideHotkeysDialog,
hideHotkeysDialogAfterDelay,
} from "./legacy/hotkeysDialogLegacy";
export { ContextMenuTargetLegacy, ContextMenuTargetLegacyComponent } from "./legacy/contextMenuTargetLegacy";
6 changes: 6 additions & 0 deletions packages/core/src/legacy/hotkeysDialogLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ class HotkeysDialogLegacy {
// singleton instance
const HOTKEYS_DIALOG = new HotkeysDialogLegacy();

/** @deprecated use HotkeysProvider */
export function isHotkeysDialogShowing() {
return HOTKEYS_DIALOG.isShowing();
}

/** @deprecated use HotkeysProvider */
export function setHotkeysDialogProps(props: Partial<HotkeysDialogProps>) {
for (const key in props) {
if (props.hasOwnProperty(key)) {
Expand All @@ -165,10 +167,12 @@ export function setHotkeysDialogProps(props: Partial<HotkeysDialogProps>) {
}
}

/** @deprecated use HotkeysProvider */
export function showHotkeysDialog(hotkeys: HotkeyProps[]) {
HOTKEYS_DIALOG.enqueueHotkeysForDisplay(hotkeys);
}

/** @deprecated use HotkeysProvider */
export function hideHotkeysDialog() {
HOTKEYS_DIALOG.hide();
}
Expand All @@ -177,6 +181,8 @@ export function hideHotkeysDialog() {
* Use this function instead of `hideHotkeysDialog` if you need to ensure that all hotkey listeners
* have time to execute with the dialog in a consistent open state. This can avoid flickering the
* dialog between open and closed states as successive listeners fire.
*
* @deprecated use HotkeysProvider
*/
export function hideHotkeysDialogAfterDelay() {
HOTKEYS_DIALOG.hideAfterDelay();
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/legacy/hotkeysEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
* limitations under the License.
*/

/**
* @fileoverview This component is DEPRECATED, and the code is frozen.
* All changes & bugfixes should be made to HotkeysDialog2 instead.
*/

/* eslint-disable deprecation/deprecation */

import { Children, ReactNode } from "react";

import { isElementOfType } from "../common/utils";
Expand Down