mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' of github.com:sharelatex/web-sharelatex
This commit is contained in:
commit
9a86f24bf7
6 changed files with 42 additions and 16 deletions
|
@ -120,7 +120,7 @@ module.exports = class ProjectController
|
||||||
allowed: true
|
allowed: true
|
||||||
featureSwitches:
|
featureSwitches:
|
||||||
dropbox: false
|
dropbox: false
|
||||||
longPolling: false
|
trackChanges: false
|
||||||
else
|
else
|
||||||
anonymous = false
|
anonymous = false
|
||||||
SubscriptionLocator.getUsersSubscription user._id, (err, subscription)->
|
SubscriptionLocator.getUsersSubscription user._id, (err, subscription)->
|
||||||
|
@ -154,7 +154,7 @@ module.exports = class ProjectController
|
||||||
spellCheckLanguage: user.ace.spellCheckLanguage
|
spellCheckLanguage: user.ace.spellCheckLanguage
|
||||||
pdfViewer : user.ace.pdfViewer
|
pdfViewer : user.ace.pdfViewer
|
||||||
docPositions: {}
|
docPositions: {}
|
||||||
longPolling: user.featureSwitches.longPolling
|
trackChanges: user.featureSwitches.trackChanges
|
||||||
})
|
})
|
||||||
sharelatexObject : JSON.stringify({
|
sharelatexObject : JSON.stringify({
|
||||||
siteUrl: Settings.siteUrl,
|
siteUrl: Settings.siteUrl,
|
||||||
|
|
|
@ -32,7 +32,7 @@ UserSchema = new Schema
|
||||||
}
|
}
|
||||||
featureSwitches : {
|
featureSwitches : {
|
||||||
dropbox: {type:Boolean, default:true},
|
dropbox: {type:Boolean, default:true},
|
||||||
longPolling: {type:Boolean, default:false}
|
trackChanges: {type:Boolean, default:false}
|
||||||
}
|
}
|
||||||
referal_id : {type:String, default:() -> uuid.v4().split("-")[0]}
|
referal_id : {type:String, default:() -> uuid.v4().split("-")[0]}
|
||||||
refered_users: [ type:ObjectId, ref:'User' ]
|
refered_users: [ type:ObjectId, ref:'User' ]
|
||||||
|
|
|
@ -100,6 +100,8 @@ define [
|
||||||
showContextMenu: (position) ->
|
showContextMenu: (position) ->
|
||||||
entries = @getContextMenuEntries()
|
entries = @getContextMenuEntries()
|
||||||
|
|
||||||
|
@manager.trigger "contextmenu:beforeshow", @model, entries
|
||||||
|
|
||||||
@contextMenu = new ContextMenu(position, entries)
|
@contextMenu = new ContextMenu(position, entries)
|
||||||
@contextMenu.on "destroy", () =>
|
@contextMenu.on "destroy", () =>
|
||||||
delete @contextMenu
|
delete @contextMenu
|
||||||
|
|
|
@ -97,8 +97,6 @@ define [
|
||||||
ioOptions =
|
ioOptions =
|
||||||
reconnect: false
|
reconnect: false
|
||||||
"force new connection": true
|
"force new connection": true
|
||||||
if @userSettings.longPolling
|
|
||||||
ioOptions.transports = ["xhr-polling"]
|
|
||||||
@socket = socket = io.connect null, ioOptions
|
@socket = socket = io.connect null, ioOptions
|
||||||
|
|
||||||
@messageManager = new MessageManager(@)
|
@messageManager = new MessageManager(@)
|
||||||
|
@ -119,7 +117,8 @@ define [
|
||||||
@cursorManager = new CursorManager(@)
|
@cursorManager = new CursorManager(@)
|
||||||
@fileViewManager = new FileViewManager(@)
|
@fileViewManager = new FileViewManager(@)
|
||||||
@analyticsManager = new AnalyticsManager(@)
|
@analyticsManager = new AnalyticsManager(@)
|
||||||
@trackChangesManager = new TrackChangesManager(@)
|
if @userSettings.trackChanges
|
||||||
|
@trackChangesManager = new TrackChangesManager(@)
|
||||||
|
|
||||||
@setLoadingMessage("Connecting")
|
@setLoadingMessage("Connecting")
|
||||||
firstConnect = true
|
firstConnect = true
|
||||||
|
|
|
@ -23,11 +23,14 @@ define [
|
||||||
@insertNameTag()
|
@insertNameTag()
|
||||||
return @
|
return @
|
||||||
|
|
||||||
|
destroy: () ->
|
||||||
|
@$editor?.remove()
|
||||||
|
|
||||||
createAceEditor: () ->
|
createAceEditor: () ->
|
||||||
@$el.empty()
|
@$el.empty()
|
||||||
$editor = $("<div/>")
|
@$editor = $("<div/>")
|
||||||
@$el.append($editor)
|
@$el.append(@$editor)
|
||||||
@aceEditor = Ace.edit($editor[0])
|
@aceEditor = Ace.edit(@$editor[0])
|
||||||
@aceEditor.setTheme("ace/theme/#{window.userSettings.theme}")
|
@aceEditor.setTheme("ace/theme/#{window.userSettings.theme}")
|
||||||
@aceEditor.setReadOnly true
|
@aceEditor.setReadOnly true
|
||||||
@aceEditor.setShowPrintMargin(false)
|
@aceEditor.setShowPrintMargin(false)
|
||||||
|
|
|
@ -4,26 +4,38 @@ define [
|
||||||
"track-changes/ChangeListView"
|
"track-changes/ChangeListView"
|
||||||
"track-changes/DiffView"
|
"track-changes/DiffView"
|
||||||
"utils/Modal"
|
"utils/Modal"
|
||||||
|
"models/Doc"
|
||||||
"moment"
|
"moment"
|
||||||
], (ChangeList, Diff, ChangeListView, DiffView, Modal, moment) ->
|
], (ChangeList, Diff, ChangeListView, DiffView, Modal, Doc, moment) ->
|
||||||
class TrackChangesManager
|
class TrackChangesManager
|
||||||
template: $("#trackChangesPanelTemplate").html()
|
template: $("#trackChangesPanelTemplate").html()
|
||||||
|
|
||||||
constructor: (@ide) ->
|
constructor: (@ide) ->
|
||||||
|
@project_id = window.userSettings.project_id
|
||||||
@$el = $(@template)
|
@$el = $(@template)
|
||||||
$("#editorWrapper").append(@$el)
|
$("#editorWrapper").append(@$el)
|
||||||
@hide()
|
@hideEl()
|
||||||
|
|
||||||
@ide.editor.on "change:doc", () =>
|
@ide.editor.on "change:doc", () =>
|
||||||
@hide()
|
@hideEl()
|
||||||
|
|
||||||
@$el.find(".track-changes-close").on "click", (e) =>
|
@$el.find(".track-changes-close").on "click", (e) =>
|
||||||
e.preventDefault
|
e.preventDefault
|
||||||
@hide()
|
@hide()
|
||||||
|
|
||||||
show: () ->
|
@ide.fileTreeManager.on "contextmenu:beforeshow", (entity, entries) =>
|
||||||
@project_id = window.userSettings.project_id
|
if entity instanceof Doc
|
||||||
@doc_id = @ide.editor.current_doc_id
|
entries.push {
|
||||||
|
divider: true
|
||||||
|
}, {
|
||||||
|
text: "History"
|
||||||
|
onClick: () =>
|
||||||
|
@show(entity.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
show: (@doc_id) ->
|
||||||
|
@ide.fileTreeManager.selectEntity(@doc_id)
|
||||||
|
|
||||||
@changes = new ChangeList([], doc_id: @doc_id, project_id: @project_id)
|
@changes = new ChangeList([], doc_id: @doc_id, project_id: @project_id)
|
||||||
|
|
||||||
@changeListView = new ChangeListView(
|
@changeListView = new ChangeListView(
|
||||||
|
@ -40,8 +52,15 @@ define [
|
||||||
@changeListView.on "restore", (change) =>
|
@changeListView.on "restore", (change) =>
|
||||||
@restore(change)
|
@restore(change)
|
||||||
|
|
||||||
|
if @diffView?
|
||||||
|
@diffView.destroy()
|
||||||
|
|
||||||
@showEl()
|
@showEl()
|
||||||
|
|
||||||
|
hide: () ->
|
||||||
|
@hideEl()
|
||||||
|
@ide.fileTreeManager.openDoc(@doc_id)
|
||||||
|
|
||||||
autoSelectDiff: () ->
|
autoSelectDiff: () ->
|
||||||
if @changes.models.length == 0
|
if @changes.models.length == 0
|
||||||
return
|
return
|
||||||
|
@ -69,6 +88,9 @@ define [
|
||||||
from: fromModel.get("fromVersion")
|
from: fromModel.get("fromVersion")
|
||||||
to: toModel.get("toVersion")
|
to: toModel.get("toVersion")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if @diffView?
|
||||||
|
@diffView.destroy()
|
||||||
@diffView = new DiffView(
|
@diffView = new DiffView(
|
||||||
model: @diff
|
model: @diff
|
||||||
el: @$el.find(".track-changes-diff")
|
el: @$el.find(".track-changes-diff")
|
||||||
|
@ -79,7 +101,7 @@ define [
|
||||||
@ide.editor.hide()
|
@ide.editor.hide()
|
||||||
@$el.show()
|
@$el.show()
|
||||||
|
|
||||||
hide: () ->
|
hideEl: () ->
|
||||||
@ide.editor.show()
|
@ide.editor.show()
|
||||||
@$el.hide()
|
@$el.hide()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue