Merge pull request #2810 from nasa/toolbar-fixes-32720

[Toolbar] fix errors when navigated away from a layout that uses toolbar
This commit is contained in:
David Tsay 2020-03-30 11:13:17 -07:00 committed by GitHub
commit a5326a7b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -520,6 +520,10 @@ define(['lodash'], function (_) {
let selectedParent = selectionPath[1].context.item;
let layoutItem = selectionPath[0].context.layoutItem;
if (!layoutItem) {
return;
}
if (layoutItem.type === 'subobject-view') {
if (toolbar['add-menu'].length === 0 && selectionPath[0].context.item.type === 'layout') {
toolbar['add-menu'] = [getAddButton(selectedObjects, selectionPath)];

View File

@ -85,7 +85,13 @@ export default {
return;
}
let format = selection[0][0].context.layoutItem.format;
let layoutItem = selection[0][0].context.layoutItem;
if (!layoutItem) {
return;
}
let format = layoutItem.format;
this.nonMixedFormat = selection.every(selectionPath => {
return selectionPath[0].context.layoutItem.format === format;
});

View File

@ -155,7 +155,7 @@ export default {
return this.composition.load();
},
getSelectionContext() {
if (this.currentView.getSelectionContext) {
if (this.currentView && this.currentView.getSelectionContext) {
return this.currentView.getSelectionContext();
} else {
return { item: this.currentObject };