diff --git a/services/web/app/src/Features/BrandVariations/BrandVariationsHandler.js b/services/web/app/src/Features/BrandVariations/BrandVariationsHandler.js
index 942fa3a6ab..33fa764048 100644
--- a/services/web/app/src/Features/BrandVariations/BrandVariationsHandler.js
+++ b/services/web/app/src/Features/BrandVariations/BrandVariationsHandler.js
@@ -74,6 +74,10 @@ function sanitizeBrandVariationDetails(details) {
details.submit_button_html,
settings.modules.sanitize.options
)
+ details.submit_button_html_no_br = sanitizeHtml(
+ details.submit_button_html.replace(/
/gi, ' '),
+ settings.modules.sanitize.options
+ )
}
}
diff --git a/services/web/frontend/js/features/ide-redesign/components/toolbar/project-title.tsx b/services/web/frontend/js/features/ide-redesign/components/toolbar/project-title.tsx
index 43e5c678d7..bf3320d8b9 100644
--- a/services/web/frontend/js/features/ide-redesign/components/toolbar/project-title.tsx
+++ b/services/web/frontend/js/features/ide-redesign/components/toolbar/project-title.tsx
@@ -16,9 +16,10 @@ import EditableLabel from './editable-label'
import { DuplicateProject } from './duplicate-project'
const [publishModalModules] = importOverleafModules('publishModal')
-const SubmitProjectButton = publishModalModules?.import.NewPublishToolbarButton
+const SubmitProjectButton = publishModalModules?.import.NewPublishDropdownButton
export const ToolbarProjectTitle = () => {
+ const { cobranding } = useEditorContext()
const { t } = useTranslation()
const { permissionsLevel, renameProject } = useEditorContext()
const { name } = useProjectContext()
@@ -67,7 +68,7 @@ export const ToolbarProjectTitle = () => {
/>
- {shouldDisplaySubmitButton && (
+ {shouldDisplaySubmitButton && !cobranding && (
<>
diff --git a/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx b/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
index c8418e00e4..2af70eb9ce 100644
--- a/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
+++ b/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
@@ -11,12 +11,19 @@ import { useCallback } from 'react'
import * as eventTracking from '../../../../infrastructure/event-tracking'
import { ToolbarLogos } from './logos'
import { useEditorContext } from '@/shared/context/editor-context'
+import importOverleafModules from '../../../../../macros/import-overleaf-module.macro'
import UpgradeButton from './upgrade-button'
import getMeta from '@/utils/meta'
+const [publishModalModules] = importOverleafModules('publishModal')
+const SubmitProjectButton = publishModalModules?.import.NewPublishToolbarButton
+
export const Toolbar = () => {
const { view, setView } = useLayoutContext()
- const { cobranding } = useEditorContext()
+ const { cobranding, permissionsLevel } = useEditorContext()
+ const shouldDisplaySubmitButton =
+ (permissionsLevel === 'owner' || permissionsLevel === 'readAndWrite') &&
+ SubmitProjectButton
const handleBackToEditorClick = useCallback(() => {
eventTracking.sendMB('navigation-clicked-history', { action: 'close' })
@@ -47,6 +54,9 @@ export const Toolbar = () => {
+ {shouldDisplaySubmitButton && cobranding && (
+
+ )}
{getMeta('ol-showUpgradePrompt') && }
diff --git a/services/web/frontend/js/shared/context/editor-context.tsx b/services/web/frontend/js/shared/context/editor-context.tsx
index 2ebab1be7b..12763aab58 100644
--- a/services/web/frontend/js/shared/context/editor-context.tsx
+++ b/services/web/frontend/js/shared/context/editor-context.tsx
@@ -72,6 +72,7 @@ export const EditorProvider: FC = ({ children }) => {
partner: brandVariation.partner,
brandedMenu: brandVariation.branded_menu,
submitBtnHtml: brandVariation.submit_button_html,
+ submitBtnHtmlNoBreaks: brandVariation.submit_button_html_no_br,
}
)
}, [])
diff --git a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js
index 47d96406f9..75adfd7e9b 100644
--- a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js
+++ b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js
@@ -118,5 +118,21 @@ describe('BrandVariationsHandler', function () {
'
AGU Journalhello'
)
})
+
+ it("should sanitize and remove breaks in 'submit_button_html_no_br'", async function () {
+ this.mockedBrandVariationDetails.submit_button_html =
+ 'Submit to
AGU Journal'
+ this.V1Api.request.callsArgWith(
+ 1,
+ null,
+ { statusCode: 200 },
+ this.mockedBrandVariationDetails
+ )
+ const brandVariationDetails =
+ await this.BrandVariationsHandler.promises.getBrandVariationById('12')
+ expect(brandVariationDetails.submit_button_html_no_br).to.equal(
+ 'Submit to AGU Journalhello'
+ )
+ })
})
})
diff --git a/services/web/types/cobranding.ts b/services/web/types/cobranding.ts
index dc6822be84..dc6ae75964 100644
--- a/services/web/types/cobranding.ts
+++ b/services/web/types/cobranding.ts
@@ -8,4 +8,5 @@ export type Cobranding = {
partner?: string
brandedMenu?: boolean
submitBtnHtml?: string
+ submitBtnHtmlNoBreaks?: string
}