mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Use var in root scope instead of event to track linting error
This commit is contained in:
parent
dab799a81b
commit
53bb4fdde0
2 changed files with 5 additions and 11 deletions
|
@ -35,7 +35,7 @@ define [
|
||||||
url = ace.config._moduleUrl(args...) + "?fingerprint=#{window.aceFingerprint}"
|
url = ace.config._moduleUrl(args...) + "?fingerprint=#{window.aceFingerprint}"
|
||||||
return url
|
return url
|
||||||
|
|
||||||
App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking, localStorage, $cacheFactory, labels, graphics, preamble, ide) ->
|
App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking, localStorage, $cacheFactory, labels, graphics, preamble) ->
|
||||||
monkeyPatchSearch($rootScope, $compile)
|
monkeyPatchSearch($rootScope, $compile)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -374,16 +374,15 @@ define [
|
||||||
if scope.eventsBridge?
|
if scope.eventsBridge?
|
||||||
session.on "changeScrollTop", onScroll
|
session.on "changeScrollTop", onScroll
|
||||||
|
|
||||||
hasLintingError = null
|
$rootScope.hasLintingError = false
|
||||||
session.on('changeAnnotation', () ->
|
session.on('changeAnnotation', () ->
|
||||||
hasErrors = session
|
hasErrors = session
|
||||||
.getAnnotations()
|
.getAnnotations()
|
||||||
.filter((annotation) -> annotation.type == 'error')
|
.filter((annotation) -> annotation.type == 'error')
|
||||||
.length > 0
|
.length > 0
|
||||||
|
|
||||||
if (hasLintingError != hasErrors)
|
if ($rootScope.hasLintingError != hasErrors)
|
||||||
ide.$scope.$broadcast('ide:lintingError', hasErrors)
|
$rootScope.hasLintingError = hasErrors
|
||||||
hasLintingError = hasErrors
|
|
||||||
)
|
)
|
||||||
|
|
||||||
setTimeout () ->
|
setTimeout () ->
|
||||||
|
|
|
@ -2,13 +2,8 @@ define [
|
||||||
"base"
|
"base"
|
||||||
], (App) ->
|
], (App) ->
|
||||||
App.controller "AutoCompileController", ["$scope", "ide", ($scope, ide) ->
|
App.controller "AutoCompileController", ["$scope", "ide", ($scope, ide) ->
|
||||||
hasLintingError = false
|
|
||||||
|
|
||||||
ide.$scope.$on "ide:opAcknowledged", _.debounce(() ->
|
ide.$scope.$on "ide:opAcknowledged", _.debounce(() ->
|
||||||
if (!hasLintingError)
|
if (!ide.$scope.hasLintingError)
|
||||||
$scope.recompile()
|
$scope.recompile()
|
||||||
, 3000)
|
, 3000)
|
||||||
|
|
||||||
ide.$scope.$on "ide:lintingError", (e, hasError) ->
|
|
||||||
hasLintingError = hasError
|
|
||||||
]
|
]
|
Loading…
Reference in a new issue