Skip to content

Commit

Permalink
Merge pull request #329 from open-sausages/pulls/4.0/fix-uploadfield-…
Browse files Browse the repository at this point in the history
…errors

BUG Fix JS errors in UploadField.js and InsertMediaModal.js
  • Loading branch information
dhensby authored Dec 16, 2016
2 parents 7b3f763 + 8cef515 commit 2d1b572
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
11 changes: 6 additions & 5 deletions client/dist/js/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@
}

.gallery__table-image--error:after{
content:'Q';
content:"Q";
line-height:68px;
font-size:30px;
display:inline;
Expand Down
5 changes: 4 additions & 1 deletion client/src/containers/InsertMediaModal/InsertMediaModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class InsertMediaModal extends Component {
setOverrides(props) {
if (!props || this.props.schemaUrl !== props.schemaUrl) {
// clear any overrides that may be in place
this.props.actions.schema.setSchemaStateOverrides(props.schemaUrl, null);
const schemaUrl = props && props.schemaUrl || this.props.schemaUrl;
if (schemaUrl) {
this.props.actions.schema.setSchemaStateOverrides(schemaUrl, null);
}
}
if (props && props.schemaUrl) {
const attrs = Object.assign({}, props.fileAttributes);
Expand Down
1 change: 1 addition & 0 deletions code/Forms/UploadField.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function getSchemaStateDefaults()
{
$state = parent::getSchemaStateDefaults();
$state['data']['files'] = $this->getEncodedItems();
$state['value'] = $this->Value() ?: [ 'Files' => []];
return $state;
}

Expand Down

0 comments on commit 2d1b572

Please sign in to comment.