Skip to content

Commit

Permalink
Sidebar should be reinitialized on every alt check.
Browse files Browse the repository at this point in the history
Otherwise it breaks during the upload process.

See #107, #118.
  • Loading branch information
boonebgorges committed May 4, 2018
1 parent bf13d5c commit 228c62d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40022,9 +40022,9 @@ const mapDispatchToProps = (dispatch, ownProps) => {

frame.views.ready = function () {
const toolbarView = frame.views.get('.media-frame-toolbar')[0];
const sidebar = frame.views.get('.media-frame-content')[0].sidebar;
const modal = frame.modal;
const library = frame.library;
let sidebar;

toolbarView.controller.on('select', function () {
var selected = frame.state().get('selection');
Expand Down Expand Up @@ -40056,7 +40056,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
const warning = '<p id="alt-tag-warning" class="alt-tag-warning">You must supply alt text before inserting this image.</p>';
toolbarView.$el.find('#alt-tag-warning').remove();
toolbarView.$el.find('.media-toolbar-primary').append(warning);
console.log(sidebar);
sidebar = frame.views.get('.media-frame-content')[0].sidebar;
sidebar.$el.find('label.setting[data-setting="alt"]').addClass('has-error');
}
});
Expand Down
2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/containers/UploaderContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const mapDispatchToProps = (dispatch, ownProps) => {

frame.views.ready = function() {
const toolbarView = frame.views.get('.media-frame-toolbar')[0]
const sidebar = frame.views.get('.media-frame-content')[0].sidebar
const modal = frame.modal
const library = frame.library
let sidebar

toolbarView.controller.on('select',function() {
var selected = frame.state().get('selection')
Expand Down Expand Up @@ -88,7 +88,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
const warning = '<p id="alt-tag-warning" class="alt-tag-warning">You must supply alt text before inserting this image.</p>'
toolbarView.$el.find('#alt-tag-warning').remove()
toolbarView.$el.find('.media-toolbar-primary').append(warning)
console.log(sidebar);
sidebar = frame.views.get('.media-frame-content')[0].sidebar
sidebar.$el.find('label.setting[data-setting="alt"]').addClass('has-error')
}
})
Expand Down

0 comments on commit 228c62d

Please sign in to comment.