Merge pull request #334 from sharelatex/bg-syntax-validation-menu

add left menu for syntax validator
This commit is contained in:
Brian Gough 2016-10-06 13:52:56 +01:00 committed by GitHub
commit a6e168e06c
7 changed files with 25 additions and 0 deletions

View file

@ -262,6 +262,7 @@ module.exports = ProjectController =
fontSize : user.ace.fontSize
autoComplete: user.ace.autoComplete
pdfViewer : user.ace.pdfViewer
syntaxValidation: user.ace.syntaxValidation
}
privilegeLevel: privilegeLevel
chatUrl: Settings.apis.chat.url
@ -323,6 +324,7 @@ defaultSettingsForAnonymousUser = (user_id)->
autoComplete: true
spellCheckLanguage: ""
pdfViewer: ""
syntaxValidation: true
subscription:
freeTrial:
allowed: true

View file

@ -56,6 +56,8 @@ module.exports = UserController =
user.ace.spellCheckLanguage = req.body.spellCheckLanguage
if req.body.pdfViewer?
user.ace.pdfViewer = req.body.pdfViewer
if req.body.syntaxValidation?
user.ace.syntaxValidation = req.body.syntaxValidation
user.save (err)->
newEmail = req.body.email?.trim().toLowerCase()
if !newEmail? or newEmail == user.email

View file

@ -26,6 +26,7 @@ UserSchema = new Schema
autoComplete: {type : Boolean, default: true}
spellCheckLanguage : {type : String, default: "en"}
pdfViewer : {type : String, default: "pdfjs"}
syntaxValidation : {type : Boolean, default: true}
}
features : {
collaborators: { type:Number, default: Settings.defaultFeatures.collaborators }

View file

@ -36,6 +36,7 @@ div.full-size(
annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
read-only="!permissions.write",
on-ctrl-enter="recompileViaKey"
syntax-validation="settings.syntaxValidation"
)
.ui-layout-east

View file

@ -105,6 +105,15 @@ aside#left-menu.full-size(
ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
)
if (user.betaProgram)
.form-controls
label(for="syntaxValidation") #{translate("syntax_validation")}
select(
name="syntaxValidation"
ng-model="settings.syntaxValidation"
ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
)
.form-controls
label(for="theme") #{translate("theme")}
select(

View file

@ -43,6 +43,7 @@ define [
annotations: "="
navigateHighlights: "=",
onCtrlEnter: "="
syntaxValidation: "="
}
link: (scope, element, attrs) ->
# Don't freak out if we're already in an apply callback
@ -188,6 +189,11 @@ define [
scope.$watch "readOnly", (value) ->
editor.setReadOnly !!value
scope.$watch "syntaxValidation", (value) ->
console.log "change syntaxValidation to ", value
session = editor.getSession()
session.setOption("useWorker", value);
editor.setOption("scrollPastEnd", true)
resetSession = () ->

View file

@ -28,6 +28,10 @@ define [
if pdfViewer != oldPdfViewer
settings.saveSettings({pdfViewer: pdfViewer})
$scope.$watch "settings.syntaxValidation", (syntaxValidation, oldSyntaxValidation) =>
if syntaxValidation != oldSyntaxValidation
settings.saveProjectSettings({syntaxValidation: syntaxValidation})
$scope.$watch "project.spellCheckLanguage", (language, oldLanguage) =>
return if @ignoreUpdates
if oldLanguage? and language != oldLanguage