Only fetch images in edit mode

This commit is contained in:
Andrew Miner
2015-06-11 13:06:12 -07:00
parent 1ed4a92700
commit f5cc4fe98a
2 changed files with 7 additions and 3 deletions
@@ -24,6 +24,9 @@ module.exports = class MarkdownImageListController extends BaseController
# Public Methods ###############################################################################
fetchImages: ->
@model.fetchImages()
getImageUrlForFile: (fileName)->
@model.getFile(fileName).imageUrl
@@ -68,8 +71,6 @@ module.exports = class MarkdownImageListController extends BaseController
super
refresh: ->
@model.fetchImages()
@_controllers ?= []
index = 0
@@ -144,7 +144,7 @@ module.exports = class MarkdownSectionController extends BaseController
logger.verbose => "MarkdownSectionController.#{@cid} changed state from #{oldState} to #{newState}"
@trigger Event.change + ':state', this, oldState, newState
@_updateStateVisibility()
@tryRefresh()
Object.defineProperties @prototype,
editable: { get:@prototype.isEditable }
@@ -176,10 +176,13 @@ module.exports = class MarkdownSectionController extends BaseController
refresh: ->
@$title.html @title
@_imageListController.markdownText = @model
@_imageListController.fetchImages() if @state is State.editing
@_updateButtonStates()
@_updateSizer()
@_updatePreview()
@_updateStateVisibility()
super
onWillChangeModel: (oldModel, newModel)->