Просмотр исходного кода

Sort out fingerprints and pdf.js worker path

James Allen 12 лет назад
Родитель
Сommit
8f08823d34

+ 0 - 5
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -217,12 +217,7 @@ module.exports = ProjectController =
 						autoComplete: user.ace.autoComplete
 						pdfViewer : user.ace.pdfViewer
 					}
-					sharelatex : {
-						siteUrl: Settings.siteUrl,
-						jsPath: res.locals.jsPath
-					}
 					privilegeLevel: privilegeLevel
-					loadPdfjs: (user.ace.pdfViewer == "pdfjs")
 					chatUrl: Settings.apis.chat.url
 					anonymous: anonymous
 					languages: Settings.languages

+ 2 - 4
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -17,12 +17,10 @@ logger.log "Generating file fingerprints..."
 for path in [
     "#{jsPath}libs/require.js",
     "#{jsPath}ide.js",
-    "#{jsPath}app/main.js",
-    "#{jsPath}list.js",
+    "#{jsPath}main.js",
     "#{jsPath}libs/pdf.js",
     "#{jsPath}libs/pdf.worker.js",
-    "/stylesheets/style.css",
-    "/brand/plans.css"
+    "/stylesheets/style.css"
 ]
 	filePath = Path.join __dirname, "../../../", "public#{path}"
 	exists = fs.existsSync filePath

+ 4 - 1
services/web/app/views/layout.jade

@@ -80,7 +80,10 @@ html(itemscope, itemtype='http://schema.org/Product')
 				};
 
 		script.
-			window.sharelatex = {}
+			window.sharelatex = {
+				siteUrl: '#{settings.siteUrl}',
+				jsPath:  '#{jsPath}'
+			};
 
 		- if (typeof(settings.algolia) != "undefined")
 			script.

+ 4 - 2
services/web/app/views/project/editor.jade

@@ -82,7 +82,6 @@ block content
 	//- and doesn't prematurely end the script tag.
 	script(type='text/javascript').
 		window.project_id = "!{project_id}"
-		window.sharelatex = !{JSON.stringify(sharelatex).replace(/\//g, '\\/')};
 		window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
 		window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
 		window.csrfToken = "!{csrfToken}";
@@ -99,6 +98,9 @@ block content
 				},
 				"libs/pdf": {
 					deps: ["libs/compatibility"]
+				},
+				"ace/ext-searchbox": {
+					deps: ["ace/ace"]
 				}
 			}
 		};
@@ -112,7 +114,7 @@ block content
 	- var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
 	- var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
 	script(type='text/javascript').
-		window.sharelatex.pdfJsWorkerPath = "#{pdfJsWorkerPath}"
+		window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
 
 	script(
 		data-main=jsPath+'ide.js',

+ 1 - 1
services/web/public/coffee/ide/editor/directives/aceEditor.coffee

@@ -66,7 +66,7 @@ define [
 					name: "find",
 					bindKey: win: "Ctrl-F", mac: "Command-F"
 					exec: (editor) ->
-						Ace.require("ace/ext/searchbox").Search(editor, true)
+						ace.require("ace/ext/searchbox").Search(editor, true)
 					readOnly: true
 				editor.commands.removeCommand "replace"
 

+ 2 - 1
services/web/public/coffee/ide/pdf/directives/pdfJs.coffee

@@ -17,8 +17,9 @@ define [
 	annotationsLayerCss
 	highlightsLayerCss
 ) ->
+	console.log "SETTING workerSrc", PDFJS, window.pdfJsWorkerPath
 	if PDFJS?
-		PDFJS.workerSrc = "#{window.sharelatex.pdfJsWorkerPath}"
+		PDFJS.workerSrc = window.pdfJsWorkerPath
 
 	style = $("<style/>")
 	style.text(textLayerCss + "\n" + annotationsLayerCss + "\n" + highlightsLayerCss)