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