mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #32968 from overleaf/worktree-labs-feature-preview
Add labs preview modal to editor GitOrigin-RevId: 0df33135febc8e94129bcdfdfb5c4981326dfab0
This commit is contained in:
@@ -25,7 +25,15 @@ export type RailTabKey =
|
||||
| 'full-project-search'
|
||||
| 'workbench'
|
||||
|
||||
export type RailModalKey = 'keyboard-shortcuts' | 'contact-us' | 'dictionary'
|
||||
export type RailModalKey =
|
||||
| 'keyboard-shortcuts'
|
||||
| 'contact-us'
|
||||
| 'dictionary'
|
||||
| 'labs'
|
||||
|
||||
export function dispatchOpenRailModal(key: RailModalKey) {
|
||||
window.dispatchEvent(new CustomEvent('ui:open-rail-modal', { detail: key }))
|
||||
}
|
||||
|
||||
const RailContext = createContext<
|
||||
| {
|
||||
@@ -119,6 +127,16 @@ export const RailProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
}, [handlePaneCollapse, selectedTab, isOpen, openTab])
|
||||
)
|
||||
|
||||
useEventListener(
|
||||
'ui:open-rail-modal',
|
||||
useCallback(
|
||||
(event: Event) => {
|
||||
setActiveModal((event as CustomEvent<RailModalKey>).detail)
|
||||
},
|
||||
[setActiveModal]
|
||||
)
|
||||
)
|
||||
|
||||
useEventListener(
|
||||
'keydown',
|
||||
useCallback(
|
||||
|
||||
Reference in New Issue
Block a user