feat: Moving documents via drag and drop in sidebar (#1717)

* wip: added some basic drag and drop UI for combining items

* refactor: pathToDocument to accept only id

* fix: Multiple drop backends error
fix: Incorrect styling dragging over active collection
fix: Stay in disabled state until save is complete

* Improving display while moving doc

* fix: update by user should be changed when moving a doc

* add move guard to drag

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Nan Yu
2020-12-15 19:07:29 -08:00
committed by GitHub
parent 3469b82beb
commit 051ecab0fc
12 changed files with 285 additions and 166 deletions

View File

@ -28,6 +28,8 @@ export default async function documentMover({
document.collectionId = collectionId;
document.parentDocumentId = null;
document.lastModifiedById = user.id;
document.updatedBy = user;
await document.save();
result.documents.push(document);
@ -54,6 +56,8 @@ export default async function documentMover({
// add to new collection (may be the same)
document.collectionId = collectionId;
document.parentDocumentId = parentDocumentId;
document.lastModifiedById = user.id;
document.updatedBy = user;
const newCollection: Collection = collectionChanged
? await Collection.findByPk(collectionId, { transaction })