Merge pull request #3880 from overleaf/revert-3826-jpa-meta-editor

Revert "[views] migrate the editor templates to meta tags"

GitOrigin-RevId: 02caaf24ae0ee6a74a38ef870909527da19d4882
This commit is contained in:
Thomas 2021-04-01 19:11:56 +02:00 committed by Copybot
parent 23be656aec
commit eb46f9a738
5 changed files with 40 additions and 31 deletions

View file

@ -162,38 +162,39 @@ block content
h3 {{ title }}
.modal-body(ng-bind-html="message")
block append meta
meta(name="ol-useV2History" data-type="boolean" content=useV2History)
meta(name="ol-project_id" content=project_id)
meta(name="ol-userSettings" data-type="json" content=userSettings)
meta(name="ol-user" data-type="json" content=user)
meta(name="ol-anonymous" data-type="boolean" content=anonymous)
meta(name="ol-brandVariation" data-type="json" content=brandVariation)
meta(name="ol-anonymousAccessToken" content=anonymousAccessToken)
meta(name="ol-isTokenMember" data-type="boolean" content=isTokenMember)
meta(name="ol-isRestrictedTokenMember" data-type="boolean" content=isRestrictedTokenMember)
meta(name="ol-maxDocLength" data-type="json" content=maxDocLength)
meta(name="ol-trackChangesState" data-type="json" content=trackChangesState)
meta(name="ol-wikiEnabled" data-type="boolean" content=!!(settings.apis.wiki && settings.apis.wiki.url))
meta(name="ol-gitBridgePublicBaseUrl" content=gitBridgePublicBaseUrl)
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn
meta(name="ol-aceBasePath" content="/js/" + lib('ace'))
//- Set path for PDFjs CMaps
meta(name="ol-pdfCMapsPath" content="/js/cmaps/")
//- enable doc hash checking for all projects
//- used in public/js/libs/sharejs.js
meta(name="ol-useShareJsHash" data-type="boolean" content=true)
meta(name="ol-wsRetryHandshake" data-type="json" content=settings.wsRetryHandshake)
meta(name="ol-showReactFileTree" data-type="boolean" content=showReactFileTree)
meta(name="ol-showReactAddFilesModal" data-type="boolean" content=showReactAddFilesModal)
meta(name="ol-showNewLogsUI" data-type="boolean" content=showNewLogsUI)
meta(name="ol-logsUISubvariant" content=logsUISubvariant)
script#data(type="application/json").
!{StringHelper.stringifyJsonForScript({ userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History, enabledLinkedFileTypes: settings.enabledLinkedFileTypes, brandVariation: brandVariation })}
- 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)
script(type="text/javascript", nonce=scriptNonce).
window.data = JSON.parse(document.querySelector("#data").text);
window.project_id = "!{project_id}";
window.userSettings = window.data.userSettings;
window.user = window.data.user;
window.enabledLinkedFiles = window.data.enabledLinkedFiles;
window.csrfToken = "!{csrfToken}";
window.anonymous = #{anonymous};
window.brandVariation = window.data.brandVariation;
window.anonymousAccessToken = "#{anonymousAccessToken}";
window.isTokenMember = #{!!isTokenMember};
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
window.aceBasePath = "/js/#{lib('ace')}"
//- Set path for PDFjs CMaps
window.pdfCMapsPath = "/js/cmaps/"
//- enable doc hash checking for all projects
//- used in public/js/libs/sharejs.js
window.useShareJsHash = true
window.wsRetryHandshake = #{settings.wsRetryHandshake}
window.showReactFileTree = "!{showReactFileTree}" === 'true'
window.showReactAddFilesModal = "!{showReactAddFilesModal}" === 'true'
if (settings.overleaf != null)
meta(name="ol-overallThemes" data-type="json" content=overallThemes)
script(type="text/javascript", nonce=scriptNonce).
window.overallThemes = JSON.parse('!{StringHelper.stringifyJsonForScript(overallThemes)}');
block foot-scripts
script(type="text/javascript", nonce=scriptNonce, src=(wsUrl || '/socket.io') + '/socket.io.js')

View file

@ -55,3 +55,7 @@ script(type="text/ng-template", id="historyFileEntityTpl")
ng-repeat="childEntity in $ctrl.fileEntity.children"
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)}')

View file

@ -413,3 +413,7 @@ script(type='text/ng-template', id='clearCacheModalTemplate')
)
span(ng-show="!state.inflight") #{translate("clear_cache")}
span(ng-show="state.inflight") #{translate("clearing")}…
script(type="text/javascript", nonce=scriptNonce).
window.showNewLogsUI = #{showNewLogsUI || false}
window.logsUISubvariant = !{logsUISubvariant ? '"' + logsUISubvariant + '"' : 'null'}

View file

@ -711,7 +711,7 @@ App.controller('PdfController', function(
warnings: $scope.pdf.logEntries.warnings.length,
typesetting: $scope.pdf.logEntries.typesetting.length,
newLogsUI: window.showNewLogsUI,
subvariant: window.logsUISubvariant || null
subvariant: window.logsUISubvariant
}
eventTracking.sendMBSampled(
'compile-result',

View file

@ -6,7 +6,7 @@ async function run({ assertHasStatusCode, request }) {
assertHasStatusCode(response, 200)
const PROJECT_ID_REGEX = new RegExp(
`<meta name="ol-project_id" content="${Settings.smokeTest.projectId}">`
`window.project_id = "${Settings.smokeTest.projectId}"`
)
if (!PROJECT_ID_REGEX.test(response.body)) {
throw new Error('project page html does not have project_id')