2020-05-12 10:23:53 -04:00
|
|
|
/* global MathJax */
|
|
|
|
|
2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
camelcase,
|
|
|
|
max-len,
|
|
|
|
no-useless-escape,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS101: Remove unnecessary use of Array.from
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* DS103: Rewrite code to no longer use __guard__
|
|
|
|
* DS207: Consider shorter variations of null checks
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2019-12-11 04:53:31 -05:00
|
|
|
|
2021-06-23 04:10:27 -04:00
|
|
|
import './utils/webpack-public-path'
|
2020-05-19 05:02:56 -04:00
|
|
|
import './libraries'
|
2020-12-03 08:58:46 -05:00
|
|
|
import './infrastructure/error-reporter'
|
2020-05-19 05:02:56 -04:00
|
|
|
import './modules/recursionHelper'
|
|
|
|
import './modules/errorCatcher'
|
|
|
|
import './modules/localStorage'
|
|
|
|
import './modules/sessionStorage'
|
2021-03-22 05:51:07 -04:00
|
|
|
import getMeta from './utils/meta'
|
2019-12-11 04:53:31 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
const App = angular
|
|
|
|
.module('SharelatexApp', [
|
|
|
|
'ui.bootstrap',
|
|
|
|
'autocomplete',
|
|
|
|
'RecursionHelper',
|
|
|
|
'ng-context-menu',
|
|
|
|
'ngSanitize',
|
|
|
|
'ipCookie',
|
|
|
|
'ErrorCatcher',
|
|
|
|
'localStorage',
|
|
|
|
'sessionStorage',
|
2021-04-27 03:52:58 -04:00
|
|
|
'ui.select',
|
2020-05-19 05:02:56 -04:00
|
|
|
])
|
2021-04-14 09:17:21 -04:00
|
|
|
.config(function ($qProvider, $httpProvider, uiSelectConfig) {
|
2020-05-19 05:02:56 -04:00
|
|
|
$qProvider.errorOnUnhandledRejections(false)
|
|
|
|
uiSelectConfig.spinnerClass = 'fa fa-refresh ui-select-spin'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
return __guard__(
|
|
|
|
typeof MathJax !== 'undefined' && MathJax !== null
|
|
|
|
? MathJax.Hub
|
|
|
|
: undefined,
|
|
|
|
x =>
|
|
|
|
x.Config({
|
|
|
|
messageStyle: 'none',
|
|
|
|
imageFont: null,
|
2021-03-04 11:10:51 -05:00
|
|
|
// Fast preview, introduced in 2.5, is unhelpful due to extra codemirror refresh
|
|
|
|
// and disabling it avoids issues with math processing errors
|
|
|
|
// github.com/overleaf/write_latex/pull/1375
|
|
|
|
'fast-preview': { disabled: true },
|
2020-05-19 05:02:56 -04:00
|
|
|
'HTML-CSS': {
|
|
|
|
availableFonts: ['TeX'],
|
|
|
|
// MathJax's automatic font scaling does not work well when we render math
|
|
|
|
// that isn't yet on the page, so we disable it and set a global font
|
|
|
|
// scale factor
|
|
|
|
scale: 110,
|
2021-04-27 03:52:58 -04:00
|
|
|
matchFontHeight: false,
|
2020-05-19 05:02:56 -04:00
|
|
|
},
|
|
|
|
TeX: {
|
|
|
|
equationNumbers: { autoNumber: 'AMS' },
|
2021-04-27 03:52:58 -04:00
|
|
|
useLabelIDs: false,
|
2020-05-19 05:02:56 -04:00
|
|
|
},
|
|
|
|
skipStartupTypeset: true,
|
|
|
|
tex2jax: {
|
|
|
|
processEscapes: true,
|
|
|
|
// Dollar delimiters are added by the mathjax directive
|
|
|
|
inlineMath: [['\\(', '\\)']],
|
2020-12-15 05:23:54 -05:00
|
|
|
displayMath: [
|
|
|
|
['$$', '$$'],
|
2021-04-27 03:52:58 -04:00
|
|
|
['\\[', '\\]'],
|
|
|
|
],
|
|
|
|
},
|
2020-05-19 05:02:56 -04:00
|
|
|
})
|
2018-11-05 05:06:39 -05:00
|
|
|
)
|
2020-05-19 05:02:56 -04:00
|
|
|
})
|
|
|
|
|
2020-10-30 08:33:25 -04:00
|
|
|
App.run(($rootScope, $templateCache) => {
|
2021-03-22 05:51:07 -04:00
|
|
|
$rootScope.usersEmail = getMeta('ol-usersEmail')
|
2020-10-30 08:33:25 -04:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
// UI Select templates are hard-coded and use Glyphicon icons (which we don't import).
|
|
|
|
// The line below simply overrides the hard-coded template with our own, which is
|
|
|
|
// basically the same but using Font Awesome icons.
|
|
|
|
$templateCache.put(
|
|
|
|
'bootstrap/match.tpl.html',
|
|
|
|
'<div class="ui-select-match" ng-hide="$select.open && $select.searchEnabled" ng-disabled="$select.disabled" ng-class="{\'btn-default-focus\':$select.focus}"><span tabindex="-1" class="btn btn-default form-control ui-select-toggle" aria-label="{{ $select.baseTitle }} activate" ng-disabled="$select.disabled" ng-click="$select.activate()" style="outline: 0;"><span ng-show="$select.isEmpty()" class="ui-select-placeholder text-muted">{{$select.placeholder}}</span> <span ng-hide="$select.isEmpty()" class="ui-select-match-text pull-left" ng-class="{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}" ng-transclude=""></span> <i class="caret pull-right" ng-click="$select.toggle($event)"></i> <a ng-show="$select.allowClear && !$select.isEmpty() && ($select.disabled !== true)" aria-label="{{ $select.baseTitle }} clear" style="margin-right: 10px" ng-click="$select.clear($event)" class="btn btn-xs btn-link pull-right"><i class="fa fa-times" aria-hidden="true"></i></a></span></div>'
|
2018-11-05 05:06:39 -05:00
|
|
|
)
|
2020-10-30 08:33:25 -04:00
|
|
|
})
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-12-11 05:41:41 -05:00
|
|
|
const sl_debugging = window.location.search.match(/debug=true/)
|
2020-05-19 05:02:56 -04:00
|
|
|
window.sl_debugging = sl_debugging // make a global flag for debugging code
|
2020-12-11 05:41:41 -05:00
|
|
|
window.sl_console = sl_debugging ? console : { log() {} }
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
export default App
|
2018-11-05 05:06:39 -05:00
|
|
|
|
|
|
|
function __guard__(value, transform) {
|
|
|
|
return typeof value !== 'undefined' && value !== null
|
|
|
|
? transform(value)
|
|
|
|
: undefined
|
|
|
|
}
|