mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 08:23:57 -04:00
All ace editors must die. I found that certain editor modes will leave a mess in memory, so when editors are destroyed, I also set their modes to '' which seems to take care of most of the issue. They still leave memory behind just a little bit, though.
This commit is contained in:
commit
7a9c53e424
11 changed files with 66 additions and 97 deletions
|
@ -139,7 +139,7 @@ module.exports = class Level extends CocoModel
|
||||||
for component in thang.components or []
|
for component in thang.components or []
|
||||||
continue unless lc = _.find levelComponents, {original: component.original}
|
continue unless lc = _.find levelComponents, {original: component.original}
|
||||||
component.config ?= {}
|
component.config ?= {}
|
||||||
TreemaNode.utils.populateDefaults(component.config, lc.configSchema)
|
TreemaUtils.populateDefaults(component.config, lc.configSchema)
|
||||||
@lastType = 'component'
|
@lastType = 'component'
|
||||||
@lastOriginal = component.original
|
@lastOriginal = component.original
|
||||||
@walkDefaults component.config, lc.configSchema.properties
|
@walkDefaults component.config, lc.configSchema.properties
|
||||||
|
@ -147,7 +147,7 @@ module.exports = class Level extends CocoModel
|
||||||
fillInDefaultSystemConfiguration: (levelSystems) ->
|
fillInDefaultSystemConfiguration: (levelSystems) ->
|
||||||
for system in levelSystems ? []
|
for system in levelSystems ? []
|
||||||
system.config ?= {}
|
system.config ?= {}
|
||||||
TreemaNode.utils.populateDefaults(system.config, system.model.configSchema)
|
TreemaUtils.populateDefaults(system.config, system.model.configSchema)
|
||||||
@lastType = 'system'
|
@lastType = 'system'
|
||||||
@lastOriginal = system.model.name
|
@lastOriginal = system.model.name
|
||||||
@walkDefaults system.config, system.model.configSchema.properties
|
@walkDefaults system.config, system.model.configSchema.properties
|
||||||
|
@ -165,7 +165,7 @@ module.exports = class Level extends CocoModel
|
||||||
else if schema.type is 'array' and config[prop]
|
else if schema.type is 'array' and config[prop]
|
||||||
for item in config[prop] or []
|
for item in config[prop] or []
|
||||||
@walkDefaults item, schema.items
|
@walkDefaults item, schema.items
|
||||||
|
|
||||||
dimensions: ->
|
dimensions: ->
|
||||||
width = 0
|
width = 0
|
||||||
height = 0
|
height = 0
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
.treema-root
|
.treema-root
|
||||||
margin: 28px 0px 20px
|
margin: 28px 0px 20px
|
||||||
|
|
||||||
button
|
.achievement-tool-button
|
||||||
float: right
|
float: right
|
||||||
margin-top: 15px
|
margin-top: 15px
|
||||||
margin-left: 10px
|
margin-left: 10px
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
.treema-root
|
.treema-root
|
||||||
margin-bottom: 20px
|
margin-bottom: 20px
|
||||||
|
|
||||||
button
|
.article-tool-button
|
||||||
float: right
|
float: right
|
||||||
margin-top: 15px
|
margin-bottom: 15px
|
||||||
margin-left: 10px
|
margin-left: 10px
|
||||||
|
|
||||||
textarea
|
textarea
|
||||||
width: 92%
|
width: 92%
|
||||||
height: 300px
|
height: 300px
|
||||||
|
|
|
@ -10,9 +10,9 @@ block content
|
||||||
li.active
|
li.active
|
||||||
| #{achievement.attributes.name}
|
| #{achievement.attributes.name}
|
||||||
|
|
||||||
button(data-i18n="", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#recalculate-button Recalculate
|
button.achievement-tool-button(data-i18n="", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#recalculate-button Recalculate
|
||||||
button(data-i18n="common.delete", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#delete-button Delete
|
button.achievement-tool-button(data-i18n="common.delete", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#delete-button Delete
|
||||||
button(data-i18n="common.save", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#save-button Save
|
button.achievement-tool-button(data-i18n="common.save", disabled=me.isAdmin() === true ? undefined : "true").btn.btn-primary#save-button Save
|
||||||
|
|
||||||
h3(data-i18n="achievement.edit_achievement_title") Edit Achievement
|
h3(data-i18n="achievement.edit_achievement_title") Edit Achievement
|
||||||
span
|
span
|
||||||
|
|
|
@ -10,10 +10,10 @@ block content
|
||||||
li.active
|
li.active
|
||||||
| #{article.attributes.name}
|
| #{article.attributes.name}
|
||||||
|
|
||||||
button(data-i18n="general.version_history").btn.btn-primary#history-button Version History
|
button.article-tool-button(data-i18n="general.version_history").btn.btn-primary#history-button Version History
|
||||||
button(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true").btn.btn-primary#revert-button Revert
|
button.article-tool-button(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert", disabled=authorized === true ? undefined : "true").btn.btn-primary#revert-button Revert
|
||||||
button(data-i18n="article.edit_btn_preview", disabled=authorized === true ? undefined : "true").btn.btn-primary#preview-button Preview
|
button.article-tool-button(data-i18n="article.edit_btn_preview", disabled=authorized === true ? undefined : "true").btn.btn-primary#preview-button Preview
|
||||||
button(data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save
|
button.article-tool-button(data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save
|
||||||
|
|
||||||
h3(data-i18n="article.edit_article_title") Edit Article
|
h3(data-i18n="article.edit_article_title") Edit Article
|
||||||
span
|
span
|
||||||
|
|
|
@ -18,6 +18,13 @@ module.exports = class ScriptsTabView extends CocoView
|
||||||
super options
|
super options
|
||||||
@world = options.world
|
@world = options.world
|
||||||
@files = options.files
|
@files = options.files
|
||||||
|
$(window).on 'resize', @onWindowResize
|
||||||
|
|
||||||
|
destroy: ->
|
||||||
|
@scriptTreema?.destroy()
|
||||||
|
@scriptTreemas?.destroy()
|
||||||
|
$(window).off 'resize', @onWindowResize
|
||||||
|
super()
|
||||||
|
|
||||||
onLoaded: ->
|
onLoaded: ->
|
||||||
onLevelLoaded: (e) ->
|
onLevelLoaded: (e) ->
|
||||||
|
@ -116,10 +123,8 @@ module.exports = class ScriptsTabView extends CocoView
|
||||||
# Update in-place so existing Treema nodes refer to the same array.
|
# Update in-place so existing Treema nodes refer to the same array.
|
||||||
@thangIDs?.splice(0, @thangIDs.length, @getThangIDs()...)
|
@thangIDs?.splice(0, @thangIDs.length, @getThangIDs()...)
|
||||||
|
|
||||||
destroy: ->
|
onWindowResize: (e) =>
|
||||||
@scriptTreema?.destroy()
|
@$el.find('#scripts-treema').collapse('show') if $('body').width() > 800
|
||||||
@scriptTreemas?.destroy()
|
|
||||||
super()
|
|
||||||
|
|
||||||
class ScriptsNode extends TreemaArrayNode
|
class ScriptsNode extends TreemaArrayNode
|
||||||
nodeDescription: 'Script'
|
nodeDescription: 'Script'
|
||||||
|
@ -170,7 +175,7 @@ class EventPropsNode extends TreemaNode.nodeMap.string
|
||||||
joined = '(unset)' if not joined.length
|
joined = '(unset)' if not joined.length
|
||||||
@buildValueForDisplaySimply valEl, joined
|
@buildValueForDisplaySimply valEl, joined
|
||||||
|
|
||||||
buildValueForEditing: (valEl, data) ->
|
buildValueForEditing: (valEl, data) ->
|
||||||
super(valEl, data)
|
super(valEl, data)
|
||||||
channel = @getRoot().data.channel
|
channel = @getRoot().data.channel
|
||||||
channelSchema = Backbone.Mediator.channelSchemas[channel]
|
channelSchema = Backbone.Mediator.channelSchemas[channel]
|
||||||
|
|
|
@ -104,6 +104,8 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
$('#thangs-list').height(oldHeight - thangsHeaderHeight - 40)
|
$('#thangs-list').height(oldHeight - thangsHeaderHeight - 40)
|
||||||
else
|
else
|
||||||
$('#thangs-list').height(oldHeight - thangsHeaderHeight - 80)
|
$('#thangs-list').height(oldHeight - thangsHeaderHeight - 80)
|
||||||
|
$('#all-thangs').collapse 'show'
|
||||||
|
$('#add-thangs-column').collapse 'show'
|
||||||
|
|
||||||
undo: (e) ->
|
undo: (e) ->
|
||||||
if not @editThangView then @thangsTreema.undo() else @editThangView.undo()
|
if not @editThangView then @thangsTreema.undo() else @editThangView.undo()
|
||||||
|
@ -117,7 +119,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
$('.tab-content').mousedown @selectAddThang
|
$('.tab-content').mousedown @selectAddThang
|
||||||
$('#thangs-list').bind 'mousewheel', @preventBodyScrollingInThangList
|
$('#thangs-list').bind 'mousewheel', @preventBodyScrollingInThangList
|
||||||
@$el.find('#extant-thangs-filter button:first').button('toggle')
|
@$el.find('#extant-thangs-filter button:first').button('toggle')
|
||||||
$(window).resize @onWindowResize
|
$(window).on 'resize', @onWindowResize
|
||||||
@addThangsView = @insertSubView new AddThangsView world: @world
|
@addThangsView = @insertSubView new AddThangsView world: @world
|
||||||
@buildInterface() # refactor to not have this trigger when this view re-renders?
|
@buildInterface() # refactor to not have this trigger when this view re-renders?
|
||||||
if @thangsTreema.data.length
|
if @thangsTreema.data.length
|
||||||
|
@ -182,6 +184,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
destroy: ->
|
destroy: ->
|
||||||
@selectAddThangType null
|
@selectAddThangType null
|
||||||
@surface.destroy()
|
@surface.destroy()
|
||||||
|
$(window).off 'resize', @onWindowResize
|
||||||
$(document).unbind 'contextmenu', @preventDefaultContextMenu
|
$(document).unbind 'contextmenu', @preventDefaultContextMenu
|
||||||
@thangsTreema?.destroy()
|
@thangsTreema?.destroy()
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -59,6 +59,10 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
@updateFileSize()
|
@updateFileSize()
|
||||||
@refreshAnimation = _.debounce @refreshAnimation, 500
|
@refreshAnimation = _.debounce @refreshAnimation, 500
|
||||||
|
|
||||||
|
showLoading: ($el) ->
|
||||||
|
$el ?= @$el.find('.outer-content')
|
||||||
|
super($el)
|
||||||
|
|
||||||
getRenderData: (context={}) ->
|
getRenderData: (context={}) ->
|
||||||
context = super(context)
|
context = super(context)
|
||||||
context.thangType = @thangType
|
context.thangType = @thangType
|
||||||
|
|
|
@ -84,7 +84,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
@isEditorPreview = @getQueryVariable 'dev'
|
@isEditorPreview = @getQueryVariable 'dev'
|
||||||
@sessionID = @getQueryVariable 'session'
|
@sessionID = @getQueryVariable 'session'
|
||||||
|
|
||||||
$(window).on('resize', @onWindowResize)
|
$(window).on 'resize', @onWindowResize
|
||||||
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
||||||
|
|
||||||
if @isEditorPreview
|
if @isEditorPreview
|
||||||
|
@ -536,6 +536,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
@god?.destroy()
|
@god?.destroy()
|
||||||
@goalManager?.destroy()
|
@goalManager?.destroy()
|
||||||
@scriptManager?.destroy()
|
@scriptManager?.destroy()
|
||||||
|
$(window).off 'resize', @onWindowResize
|
||||||
delete window.world # not sure where this is set, but this is one way to clean it up
|
delete window.world # not sure where this is set, but this is one way to clean it up
|
||||||
clearInterval(@pointerInterval)
|
clearInterval(@pointerInterval)
|
||||||
@bus?.destroy()
|
@bus?.destroy()
|
||||||
|
|
|
@ -42,6 +42,7 @@ Worker::removeEventListener = (what) ->
|
||||||
if what is 'message'
|
if what is 'message'
|
||||||
@onmessage = -> #This webworker api has only one event listener at a time.
|
@onmessage = -> #This webworker api has only one event listener at a time.
|
||||||
GLOBAL.tv4 = require('tv4').tv4
|
GLOBAL.tv4 = require('tv4').tv4
|
||||||
|
GLOBAL.TreemaUtils = require './bower_components/treema/treema-utils.js'
|
||||||
GLOBAL.marked = setOptions: ->
|
GLOBAL.marked = setOptions: ->
|
||||||
store = {}
|
store = {}
|
||||||
GLOBAL.localStorage =
|
GLOBAL.localStorage =
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue