From 4e1415774da9955bb277b9aefe5ecdaa2cd7ae24 Mon Sep 17 00:00:00 2001 From: Alexey Kostenko Date: Mon, 21 Sep 2020 11:06:53 +0300 Subject: [PATCH] Web: Client: Opening the file immediately after creation --- .../components/pages/Home/Section/Body/FilesRowContent.js | 5 ++++- products/ASC.Files/Client/src/store/files/actions.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js index 20658dc65d..8285f1302a 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js @@ -113,7 +113,10 @@ class FilesRowContent extends React.PureComponent { ? createFolder(item.parentId, itemTitle) .then(() => this.completeAction(e)).finally(() => setIsLoading(false)) : createFile(item.parentId, `${itemTitle}.${item.fileExst}`) - .then(() => this.completeAction(e)).finally(() => setIsLoading(false)) + .then((file) => { + window.open(file.webUrl, "_blank") + this.completeAction(e) + }).finally(() => setIsLoading(false)) } componentDidUpdate(prevProps) { diff --git a/products/ASC.Files/Client/src/store/files/actions.js b/products/ASC.Files/Client/src/store/files/actions.js index e53b403215..a23b7f3ff8 100644 --- a/products/ASC.Files/Client/src/store/files/actions.js +++ b/products/ASC.Files/Client/src/store/files/actions.js @@ -375,8 +375,9 @@ export function fetchTreeFolders(dispatch) { export function createFile(folderId, title) { return dispatch => { return files.createFile(folderId, title) - .then(folder => { + .then(file => { fetchFolder(folderId, dispatch); + return Promise.resolve(file) }); }; }