mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #18276 from overleaf/td-bs5-load-js
Load correct JS for the active Bootstrap version, second attempt GitOrigin-RevId: ad8748a941691d745db5cd3e986e9c7b188b3ecb
This commit is contained in:
parent
9c1cb419de
commit
0886104862
12 changed files with 25 additions and 13 deletions
3
services/web/app/views/_mixins/bootstrap_js.pug
Normal file
3
services/web/app/views/_mixins/bootstrap_js.pug
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mixin bootstrap-js(bootstrapVersion)
|
||||||
|
each file in (entrypointScripts(bootstrapVersion === 5 ? 'bootstrap-5' : 'bootstrap-3'))
|
||||||
|
script(type="text/javascript", nonce=scriptNonce, src=file)
|
|
@ -4,7 +4,7 @@ html(
|
||||||
class=(fixedSizeDocument ? 'fixed-size-document' : undefined)
|
class=(fixedSizeDocument ? 'fixed-size-document' : undefined)
|
||||||
)
|
)
|
||||||
- metadata = metadata || {}
|
- metadata = metadata || {}
|
||||||
- bootstrap5EnabledPage = false
|
- let bootstrap5EnabledPage = false
|
||||||
|
|
||||||
block entrypointVar
|
block entrypointVar
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ html(
|
||||||
head
|
head
|
||||||
include ./_metadata.pug
|
include ./_metadata.pug
|
||||||
|
|
||||||
- var bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3
|
- const bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3
|
||||||
|
|
||||||
//- Stylesheet
|
//- Stylesheet
|
||||||
link(rel='stylesheet', href=buildCssPath(getCssThemeModifier(userSettings, brandVariation), bootstrapVersion), id="main-stylesheet")
|
link(rel='stylesheet', href=buildCssPath(getCssThemeModifier(userSettings, brandVariation), bootstrapVersion), id="main-stylesheet")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
extends ./layout-base
|
extends ./layout-base
|
||||||
|
|
||||||
include ./_mixins/formMessages
|
include ./_mixins/formMessages
|
||||||
|
include ./_mixins/bootstrap_js
|
||||||
|
|
||||||
block entrypointVar
|
block entrypointVar
|
||||||
- entrypoint = 'marketing'
|
- entrypoint = 'marketing'
|
||||||
|
@ -21,3 +22,6 @@ block body
|
||||||
include _cookie_banner
|
include _cookie_banner
|
||||||
|
|
||||||
!= moduleIncludes("contactModal-marketing", locals)
|
!= moduleIncludes("contactModal-marketing", locals)
|
||||||
|
|
||||||
|
block prepend foot-scripts
|
||||||
|
+bootstrap-js(bootstrapVersion)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
extends ./layout-base
|
extends ./layout-base
|
||||||
|
|
||||||
include ./_mixins/formMessages
|
include ./_mixins/formMessages
|
||||||
|
include ./_mixins/bootstrap_js
|
||||||
|
|
||||||
block entrypointVar
|
block entrypointVar
|
||||||
- entrypoint = 'marketing'
|
- entrypoint = 'marketing'
|
||||||
|
@ -21,3 +22,6 @@ block body
|
||||||
include _cookie_banner
|
include _cookie_banner
|
||||||
|
|
||||||
!= moduleIncludes("contactModal-marketing", locals)
|
!= moduleIncludes("contactModal-marketing", locals)
|
||||||
|
|
||||||
|
block prepend foot-scripts
|
||||||
|
+bootstrap-js(bootstrapVersion)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
extends ../layout
|
extends ../layout
|
||||||
|
|
||||||
include ./plans/_mixins
|
include ./plans/_mixins
|
||||||
|
include ../_mixins/bootstrap_js
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- entrypoint = 'pages/user/subscription/plans-v2/plans-v2-main'
|
- entrypoint = 'pages/user/subscription/plans-v2/plans-v2-main'
|
||||||
|
@ -65,3 +66,6 @@ block content
|
||||||
| #{translate("continue_with_free_plan")}
|
| #{translate("continue_with_free_plan")}
|
||||||
|
|
||||||
!= moduleIncludes("contactModalGeneral-marketing", locals)
|
!= moduleIncludes("contactModalGeneral-marketing", locals)
|
||||||
|
|
||||||
|
block prepend foot-scripts
|
||||||
|
+bootstrap-js(bootstrapVersion)
|
||||||
|
|
5
services/web/frontend/js/bootstrap-3.ts
Normal file
5
services/web/frontend/js/bootstrap-3.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import 'jquery'
|
||||||
|
import 'bootstrap'
|
||||||
|
|
||||||
|
$('[data-ol-lang-selector-tooltip]').tooltip({ trigger: 'hover' })
|
||||||
|
$('[data-toggle="tooltip"]').tooltip()
|
1
services/web/frontend/js/bootstrap-5.ts
Normal file
1
services/web/frontend/js/bootstrap-5.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import 'bootstrap-5'
|
|
@ -1,7 +1,5 @@
|
||||||
import './utils/webpack-public-path'
|
import './utils/webpack-public-path'
|
||||||
import './infrastructure/error-reporter'
|
import './infrastructure/error-reporter'
|
||||||
import 'jquery'
|
|
||||||
import 'bootstrap'
|
|
||||||
import './features/form-helpers/hydrate-form'
|
import './features/form-helpers/hydrate-form'
|
||||||
import './features/form-helpers/password-visibility'
|
import './features/form-helpers/password-visibility'
|
||||||
import './features/link-helpers/slow-link'
|
import './features/link-helpers/slow-link'
|
||||||
|
@ -13,6 +11,3 @@ import './features/multi-submit'
|
||||||
import './features/cookie-banner'
|
import './features/cookie-banner'
|
||||||
import './features/autoplay-video'
|
import './features/autoplay-video'
|
||||||
import './features/mathjax'
|
import './features/mathjax'
|
||||||
|
|
||||||
$('[data-ol-lang-selector-tooltip]').tooltip({ trigger: 'hover' })
|
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'jquery'
|
|
||||||
import 'bootstrap'
|
|
||||||
import './../utils/meta'
|
import './../utils/meta'
|
||||||
import './../utils/webpack-public-path'
|
import './../utils/webpack-public-path'
|
||||||
import './../infrastructure/error-reporter'
|
import './../infrastructure/error-reporter'
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'jquery'
|
|
||||||
import 'bootstrap'
|
|
||||||
import './../utils/meta'
|
import './../utils/meta'
|
||||||
import './../utils/webpack-public-path'
|
import './../utils/webpack-public-path'
|
||||||
import './../infrastructure/error-reporter'
|
import './../infrastructure/error-reporter'
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'jquery'
|
|
||||||
import 'bootstrap'
|
|
||||||
import './../../../utils/meta'
|
import './../../../utils/meta'
|
||||||
import './../../../utils/webpack-public-path'
|
import './../../../utils/webpack-public-path'
|
||||||
import './../../../infrastructure/error-reporter'
|
import './../../../infrastructure/error-reporter'
|
||||||
|
|
|
@ -17,6 +17,8 @@ invalidateBabelCacheIfNeeded()
|
||||||
// Generate a hash of entry points, including modules
|
// Generate a hash of entry points, including modules
|
||||||
const entryPoints = {
|
const entryPoints = {
|
||||||
tracing: './frontend/js/tracing.js',
|
tracing: './frontend/js/tracing.js',
|
||||||
|
'bootstrap-3': './frontend/js/bootstrap-3.ts',
|
||||||
|
'bootstrap-5': './frontend/js/bootstrap-5.ts',
|
||||||
devToolbar: './frontend/js/dev-toolbar.js',
|
devToolbar: './frontend/js/dev-toolbar.js',
|
||||||
main: './frontend/js/main.js',
|
main: './frontend/js/main.js',
|
||||||
ide: './frontend/js/ide.js',
|
ide: './frontend/js/ide.js',
|
||||||
|
|
Loading…
Reference in a new issue