|
@@ -13,6 +13,7 @@ define [
|
|
|
"ide/labels/services/labels"
|
|
"ide/labels/services/labels"
|
|
|
"ide/graphics/services/graphics"
|
|
"ide/graphics/services/graphics"
|
|
|
"ide/preamble/services/preamble"
|
|
"ide/preamble/services/preamble"
|
|
|
|
|
+ "ide/files/services/files"
|
|
|
], (App, Ace, SearchBox, ModeList, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager, TrackChangesManager, LabelsManager) ->
|
|
], (App, Ace, SearchBox, ModeList, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager, TrackChangesManager, LabelsManager) ->
|
|
|
EditSession = ace.require('ace/edit_session').EditSession
|
|
EditSession = ace.require('ace/edit_session').EditSession
|
|
|
ModeList = ace.require('ace/ext/modelist')
|
|
ModeList = ace.require('ace/ext/modelist')
|
|
@@ -35,7 +36,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, $http) ->
|
|
|
|
|
|
|
+ App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking, localStorage, $cacheFactory, labels, graphics, preamble, files, $http) ->
|
|
|
monkeyPatchSearch($rootScope, $compile)
|
|
monkeyPatchSearch($rootScope, $compile)
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -103,7 +104,7 @@ define [
|
|
|
cursorPositionManager = new CursorPositionManager(scope, editor, element, localStorage)
|
|
cursorPositionManager = new CursorPositionManager(scope, editor, element, localStorage)
|
|
|
trackChangesManager = new TrackChangesManager(scope, editor, element)
|
|
trackChangesManager = new TrackChangesManager(scope, editor, element)
|
|
|
labelsManager = new LabelsManager(scope, editor, element, labels)
|
|
labelsManager = new LabelsManager(scope, editor, element, labels)
|
|
|
- autoCompleteManager = new AutoCompleteManager(scope, editor, element, labelsManager, graphics, preamble)
|
|
|
|
|
|
|
+ autoCompleteManager = new AutoCompleteManager(scope, editor, element, labelsManager, graphics, preamble, files)
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prevert Ctrl|Cmd-S from triggering save dialog
|
|
# Prevert Ctrl|Cmd-S from triggering save dialog
|
|
@@ -115,16 +116,16 @@ define [
|
|
|
editor.commands.removeCommand "transposeletters"
|
|
editor.commands.removeCommand "transposeletters"
|
|
|
editor.commands.removeCommand "showSettingsMenu"
|
|
editor.commands.removeCommand "showSettingsMenu"
|
|
|
editor.commands.removeCommand "foldall"
|
|
editor.commands.removeCommand "foldall"
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
# For European keyboards, the / is above 7 so needs Shift pressing.
|
|
# For European keyboards, the / is above 7 so needs Shift pressing.
|
|
|
- # This comes through as Command-Shift-/ on OS X, which is mapped to
|
|
|
|
|
|
|
+ # This comes through as Command-Shift-/ on OS X, which is mapped to
|
|
|
# toggleBlockComment.
|
|
# toggleBlockComment.
|
|
|
# This doesn't do anything for LaTeX, so remap this to togglecomment to
|
|
# This doesn't do anything for LaTeX, so remap this to togglecomment to
|
|
|
# work for European keyboards as normal.
|
|
# work for European keyboards as normal.
|
|
|
# On Windows, the key combo comes as Ctrl-Shift-7.
|
|
# On Windows, the key combo comes as Ctrl-Shift-7.
|
|
|
editor.commands.removeCommand "toggleBlockComment"
|
|
editor.commands.removeCommand "toggleBlockComment"
|
|
|
editor.commands.removeCommand "togglecomment"
|
|
editor.commands.removeCommand "togglecomment"
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
editor.commands.addCommand {
|
|
editor.commands.addCommand {
|
|
|
name: "togglecomment",
|
|
name: "togglecomment",
|
|
|
bindKey: { win: "Ctrl-/|Ctrl-Shift-7", mac: "Command-/|Command-Shift-/" },
|
|
bindKey: { win: "Ctrl-/|Ctrl-Shift-7", mac: "Command-/|Command-Shift-/" },
|
|
@@ -140,7 +141,7 @@ define [
|
|
|
exec: (editor) ->
|
|
exec: (editor) ->
|
|
|
ace.require("ace/ext/searchbox").Search(editor, true)
|
|
ace.require("ace/ext/searchbox").Search(editor, true)
|
|
|
readOnly: true
|
|
readOnly: true
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
# Bold text on CMD+B
|
|
# Bold text on CMD+B
|
|
|
editor.commands.addCommand
|
|
editor.commands.addCommand
|
|
|
name: "bold",
|
|
name: "bold",
|
|
@@ -154,7 +155,7 @@ define [
|
|
|
text = editor.getCopyText()
|
|
text = editor.getCopyText()
|
|
|
editor.insert("\\textbf{" + text + "}")
|
|
editor.insert("\\textbf{" + text + "}")
|
|
|
readOnly: false
|
|
readOnly: false
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
# Italicise text on CMD+I
|
|
# Italicise text on CMD+I
|
|
|
editor.commands.addCommand
|
|
editor.commands.addCommand
|
|
|
name: "italics",
|
|
name: "italics",
|
|
@@ -171,7 +172,7 @@ define [
|
|
|
|
|
|
|
|
scope.$watch "onCtrlEnter", (callback) ->
|
|
scope.$watch "onCtrlEnter", (callback) ->
|
|
|
if callback?
|
|
if callback?
|
|
|
- editor.commands.addCommand
|
|
|
|
|
|
|
+ editor.commands.addCommand
|
|
|
name: "compile",
|
|
name: "compile",
|
|
|
bindKey: win: "Ctrl-Enter", mac: "Command-Enter"
|
|
bindKey: win: "Ctrl-Enter", mac: "Command-Enter"
|
|
|
exec: (editor) =>
|
|
exec: (editor) =>
|
|
@@ -180,7 +181,7 @@ define [
|
|
|
|
|
|
|
|
scope.$watch "onCtrlJ", (callback) ->
|
|
scope.$watch "onCtrlJ", (callback) ->
|
|
|
if callback?
|
|
if callback?
|
|
|
- editor.commands.addCommand
|
|
|
|
|
|
|
+ editor.commands.addCommand
|
|
|
name: "toggle-review-panel",
|
|
name: "toggle-review-panel",
|
|
|
bindKey: win: "Ctrl-J", mac: "Command-J"
|
|
bindKey: win: "Ctrl-J", mac: "Command-J"
|
|
|
exec: (editor) =>
|
|
exec: (editor) =>
|
|
@@ -189,7 +190,7 @@ define [
|
|
|
|
|
|
|
|
scope.$watch "onCtrlShiftC", (callback) ->
|
|
scope.$watch "onCtrlShiftC", (callback) ->
|
|
|
if callback?
|
|
if callback?
|
|
|
- editor.commands.addCommand
|
|
|
|
|
|
|
+ editor.commands.addCommand
|
|
|
name: "add-new-comment",
|
|
name: "add-new-comment",
|
|
|
bindKey: win: "Ctrl-Shift-C", mac: "Command-Shift-C"
|
|
bindKey: win: "Ctrl-Shift-C", mac: "Command-Shift-C"
|
|
|
exec: (editor) =>
|
|
exec: (editor) =>
|
|
@@ -198,7 +199,7 @@ define [
|
|
|
|
|
|
|
|
scope.$watch "onCtrlShiftA", (callback) ->
|
|
scope.$watch "onCtrlShiftA", (callback) ->
|
|
|
if callback?
|
|
if callback?
|
|
|
- editor.commands.addCommand
|
|
|
|
|
|
|
+ editor.commands.addCommand
|
|
|
name: "toggle-track-changes",
|
|
name: "toggle-track-changes",
|
|
|
bindKey: win: "Ctrl-Shift-A", mac: "Command-Shift-A"
|
|
bindKey: win: "Ctrl-Shift-A", mac: "Command-Shift-A"
|
|
|
exec: (editor) =>
|
|
exec: (editor) =>
|
|
@@ -302,7 +303,7 @@ define [
|
|
|
if updateCount == 100
|
|
if updateCount == 100
|
|
|
event_tracking.send 'editor-interaction', 'multi-doc-update'
|
|
event_tracking.send 'editor-interaction', 'multi-doc-update'
|
|
|
scope.$emit "#{scope.name}:change"
|
|
scope.$emit "#{scope.name}:change"
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
onScroll = (scrollTop) ->
|
|
onScroll = (scrollTop) ->
|
|
|
return if !scope.eventsBridge?
|
|
return if !scope.eventsBridge?
|
|
|
height = editor.renderer.layerConfig.maxHeight
|
|
height = editor.renderer.layerConfig.maxHeight
|
|
@@ -311,7 +312,7 @@ define [
|
|
|
onScrollbarVisibilityChanged = (event, vRenderer) ->
|
|
onScrollbarVisibilityChanged = (event, vRenderer) ->
|
|
|
return if !scope.eventsBridge?
|
|
return if !scope.eventsBridge?
|
|
|
scope.eventsBridge.emit "aceScrollbarVisibilityChanged", vRenderer.scrollBarV.isVisible, vRenderer.scrollBarV.width
|
|
scope.eventsBridge.emit "aceScrollbarVisibilityChanged", vRenderer.scrollBarV.isVisible, vRenderer.scrollBarV.width
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if scope.eventsBridge?
|
|
if scope.eventsBridge?
|
|
|
editor.renderer.on "scrollbarVisibilityChanged", onScrollbarVisibilityChanged
|
|
editor.renderer.on "scrollbarVisibilityChanged", onScrollbarVisibilityChanged
|
|
|
|
|
|
|
@@ -401,14 +402,14 @@ define [
|
|
|
|
|
|
|
|
session = editor.getSession()
|
|
session = editor.getSession()
|
|
|
session.off "changeScrollTop"
|
|
session.off "changeScrollTop"
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
doc = session.getDocument()
|
|
doc = session.getDocument()
|
|
|
doc.off "change", onChange
|
|
doc.off "change", onChange
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
editor.renderer.on "changeCharacterSize", () ->
|
|
editor.renderer.on "changeCharacterSize", () ->
|
|
|
scope.$apply () ->
|
|
scope.$apply () ->
|
|
|
scope.rendererData.lineHeight = editor.renderer.lineHeight
|
|
scope.rendererData.lineHeight = editor.renderer.lineHeight
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
scope.$watch "rendererData", (rendererData) ->
|
|
scope.$watch "rendererData", (rendererData) ->
|
|
|
if rendererData?
|
|
if rendererData?
|
|
|
rendererData.lineHeight = editor.renderer.lineHeight
|
|
rendererData.lineHeight = editor.renderer.lineHeight
|