This commit is contained in:
Nick Winter 2015-11-30 11:00:17 -08:00
commit bf4593f5d4
3 changed files with 50 additions and 1 deletions

View file

@ -42,6 +42,7 @@ module.exports = class AuthModal extends ModalView
afterRender: ->
super()
@$el.toggleClass('signup', @mode is 'signup').toggleClass('login', @mode is 'login')
@playSound 'game-menu-open'
afterInsert: ->
super()
@ -105,6 +106,7 @@ module.exports = class AuthModal extends ModalView
createUser userObject, null, window.nextURL
onLoggingInWithFacebook: (e) ->
@playSound 'menu-button-click'
modal = $('.modal:visible', @$el)
@enableModalInProgress(modal) # TODO: part of forms
@ -155,3 +157,7 @@ module.exports = class AuthModal extends ModalView
el.i18n()
@$el.find('.modal-body:visible').empty().append(el)
@$el.find('.modal-footer').remove()
onHidden: ->
super()
@playSound 'game-menu-close'

View file

@ -92,7 +92,7 @@ module.exports = class SpellView extends CocoView
@aceSession.setNewLineMode 'unix'
@aceSession.setUseSoftTabs true
@ace.setTheme 'ace/theme/textmate'
@ace.setDisplayIndentGuides aceConfig.indentGuides
@ace.setDisplayIndentGuides false
@ace.setShowPrintMargin false
@ace.setShowInvisibles aceConfig.invisibles
@ace.setBehavioursEnabled aceConfig.behaviors
@ -253,6 +253,7 @@ module.exports = class SpellView extends CocoView
hookACECustomBehavior: ->
aceConfig = me.get('aceConfig') ? {}
@ace.commands.on 'exec', (e) =>
# When pressing enter with an active selection, just make a new line under it.
if e.command.name is 'enter-skip-delimiters'
@ -261,6 +262,46 @@ module.exports = class SpellView extends CocoView
e.editor.execCommand 'gotolineend'
return true
if me.level() < 20 or aceConfig.indentGuides
@aceSession.addDynamicMarker
update: (html, markerLayer, session, config) =>
Range = ace.require('ace/range').Range
foldWidgets = @aceSession.foldWidgets
return if not foldWidgets?
lines = @aceDoc.getAllLines()
startOfRow = (r) ->
str = lines[r]
ar = str.match(/^\s*/)
ar.pop().length
colors = ['50,150,200', '200,150,50', '255,0,0', '0,255,0']
for row in [0..@aceSession.getLength()]
foldWidgets[row] = @aceSession.getFoldWidget(row) unless foldWidgets[row]?
continue if foldWidgets[row] isnt "start"
range = @aceSession.getFoldWidgetRange(row)
xstart = startOfRow(range.start.row)
level = Math.floor(xstart / 4)
indent = startOfRow(range.start.row + 1)
color = colors[level % colors.length]
t = markerLayer.$getTop(range.start.row + 1, config)
h = config.lineHeight * (range.end.row - range.start.row)
l = markerLayer.$padding + xstart * config.characterWidth
# w = (data.i - data.b) * config.characterWidth
w = 4 * config.characterWidth
html.push [
'<div style="',
"position: absolute; top: #{t}px; left: #{l}px; width: #{w}px; height: #{h}px; background-color: rgba(#{color},0.2);"
"border-right: 3px solid rgba(#{color},0.4);",
'"></div>' ].join ''
markerLayer.drawTextMarker html, new Range(range.start.row,xstart, range.start.row, 1000), 'rob', config, "border: 3px solid rgba(#{color}, 0.4); position: absolute"
fillACE: ->
@ace.setValue @spell.source
@aceSession.setUndoManager(new UndoManager())

View file

@ -203,6 +203,8 @@ exports.config =
assetsmanager:
copyTo:
'lib/ace': ['node_modules/ace-builds/src-min-noconflict/*']
autoReload:
delay: 1000
modules:
definition: (path, data) ->