Przeglądaj źródła

upgrade pdfjs to 1.6.210p1

Brian Gough 10 lat temu
rodzic
commit
27a8dc1dfd

+ 3 - 3
services/web/Gruntfile.coffee

@@ -160,10 +160,10 @@ module.exports = (grunt) ->
 					paths:
 						"moment": "libs/#{PackageVersions.lib('moment')}"
 						"mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML"
-						"libs/pdf": "libs/#{PackageVersions.lib('pdfjs')}/pdf"
+						"pdfjs-dist/build/pdf": "libs/#{PackageVersions.lib('pdfjs')}/pdf"
 						"ace": "#{PackageVersions.lib('ace')}"
 					shim:
-						"libs/pdf":
+						"pdfjs-dist/build/pdf":
 							deps: ["libs/#{PackageVersions.lib('pdfjs')}/compatibility"]
 
 					skipDirOptimize: true
@@ -173,7 +173,7 @@ module.exports = (grunt) ->
 							exclude: ["libs"]
 						}, {
 							name: "ide",
-							exclude: ["libs", "libs/pdf"]
+							exclude: ["libs", "pdfjs-dist/build/pdf"]
 						}, {
 							name: "libs"
 						},{

+ 1 - 1
services/web/app/coffee/infrastructure/PackageVersions.coffee

@@ -1,5 +1,5 @@
 version = {
-	"pdfjs": "1.3.91p1"
+	"pdfjs": "1.6.210p1"
 	"moment": "2.9.0"
 	"ace": "1.2.5"
 }

+ 7 - 6
services/web/app/views/project/editor.jade

@@ -87,6 +87,10 @@ block content
 
 block requirejs
 	script(type="text/javascript" src='/socket.io/socket.io.js')
+
+	//- don't use cdn for worker
+	- var pdfWorkerPath = buildJsPath('/libs/' + lib('pdfjs') + '/pdf.worker', {cdn:false,fingerprint:false})
+
 	//- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
 	//- and doesn't prematurely end the script tag.
 	script(type='text/javascript').
@@ -101,13 +105,14 @@ block requirejs
 			"paths" : {
 				"mathjax": "#{buildJsPath('/libs/mathjax/MathJax.js', {cdn:false, fingerprint:false, qs:{config:'TeX-AMS_HTML'}})}",
 				"moment": "libs/#{lib('moment')}",
-				"libs/pdf": "libs/#{lib('pdfjs')}/pdf",
+				"pdfjs-dist/build/pdf": "libs/#{lib('pdfjs')}/pdf",
+				"pdfjs-dist/build/pdf.worker": "#{pdfWorkerPath}",
 				"ace": "#{lib('ace')}"
 			},
 			"urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}-#{fingerprint(jsPath + 'libs.js')}",
 			"waitSeconds": 0,
 			"shim": {
-				"libs/pdf": {
+				"pdfjs-dist/build/pdf": {
 					"deps": ["libs/#{lib('pdfjs')}/compatibility"]
 				},
 				"ace/ext-searchbox": {
@@ -125,13 +130,9 @@ block requirejs
 		};
 		window.aceFingerprint = "#{fingerprint(jsPath + lib('ace') + '/ace.js')}"
 
-	- var pdfPath = "libs/" + lib('pdfjs') + "/pdf.worker.js"
-	- var fingerprintedPath = fingerprint(jsPath+pdfPath)
-	- var pdfJsWorkerPath = buildJsPath(pdfPath, {cdn:false,qs:{fingerprint:fingerprintedPath}}) // don't use worker for cdn
 	- var aceWorkerPath = user.betaProgram ? buildJsPath(lib('ace'), {cdn:false,fingerprint:false}) : "" // don't use worker for cdn
 
 	script(type='text/javascript').
-		window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
 		window.aceWorkerPath = "#{aceWorkerPath}";
 
 	script(

+ 0 - 3
services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee

@@ -6,9 +6,6 @@ define [
 	pdfViewer
 
 ) ->
-	if PDFJS?
-		PDFJS.workerSrc = window.pdfJsWorkerPath
-
 	App.directive "pdfng", ["$timeout", "localStorage", ($timeout, localStorage) ->
 		return {
 			scope: {