mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Update workbench events (#30254)
GitOrigin-RevId: 7434483ce125676f1d7d76dfcb09d6691f9dadef
This commit is contained in:
+12
-2
@@ -1,18 +1,28 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useRailContext } from '../../contexts/rail-context'
|
import { useRailContext } from '../../contexts/rail-context'
|
||||||
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
||||||
import React from 'react'
|
import React, { useCallback } from 'react'
|
||||||
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
||||||
|
|
||||||
export default function RailPanelHeader({
|
export default function RailPanelHeader({
|
||||||
title,
|
title,
|
||||||
actions,
|
actions,
|
||||||
|
onClose,
|
||||||
}: {
|
}: {
|
||||||
title: React.ReactNode
|
title: React.ReactNode
|
||||||
actions?: React.ReactNode[]
|
actions?: React.ReactNode[]
|
||||||
|
onClose?: () => void
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { handlePaneCollapse } = useRailContext()
|
const { handlePaneCollapse } = useRailContext()
|
||||||
|
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
handlePaneCollapse()
|
||||||
|
if (onClose) {
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
|
}, [handlePaneCollapse, onClose])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rail-panel-header">
|
<div className="rail-panel-header">
|
||||||
<h4 className="rail-panel-title">{title}</h4>
|
<h4 className="rail-panel-title">{title}</h4>
|
||||||
@@ -25,7 +35,7 @@ export default function RailPanelHeader({
|
|||||||
overlayProps={{ placement: 'bottom' }}
|
overlayProps={{ placement: 'bottom' }}
|
||||||
>
|
>
|
||||||
<OLIconButton
|
<OLIconButton
|
||||||
onClick={handlePaneCollapse}
|
onClick={handleClose}
|
||||||
className="rail-panel-header-button-subdued"
|
className="rail-panel-header-button-subdued"
|
||||||
icon="close"
|
icon="close"
|
||||||
accessibilityLabel={t('close')}
|
accessibilityLabel={t('close')}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ export const CopyToClipboard = memo<{
|
|||||||
tooltipId: string
|
tooltipId: string
|
||||||
kind?: 'text' | 'icon'
|
kind?: 'text' | 'icon'
|
||||||
unfilled?: boolean
|
unfilled?: boolean
|
||||||
}>(({ content, tooltipId, kind = 'icon', unfilled = false }) => {
|
onClick?: () => void
|
||||||
|
}>(({ content, tooltipId, kind = 'icon', unfilled = false, onClick }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const [copied, setCopied] = useState(false)
|
const [copied, setCopied] = useState(false)
|
||||||
@@ -21,7 +22,10 @@ export const CopyToClipboard = memo<{
|
|||||||
setCopied(false)
|
setCopied(false)
|
||||||
}, 1500)
|
}, 1500)
|
||||||
})
|
})
|
||||||
}, [content])
|
if (onClick) {
|
||||||
|
onClick()
|
||||||
|
}
|
||||||
|
}, [content, onClick])
|
||||||
|
|
||||||
if (!navigator.clipboard?.writeText) {
|
if (!navigator.clipboard?.writeText) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user