diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/layout-dropdown-button.tsx b/services/web/frontend/js/features/editor-navigation-toolbar/components/layout-dropdown-button.tsx
index e9e45763bb..b580fa5cf8 100644
--- a/services/web/frontend/js/features/editor-navigation-toolbar/components/layout-dropdown-button.tsx
+++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/layout-dropdown-button.tsx
@@ -26,6 +26,7 @@ import useEventListener from '../../../shared/hooks/use-event-listener'
import { DetachRole } from '@/shared/context/detach-context'
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
import MaterialIcon from '@/shared/components/material-icon'
+import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
function IconPlaceholder() {
return
@@ -139,7 +140,7 @@ const LayoutDropdownToggleButton = forwardRef<
})
LayoutDropdownToggleButton.displayName = 'LayoutDropdownToggleButton'
-function DetachDisabled() {
+function BS3DetachDisabled() {
const { t } = useTranslation()
return (
@@ -158,9 +159,25 @@ function DetachDisabled() {
)
}
-function LayoutDropdownButton() {
+function BS5DetachDisabled() {
const { t } = useTranslation()
+ return (
+
+
+
+ {t('pdf_in_separate_tab')}
+
+
+
+ )
+}
+
+function LayoutDropdownButton() {
const {
reattach,
detach,
@@ -199,9 +216,42 @@ function LayoutDropdownButton() {
[changeLayout, handleReattach]
)
- const processing = !detachIsLinked && detachRole === 'detacher'
+ return (
+
+ )
+}
- // bsStyle is required for Dropdown.Toggle, but we will override style
+type LayoutDropdownButtonUiProps = {
+ processing: boolean
+ handleChangeLayout: (newLayout: IdeLayout, newView?: IdeView) => void
+ handleDetach: () => void
+ detachIsLinked: boolean
+ detachRole: DetachRole
+ pdfLayout: IdeLayout
+ view: IdeView | null
+ detachable: boolean
+}
+
+export const LayoutDropdownButtonUi = ({
+ processing,
+ handleChangeLayout,
+ handleDetach,
+ detachIsLinked,
+ detachRole,
+ view,
+ pdfLayout,
+ detachable,
+}: LayoutDropdownButtonUiProps) => {
+ const { t } = useTranslation()
return (
<>
{processing && (
@@ -219,6 +269,7 @@ function LayoutDropdownButton() {
className="toolbar-item layout-dropdown"
pullRight
>
+ {/* bsStyle is required for Dropdown.Toggle, but we will override style */}
{processing ? : }
{t('layout')}
@@ -280,7 +331,7 @@ function LayoutDropdownButton() {
}
/>
- {'BroadcastChannel' in window ? (
+ {detachable ? (
handleDetach()}
checkmark={
@@ -298,7 +349,7 @@ function LayoutDropdownButton() {
text={t('pdf_in_separate_tab')}
/>
) : (
-
+
)}
@@ -322,7 +373,7 @@ function LayoutDropdownButton() {
)}
{t('layout')}
-
+
handleChangeLayout('sideBySide')}
active={isActiveDropdownItem({
@@ -346,15 +397,14 @@ function LayoutDropdownButton() {
})}
leadingIcon="code"
>
- ,
- ]}
- />
+
+ ,
+ ]}
+ />
+
- ,
- ]}
- />
+
+ ,
+ ]}
+ />
+
- {'BroadcastChannel' in window ? (
+ {detachable ? (
handleDetach()}
active={detachRole === 'detacher' && detachIsLinked}
@@ -406,7 +455,7 @@ function LayoutDropdownButton() {
{t('pdf_in_separate_tab')}
) : (
-
+
)}
diff --git a/services/web/frontend/stories/editor/layout-dropdown-button.stories.tsx b/services/web/frontend/stories/editor/layout-dropdown-button.stories.tsx
new file mode 100644
index 0000000000..cb81b0f5c6
--- /dev/null
+++ b/services/web/frontend/stories/editor/layout-dropdown-button.stories.tsx
@@ -0,0 +1,37 @@
+import { LayoutDropdownButtonUi } from '@/features/editor-navigation-toolbar/components/layout-dropdown-button'
+import { Meta } from '@storybook/react'
+import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
+import { ComponentProps } from 'react'
+
+export const LayoutDropdown = (
+ props: ComponentProps
+) => (
+
+)
+
+const meta: Meta = {
+ title: 'Editor / Toolbar / Layout Dropdown',
+ component: LayoutDropdownButtonUi,
+ argTypes: {
+ view: {
+ control: 'select',
+ options: [null, 'editor', 'file', 'pdf', 'history'],
+ },
+ detachRole: {
+ control: 'select',
+ options: ['detacher', 'detached'],
+ },
+ pdfLayout: {
+ control: 'select',
+ options: ['sideBySide', 'flat'],
+ },
+ ...bsVersionDecorator.argTypes,
+ },
+ parameters: { actions: { argTypesRegex: '^handle.*' } },
+}
+
+export default meta
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
index 0e13fea449..e38a908c79 100644
--- a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
@@ -225,6 +225,10 @@
}
}
+.layout-dropdown .dropdown-item {
+ align-items: center;
+}
+
.header-cobranding-logo {
display: block;
width: auto;