Add support for copy and move operations (#1111)
This commit is contained in:
parent
96e68be0fa
commit
cd82fe8aac
18
dev/build.js
18
dev/build.js
@ -122,6 +122,24 @@ function applyModifications(manifest, modifications) {
|
|||||||
value.splice(start, deleteCount, ...itemsNew);
|
value.splice(start, deleteCount, ...itemsNew);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'copy':
|
||||||
|
{
|
||||||
|
const {newPath} = modification;
|
||||||
|
const value = getObjectProperties(manifest, path2, path2.length);
|
||||||
|
const newObject = getObjectProperties(manifest, newPath, newPath.length - 1);
|
||||||
|
newObject[newPath[newPath.length - 1]] = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'move':
|
||||||
|
{
|
||||||
|
const {newPath} = modification;
|
||||||
|
const value = getObjectProperties(manifest, path2, path2.length);
|
||||||
|
const oldObject = getObjectProperties(manifest, path2, path2.length - 1);
|
||||||
|
const newObject = getObjectProperties(manifest, newPath, newPath.length - 1);
|
||||||
|
newObject[newPath[newPath.length - 1]] = value;
|
||||||
|
delete oldObject[path2[path2.length - 1]];
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user