Added separate return element ids to dialogs

This commit is contained in:
Stefan Zermatten
2019-01-24 15:11:42 +02:00
parent 2e6ef52594
commit 8c0edfaa93
2 changed files with 10 additions and 4 deletions

View File

@@ -20,6 +20,7 @@
:key="dialog._id"
class="dialog"
:data-element-id="dialog.elementId"
:data-return-element-id="dialog.returnElementId"
:data-index="index"
:style="getDialogStyle(index)"
:elevation="6"
@@ -94,8 +95,13 @@
});
},
leave(target, done){
let elementId = target.attributes['data-element-id'].value;
let source = document.getElementById(elementId);
let elementId;
if (target.attributes['data-return-element-id']) {
elementId = target.attributes['data-return-element-id'].value;
} else {
elementId = target.attributes['data-element-id'].value;
}
let source = document.getElementById(elementId);
let index = target.attributes['data-index'].value;
if (index != 0){
// If we aren't the only dialog, we'll need compensate for offset

View File

@@ -7,7 +7,7 @@ const dialogStackStore = {
currentResult: null,
},
mutations: {
pushDialogStack(state, {component, data, elementId, returnElement, callback}){
pushDialogStack(state, {component, data, elementId, returnElementId, callback}){
// Generate a new _id so that Vue knows how to shuffle the array
const _id = Random.id();
state.dialogs.push({
@@ -15,7 +15,7 @@ const dialogStackStore = {
component,
data,
elementId,
returnElement,
returnElementId,
callback,
});
updateHistory();