mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3826 from overleaf/jpa-meta-editor
[views] migrate the editor templates to meta tags GitOrigin-RevId: 01745172840c8ceb5fb9947ca6c14e919e9c4ac7
This commit is contained in:
parent
d65db1acf0
commit
eeb2b7d18b
5 changed files with 31 additions and 40 deletions
|
@ -162,39 +162,38 @@ block content
|
||||||
h3 {{ title }}
|
h3 {{ title }}
|
||||||
.modal-body(ng-bind-html="message")
|
.modal-body(ng-bind-html="message")
|
||||||
|
|
||||||
script#data(type="application/json").
|
block append meta
|
||||||
!{StringHelper.stringifyJsonForScript({ userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History, enabledLinkedFileTypes: settings.enabledLinkedFileTypes, brandVariation: brandVariation })}
|
meta(name="ol-useV2History" data-type="boolean" content=useV2History)
|
||||||
|
meta(name="ol-project_id" content=project_id)
|
||||||
script(type="text/javascript", nonce=scriptNonce).
|
meta(name="ol-userSettings" data-type="json" content=userSettings)
|
||||||
window.data = JSON.parse(document.querySelector("#data").text);
|
meta(name="ol-user" data-type="json" content=user)
|
||||||
window.project_id = "!{project_id}";
|
meta(name="ol-anonymous" data-type="boolean" content=anonymous)
|
||||||
window.userSettings = window.data.userSettings;
|
meta(name="ol-brandVariation" data-type="json" content=brandVariation)
|
||||||
window.user = window.data.user;
|
meta(name="ol-anonymousAccessToken" content=anonymousAccessToken)
|
||||||
window.enabledLinkedFiles = window.data.enabledLinkedFiles;
|
meta(name="ol-isTokenMember" data-type="boolean" content=isTokenMember)
|
||||||
window.csrfToken = "!{csrfToken}";
|
meta(name="ol-isRestrictedTokenMember" data-type="boolean" content=isRestrictedTokenMember)
|
||||||
window.anonymous = #{anonymous};
|
meta(name="ol-maxDocLength" data-type="json" content=maxDocLength)
|
||||||
window.brandVariation = window.data.brandVariation;
|
meta(name="ol-trackChangesState" data-type="json" content=trackChangesState)
|
||||||
window.anonymousAccessToken = "#{anonymousAccessToken}";
|
meta(name="ol-wikiEnabled" data-type="boolean" content=!!(settings.apis.wiki && settings.apis.wiki.url))
|
||||||
window.isTokenMember = #{!!isTokenMember};
|
meta(name="ol-gitBridgePublicBaseUrl" content=gitBridgePublicBaseUrl)
|
||||||
window.isRestrictedTokenMember = #{!!isRestrictedTokenMember};
|
|
||||||
window.maxDocLength = #{maxDocLength};
|
|
||||||
window.trackChangesState = window.data.trackChangesState;
|
|
||||||
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
|
|
||||||
window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}'
|
|
||||||
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn
|
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn
|
||||||
window.aceBasePath = "/js/#{lib('ace')}"
|
meta(name="ol-aceBasePath" content="/js/" + lib('ace'))
|
||||||
//- Set path for PDFjs CMaps
|
//- Set path for PDFjs CMaps
|
||||||
window.pdfCMapsPath = "/js/cmaps/"
|
meta(name="ol-pdfCMapsPath" content="/js/cmaps/")
|
||||||
//- enable doc hash checking for all projects
|
//- enable doc hash checking for all projects
|
||||||
//- used in public/js/libs/sharejs.js
|
//- used in public/js/libs/sharejs.js
|
||||||
window.useShareJsHash = true
|
meta(name="ol-useShareJsHash" data-type="boolean" content=true)
|
||||||
window.wsRetryHandshake = #{settings.wsRetryHandshake}
|
meta(name="ol-wsRetryHandshake" data-type="json" content=settings.wsRetryHandshake)
|
||||||
window.showReactFileTree = "!{showReactFileTree}" === 'true'
|
meta(name="ol-showReactFileTree" data-type="boolean" content=showReactFileTree)
|
||||||
window.showReactAddFilesModal = "!{showReactAddFilesModal}" === 'true'
|
meta(name="ol-showReactAddFilesModal" data-type="boolean" content=showReactAddFilesModal)
|
||||||
|
meta(name="ol-showNewLogsUI" data-type="boolean" content=showNewLogsUI)
|
||||||
|
meta(name="ol-logsUISubvariant" content=logsUISubvariant)
|
||||||
|
|
||||||
|
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
|
||||||
|
meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)
|
||||||
|
|
||||||
if (settings.overleaf != null)
|
if (settings.overleaf != null)
|
||||||
script(type="text/javascript", nonce=scriptNonce).
|
meta(name="ol-overallThemes" data-type="json" content=overallThemes)
|
||||||
window.overallThemes = JSON.parse('!{StringHelper.stringifyJsonForScript(overallThemes)}');
|
|
||||||
|
|
||||||
block foot-scripts
|
block foot-scripts
|
||||||
script(type="text/javascript", nonce=scriptNonce, src=(wsUrl || '/socket.io') + '/socket.io.js')
|
script(type="text/javascript", nonce=scriptNonce, src=(wsUrl || '/socket.io') + '/socket.io.js')
|
||||||
|
|
|
@ -55,7 +55,3 @@ script(type="text/ng-template", id="historyFileEntityTpl")
|
||||||
ng-repeat="childEntity in $ctrl.fileEntity.children"
|
ng-repeat="childEntity in $ctrl.fileEntity.children"
|
||||||
file-entity="childEntity"
|
file-entity="childEntity"
|
||||||
)
|
)
|
||||||
|
|
||||||
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
|
|
||||||
script(type="text/javascript", nonce=scriptNonce).
|
|
||||||
window.fileActionI18n = JSON.parse('!{StringHelper.stringifyJsonForScript(fileActionI18n)}')
|
|
||||||
|
|
|
@ -413,7 +413,3 @@ script(type='text/ng-template', id='clearCacheModalTemplate')
|
||||||
)
|
)
|
||||||
span(ng-show="!state.inflight") #{translate("clear_cache")}
|
span(ng-show="!state.inflight") #{translate("clear_cache")}
|
||||||
span(ng-show="state.inflight") #{translate("clearing")}…
|
span(ng-show="state.inflight") #{translate("clearing")}…
|
||||||
|
|
||||||
script(type="text/javascript", nonce=scriptNonce).
|
|
||||||
window.showNewLogsUI = #{showNewLogsUI || false}
|
|
||||||
window.logsUISubvariant = !{logsUISubvariant ? '"' + logsUISubvariant + '"' : 'null'}
|
|
||||||
|
|
|
@ -711,7 +711,7 @@ App.controller('PdfController', function(
|
||||||
warnings: $scope.pdf.logEntries.warnings.length,
|
warnings: $scope.pdf.logEntries.warnings.length,
|
||||||
typesetting: $scope.pdf.logEntries.typesetting.length,
|
typesetting: $scope.pdf.logEntries.typesetting.length,
|
||||||
newLogsUI: window.showNewLogsUI,
|
newLogsUI: window.showNewLogsUI,
|
||||||
subvariant: window.logsUISubvariant
|
subvariant: window.logsUISubvariant || null
|
||||||
}
|
}
|
||||||
eventTracking.sendMBSampled(
|
eventTracking.sendMBSampled(
|
||||||
'compile-result',
|
'compile-result',
|
||||||
|
|
|
@ -6,7 +6,7 @@ async function run({ assertHasStatusCode, request }) {
|
||||||
assertHasStatusCode(response, 200)
|
assertHasStatusCode(response, 200)
|
||||||
|
|
||||||
const PROJECT_ID_REGEX = new RegExp(
|
const PROJECT_ID_REGEX = new RegExp(
|
||||||
`window.project_id = "${Settings.smokeTest.projectId}"`
|
`<meta name="ol-project_id" content="${Settings.smokeTest.projectId}">`
|
||||||
)
|
)
|
||||||
if (!PROJECT_ID_REGEX.test(response.body)) {
|
if (!PROJECT_ID_REGEX.test(response.body)) {
|
||||||
throw new Error('project page html does not have project_id')
|
throw new Error('project page html does not have project_id')
|
||||||
|
|
Loading…
Reference in a new issue