Only fetch images in edit mode
This commit is contained in:
@@ -24,6 +24,9 @@ module.exports = class MarkdownImageListController extends BaseController
|
|||||||
|
|
||||||
# Public Methods ###############################################################################
|
# Public Methods ###############################################################################
|
||||||
|
|
||||||
|
fetchImages: ->
|
||||||
|
@model.fetchImages()
|
||||||
|
|
||||||
getImageUrlForFile: (fileName)->
|
getImageUrlForFile: (fileName)->
|
||||||
@model.getFile(fileName).imageUrl
|
@model.getFile(fileName).imageUrl
|
||||||
|
|
||||||
@@ -68,8 +71,6 @@ module.exports = class MarkdownImageListController extends BaseController
|
|||||||
super
|
super
|
||||||
|
|
||||||
refresh: ->
|
refresh: ->
|
||||||
@model.fetchImages()
|
|
||||||
|
|
||||||
@_controllers ?= []
|
@_controllers ?= []
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ module.exports = class MarkdownSectionController extends BaseController
|
|||||||
|
|
||||||
logger.verbose => "MarkdownSectionController.#{@cid} changed state from #{oldState} to #{newState}"
|
logger.verbose => "MarkdownSectionController.#{@cid} changed state from #{oldState} to #{newState}"
|
||||||
@trigger Event.change + ':state', this, oldState, newState
|
@trigger Event.change + ':state', this, oldState, newState
|
||||||
@_updateStateVisibility()
|
@tryRefresh()
|
||||||
|
|
||||||
Object.defineProperties @prototype,
|
Object.defineProperties @prototype,
|
||||||
editable: { get:@prototype.isEditable }
|
editable: { get:@prototype.isEditable }
|
||||||
@@ -176,10 +176,13 @@ module.exports = class MarkdownSectionController extends BaseController
|
|||||||
refresh: ->
|
refresh: ->
|
||||||
@$title.html @title
|
@$title.html @title
|
||||||
@_imageListController.markdownText = @model
|
@_imageListController.markdownText = @model
|
||||||
|
@_imageListController.fetchImages() if @state is State.editing
|
||||||
|
|
||||||
@_updateButtonStates()
|
@_updateButtonStates()
|
||||||
@_updateSizer()
|
@_updateSizer()
|
||||||
@_updatePreview()
|
@_updatePreview()
|
||||||
|
@_updateStateVisibility()
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
onWillChangeModel: (oldModel, newModel)->
|
onWillChangeModel: (oldModel, newModel)->
|
||||||
|
|||||||
Reference in New Issue
Block a user