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

infrastructure for using ace syntax checking

Brian Gough 10 лет назад
Родитель
Сommit
0a350c8e3f

+ 2 - 0
services/web/Gruntfile.coffee

@@ -176,6 +176,8 @@ module.exports = (grunt) ->
 							name: "libs"
 						},{
 							name: "ace/mode-latex"
+						},{
+							name: "ace/worker-latex"
 						}
 
 					]

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

@@ -130,10 +130,11 @@ block content
 	- var pdfPath = 'libs/pdfjs-1.3.91p1/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 = buildJsPath("ace", {cdn:false,fingerprint:false}) // don't use worker for cdn
 
 	script(type='text/javascript').
 		window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
+		window.aceWorkerPath = "#{aceWorkerPath}";
 
 	script(
 		data-main=buildJsPath("ide.js", {fingerprint:false}),

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

@@ -9,7 +9,11 @@ define [
 	"ide/editor/directives/aceEditor/cursor-position/CursorPositionManager"
 ], (App, Ace, SearchBox, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager) ->
 	EditSession = ace.require('ace/edit_session').EditSession
-	
+
+	# set the path for ace workers if using a CDN (from editor.jade)
+	if window.aceWorkerPath?
+		ace.config.set('workerPath', "#{window.aceWorkerPath}");
+
 	# Ace loads its script itself, so we need to hook in to be able to clear
 	# the cache.
 	if !ace.config._moduleUrl?