diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index 47b7602..5b2e7bd 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -162,6 +162,7 @@ class Dashboard extends Component { editModal: false, modalData: null, modalIndex: null, + widgetChangeData: [], maxWidgetHeight: maxHeight || null, dropZoneHeight: maxHeight +80 || null, @@ -323,12 +324,10 @@ class Dashboard extends Component { widgetChange(widget, index, callback = null){ + let tempChanges = this.state.widgetChangeData; + tempChanges.push(widget); - AppDispatcher.dispatch({ - type: 'widgets/start-edit', - token: this.state.sessionToken, - data: widget - }); + this.setState({ widgetChangeData: tempChanges}) } @@ -397,6 +396,13 @@ class Dashboard extends Component { saveEditing() { // Provide the callback so it can be called when state change is applied // TODO: Check if callback is needed + this.state.widgetChangeData.forEach( widget => { + AppDispatcher.dispatch({ + type: 'widgets/start-edit', + token: this.state.sessionToken, + data: widget + }); + }); this.setState({ editing: false }); }; @@ -414,7 +420,7 @@ class Dashboard extends Component { } cancelEditing() { - this.setState({ editing: false }); + this.setState({ editing: false, widgetChangeData: [] }); }; diff --git a/src/widget/editable-widget-container.js b/src/widget/editable-widget-container.js index 9b4c3bf..572a1ea 100644 --- a/src/widget/editable-widget-container.js +++ b/src/widget/editable-widget-container.js @@ -65,7 +65,8 @@ class EditableWidgetContainer extends React.Component { } }; - resizeStop = (direction, delta, ref, event) => { + resizeStop = (event, direction, ref,delta, position) => { + const widget = this.props.widget; // resize depends on direction