From c6ccfbe44fd82ca92201360683a21a6ee638e4cb Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 09:51:56 +0300 Subject: [PATCH 01/11] Web: Editor: Added recent files. --- web/ASC.Web.Editor/src/Editor.jsx | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 2ac236f8cce..50f266a33dd 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -19,6 +19,8 @@ import { setEncryptionKeys, getEncryptionAccess, getFileInfo, + getRecentFolderList, + getFolderInfo, } from "@appserver/common/api/files"; import { checkIsAuthenticated } from "@appserver/common/api/user"; import { getUser } from "@appserver/common/api/people"; @@ -150,6 +152,55 @@ const Editor = () => { i18n.t ); } + //console.log("config.document.info", config, "fileInfo", fileInfo); + + if (fileInfo) { + const recentFolderList = await getRecentFolderList(); + + let recentFilesArray = []; + + const filesArray = recentFolderList.files; + + for (let i = 0; i < filesArray.length; i++) { + if (config.documentType === "text" && filesArray[i].fileType === 7) { + const folderInfo = await getFolderInfo(filesArray[i].folderId); + + const convertedData = convertRecentData(filesArray[i], folderInfo); + + if (Object.keys(convertedData).length !== 0) + recentFilesArray.push(convertedData); + } + + if ( + config.documentType === "spreadsheet" && + filesArray[i].fileType === 5 + ) { + const folderInfo = await getFolderInfo(filesArray[i].folderId); + + const convertedData = convertRecentData(filesArray[i], folderInfo); + + if (Object.keys(convertedData).length !== 0) + recentFilesArray.push(convertedData); + } + + if ( + config.documentType === "presentation" && + filesArray[i].fileType === 6 + ) { + const folderInfo = await getFolderInfo(filesArray[i].folderId); + + const convertedData = convertRecentData(filesArray[i], folderInfo); + + if (Object.keys(convertedData).length !== 0) + recentFilesArray.push(convertedData); + } + } + + config.editorConfig = { + ...config.editorConfig, + recent: recentFilesArray, + }; + } if ( config && @@ -178,6 +229,20 @@ const Editor = () => { } }; + const convertRecentData = (file, folder) => { + let obj = {}; + const folderName = folder.title; + const fileName = file.title; + const url = file.webUrl; + if (fileInfo.id !== file.id) + obj = { + folder: folderName, + title: fileName, + url: url, + }; + return obj; + }; + const isIPad = () => { return isIOS && deviceType === "tablet"; }; From d24f5185f9f7ba8055633d82d3e43fb66aa7e2c3 Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 10:36:21 +0300 Subject: [PATCH 02/11] Web: Editor: Added rename option. --- web/ASC.Web.Editor/src/Editor.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 50f266a33dd..d8bbf3fcbb3 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -21,6 +21,7 @@ import { getFileInfo, getRecentFolderList, getFolderInfo, + updateFile, } from "@appserver/common/api/files"; import { checkIsAuthenticated } from "@appserver/common/api/user"; import { getUser } from "@appserver/common/api/people"; @@ -345,6 +346,7 @@ const Editor = () => { }; let onRequestSharingSettings; + let onRequestRename; if ( fileInfo && @@ -352,6 +354,7 @@ const Editor = () => { config.document.permissions.modifyFilter ) { onRequestSharingSettings = onSDKRequestSharingSettings; + onRequestRename = onSDKRequestRename; } const events = { @@ -364,6 +367,7 @@ const Editor = () => { onWarning: onSDKWarning, onError: onSDKError, onRequestSharingSettings, + onRequestRename, }, }; @@ -394,6 +398,11 @@ const Editor = () => { setIsVisible(true); }; + const onSDKRequestRename = (event) => { + const title = event.data; + updateFile(fileInfo.id, title); + }; + const onCancel = () => { setIsVisible(false); }; From eddb323ff66bedaadd741c173ac591ada4889688 Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 15:47:08 +0300 Subject: [PATCH 03/11] Web: Editor/Files: Added create new file option. --- .../ASC.Files/Client/src/HOCs/withContent.js | 34 +++++----- products/ASC.Files/Client/src/helpers/i18n.js | 35 +++++++++++ .../ASC.Files/Client/src/helpers/utils.js | 62 ++++++++++++++++++- .../ASC.Files/Client/src/store/FilesStore.js | 30 +-------- products/ASC.Files/Client/webpack.config.js | 1 + web/ASC.Web.Editor/src/Editor.jsx | 22 ++++++- 6 files changed, 137 insertions(+), 47 deletions(-) create mode 100644 products/ASC.Files/Client/src/helpers/i18n.js diff --git a/products/ASC.Files/Client/src/HOCs/withContent.js b/products/ASC.Files/Client/src/HOCs/withContent.js index d6d5b05a9e4..247bac5134a 100644 --- a/products/ASC.Files/Client/src/HOCs/withContent.js +++ b/products/ASC.Files/Client/src/HOCs/withContent.js @@ -14,7 +14,7 @@ import { combineUrl } from "@appserver/common/utils"; import config from "../../package.json"; import EditingWrapperComponent from "../components/EditingWrapperComponent"; import { getTitleWithoutExst } from "../helpers/files-helpers"; - +import { getDefaultFileName } from "../helpers/utils"; export default function withContent(WrappedContent) { class WithContent extends React.Component { constructor(props) { @@ -23,7 +23,7 @@ export default function withContent(WrappedContent) { const { item, fileActionId, fileActionExt } = props; let titleWithoutExt = getTitleWithoutExst(item); if (fileActionId === -1 && item.id === fileActionId) { - titleWithoutExt = this.getDefaultName(fileActionExt); + titleWithoutExt = getDefaultFileName(fileActionExt); } this.state = { itemTitle: titleWithoutExt }; @@ -32,25 +32,25 @@ export default function withContent(WrappedContent) { componentDidUpdate(prevProps) { const { fileActionId, fileActionExt } = this.props; if (fileActionId === -1 && fileActionExt !== prevProps.fileActionExt) { - const itemTitle = this.getDefaultName(fileActionExt); + const itemTitle = getDefaultFileName(fileActionExt); this.setState({ itemTitle }); } } - getDefaultName = (format) => { - const { t } = this.props; - - switch (format) { - case "docx": - return t("NewDocument"); - case "xlsx": - return t("NewSpreadsheet"); - case "pptx": - return t("NewPresentation"); - default: - return t("NewFolder"); - } - }; + // getDefaultName = (format) => { + // const { t } = this.props; + + // switch (format) { + // case "docx": + // return t("NewDocument"); + // case "xlsx": + // return t("NewSpreadsheet"); + // case "pptx": + // return t("NewPresentation"); + // default: + // return t("NewFolder"); + // } + // }; completeAction = (id) => { const { editCompleteAction, item } = this.props; diff --git a/products/ASC.Files/Client/src/helpers/i18n.js b/products/ASC.Files/Client/src/helpers/i18n.js new file mode 100644 index 00000000000..46b2ed7fbdc --- /dev/null +++ b/products/ASC.Files/Client/src/helpers/i18n.js @@ -0,0 +1,35 @@ +import i18n from "i18next"; +import Backend from "i18next-http-backend"; +import { LANGUAGE } from "@appserver/common/constants"; +import config from "../../package.json"; +import { loadLanguagePath } from "@appserver/common/utils"; + +const newInstance = i18n.createInstance(); + +newInstance.use(Backend).init({ + lng: localStorage.getItem(LANGUAGE) || "en", + fallbackLng: "en", + load: "all", + //debug: true, + + interpolation: { + escapeValue: false, // not needed for react as it escapes by default + format: function (value, format) { + if (format === "lowercase") return value.toLowerCase(); + return value; + }, + }, + + backend: { + loadPath: loadLanguagePath(config.homepage), + }, + + ns: ["Home"], + defaultNS: "Home", + + react: { + useSuspense: false, + }, +}); + +export default newInstance; diff --git a/products/ASC.Files/Client/src/helpers/utils.js b/products/ASC.Files/Client/src/helpers/utils.js index 87297ec64ce..ed9284c8468 100644 --- a/products/ASC.Files/Client/src/helpers/utils.js +++ b/products/ASC.Files/Client/src/helpers/utils.js @@ -1,5 +1,12 @@ import authStore from "@appserver/common/store/AuthStore"; - +import { AppServerConfig } from "@appserver/common/constants"; +import config from "../../package.json"; +import { combineUrl } from "@appserver/common/utils"; +import { + addFileToRecentlyViewed, + createFile, +} from "@appserver/common/api/files"; +import i18n from "./i18n"; export const setDocumentTitle = (subTitle = null) => { const { isAuthenticated, settingsStore, product: currentModule } = authStore; const { organizationName } = settingsStore; @@ -19,3 +26,56 @@ export const setDocumentTitle = (subTitle = null) => { document.title = title; }; + +export const getDefaultFileName = (format) => { + switch (format) { + case "docx": + return i18n.t("NewDocument"); + case "xlsx": + return i18n.t("NewSpreadsheet"); + case "pptx": + return i18n.t("NewPresentation"); + default: + return i18n.t("NewFolder"); + } +}; + +export const createNewFile = async (folderId, fileName, open = true) => { + const file = await createFile(folderId, fileName); + + open && (await openDocEditor(file.id)); + + return file; +}; + +export const addFileToRecent = async (fileId) => { + try { + await addFileToRecentlyViewed(fileId); + console.log("Pushed to recently viewed"); + } catch (e) { + console.error(e); + } +}; +export const openDocEditor = async ( + id, + providerKey = null, + tab = null, + url = null +) => { + if (!providerKey) { + await addFileToRecent(id); + } + + return Promise.resolve( + tab + ? (tab.location = url) + : window.open( + combineUrl( + AppServerConfig.proxyURL, + config.homepage, + `/doceditor?fileId=${id}` + ), + "_blank" + ) + ); +}; diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 6f43ac7d63d..e2283ee67e3 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -15,6 +15,7 @@ import { combineUrl } from "@appserver/common/utils"; import { updateTempContent } from "@appserver/common/utils"; import { thumbnailStatuses } from "../helpers/constants"; import { isMobile } from "react-device-detect"; +import { openDocEditor } from "../helpers/utils"; const { FilesFilter } = api; @@ -1361,34 +1362,7 @@ class FilesStore { }; openDocEditor = (id, providerKey = null, tab = null, url = null) => { - if (providerKey) { - tab - ? (tab.location = url) - : window.open( - combineUrl( - AppServerConfig.proxyURL, - config.homepage, - `/doceditor?fileId=${id}` - ), - "_blank" - ); - } else { - return this.addFileToRecentlyViewed(id) - .then(() => console.log("Pushed to recently viewed")) - .catch((e) => console.error(e)) - .finally( - tab - ? (tab.location = url) - : window.open( - combineUrl( - AppServerConfig.proxyURL, - config.homepage, - `/doceditor?fileId=${id}` - ), - "_blank" - ) - ); - } + return openDocEditor(id, providerKey, tab, url); }; createThumbnails = () => { diff --git a/products/ASC.Files/Client/webpack.config.js b/products/ASC.Files/Client/webpack.config.js index ea526ce3b2d..bdcca70570c 100644 --- a/products/ASC.Files/Client/webpack.config.js +++ b/products/ASC.Files/Client/webpack.config.js @@ -146,6 +146,7 @@ var config = { exposes: { "./app": "./src/Files.jsx", "./SharingDialog": "./src/components/panels/SharingDialog", + "./utils": "./src/helpers/utils.js", }, shared: { ...deps, diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index d8bbf3fcbb3..bfcebffc7d0 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -33,7 +33,7 @@ import { homepage } from "../package.json"; import { AppServerConfig } from "@appserver/common/constants"; import SharingDialog from "files/SharingDialog"; - +import { createNewFile, getDefaultFileName } from "files/utils"; import i18n from "./i18n"; let documentIsReady = false; @@ -347,6 +347,7 @@ const Editor = () => { let onRequestSharingSettings; let onRequestRename; + let onRequestCreateNew; if ( fileInfo && @@ -357,6 +358,10 @@ const Editor = () => { onRequestRename = onSDKRequestRename; } + if (fileInfo) { + onRequestCreateNew = onSDKRequestCreateNew; + } + const events = { events: { onAppReady: onSDKAppReady, @@ -368,6 +373,7 @@ const Editor = () => { onError: onSDKError, onRequestSharingSettings, onRequestRename, + onRequestCreateNew, }, }; @@ -398,6 +404,20 @@ const Editor = () => { setIsVisible(true); }; + const onSDKRequestCreateNew = () => { + const documentType = config.documentType; + const fileExst = + documentType === "text" + ? "docx" + : documentType === "presentation" + ? "pptx" + : "xlsx"; + + const defaultFileName = getDefaultFileName(fileExst); + + createNewFile(fileInfo.folderId, `${defaultFileName}.${fileExst}`); + }; + const onSDKRequestRename = (event) => { const title = event.data; updateFile(fileInfo.id, title); From 8ac333f380e24d9bf527e372b3cd523c59128f34 Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 16:00:30 +0300 Subject: [PATCH 04/11] WEb: Editor: Deleted share folder from recent list. --- web/ASC.Web.Editor/src/Editor.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index bfcebffc7d0..6de14a6e047 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -35,7 +35,7 @@ import { AppServerConfig } from "@appserver/common/constants"; import SharingDialog from "files/SharingDialog"; import { createNewFile, getDefaultFileName } from "files/utils"; import i18n from "./i18n"; - +import { FolderType } from "@appserver/common/constants"; let documentIsReady = false; let docTitle = null; @@ -163,7 +163,11 @@ const Editor = () => { const filesArray = recentFolderList.files; for (let i = 0; i < filesArray.length; i++) { - if (config.documentType === "text" && filesArray[i].fileType === 7) { + if ( + config.documentType === "text" && + filesArray[i].fileType === 7 && + filesArray[i].rootFolderType !== FolderType.SHARE + ) { const folderInfo = await getFolderInfo(filesArray[i].folderId); const convertedData = convertRecentData(filesArray[i], folderInfo); @@ -174,7 +178,8 @@ const Editor = () => { if ( config.documentType === "spreadsheet" && - filesArray[i].fileType === 5 + filesArray[i].fileType === 5 && + filesArray[i].rootFolderType !== FolderType.SHARE ) { const folderInfo = await getFolderInfo(filesArray[i].folderId); @@ -186,7 +191,8 @@ const Editor = () => { if ( config.documentType === "presentation" && - filesArray[i].fileType === 6 + filesArray[i].fileType === 6 && + filesArray[i].rootFolderType !== FolderType.SHARE ) { const folderInfo = await getFolderInfo(filesArray[i].folderId); From bef7cdd0b81276796b3f772a5783d2e9aa7a75ee Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 18:55:59 +0300 Subject: [PATCH 05/11] Web: Editor: Added possibility to add files to favorites and to delete from favorites. --- web/ASC.Web.Editor/src/Editor.jsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 6de14a6e047..6c1dad849f9 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -22,6 +22,8 @@ import { getRecentFolderList, getFolderInfo, updateFile, + removeFromFavorite, + markAsFavorite, } from "@appserver/common/api/files"; import { checkIsAuthenticated } from "@appserver/common/api/user"; import { getUser } from "@appserver/common/api/people"; @@ -78,6 +80,10 @@ const Editor = () => { }); }; + const updateFavorite = (favorite) => { + docEditor.setFavorite(favorite); + }; + const init = async () => { try { if (!fileId) return; @@ -464,10 +470,21 @@ const Editor = () => { const onMetaChange = (event) => { const newTitle = event.data.title; + const favorite = event.data.favorite; + if (newTitle && newTitle !== docTitle) { setDocumentTitle(newTitle); docTitle = newTitle; } + + if (!newTitle) + favorite + ? markAsFavorite([+fileId]) + .then(() => updateFavorite(favorite)) + .catch((error) => console.log("error", error)) + : removeFromFavorite([+fileId]) + .then(() => updateFavorite(favorite)) + .catch((error) => console.log("error", error)); }; return ( From 455c1cb2a3ade94cb0cbf7594ed4d8408124c91f Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Tue, 27 Jul 2021 19:05:18 +0300 Subject: [PATCH 06/11] Web: Editor: Added constants for type of document. --- web/ASC.Web.Editor/src/Editor.jsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 6c1dad849f9..f0974efd038 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -40,6 +40,10 @@ import i18n from "./i18n"; import { FolderType } from "@appserver/common/constants"; let documentIsReady = false; +const text = "text"; +const spreadSheet = "spreadsheet"; +const presentation = "presentation"; + let docTitle = null; let fileType = null; let config; @@ -170,7 +174,7 @@ const Editor = () => { for (let i = 0; i < filesArray.length; i++) { if ( - config.documentType === "text" && + config.documentType === text && filesArray[i].fileType === 7 && filesArray[i].rootFolderType !== FolderType.SHARE ) { @@ -183,7 +187,7 @@ const Editor = () => { } if ( - config.documentType === "spreadsheet" && + config.documentType === spreadSheet && filesArray[i].fileType === 5 && filesArray[i].rootFolderType !== FolderType.SHARE ) { @@ -196,7 +200,7 @@ const Editor = () => { } if ( - config.documentType === "presentation" && + config.documentType === presentation && filesArray[i].fileType === 6 && filesArray[i].rootFolderType !== FolderType.SHARE ) { @@ -419,9 +423,9 @@ const Editor = () => { const onSDKRequestCreateNew = () => { const documentType = config.documentType; const fileExst = - documentType === "text" + documentType === text ? "docx" - : documentType === "presentation" + : documentType === presentation ? "pptx" : "xlsx"; From 2a8052bc51525ce164a4ea8d2701fcddf0b1562e Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 28 Jul 2021 11:02:44 +0300 Subject: [PATCH 07/11] Web: Editor: Fixed display by users access rights. --- web/ASC.Web.Editor/src/Editor.jsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index f0974efd038..3ef6424182c 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -24,6 +24,7 @@ import { updateFile, removeFromFavorite, markAsFavorite, + createTextFileInMy, } from "@appserver/common/api/files"; import { checkIsAuthenticated } from "@appserver/common/api/user"; import { getUser } from "@appserver/common/api/people"; @@ -35,7 +36,7 @@ import { homepage } from "../package.json"; import { AppServerConfig } from "@appserver/common/constants"; import SharingDialog from "files/SharingDialog"; -import { createNewFile, getDefaultFileName } from "files/utils"; +import { createNewFile, getDefaultFileName, openDocEditor } from "files/utils"; import i18n from "./i18n"; import { FolderType } from "@appserver/common/constants"; let documentIsReady = false; @@ -50,6 +51,7 @@ let config; let docSaved = null; let docEditor; let fileInfo; +let successAuth; const url = window.location.href; const filesUrl = url.substring(0, url.indexOf("/doceditor")); @@ -104,9 +106,9 @@ const Editor = () => { //showLoader(); const docApiUrl = await getDocServiceUrl(); - const success = await checkIsAuthenticated(); + successAuth = await checkIsAuthenticated(); - if (!doc && !success) { + if (!doc && !successAuth) { window.open( combineUrl(AppServerConfig.proxyURL, "/login"), "_self", @@ -116,14 +118,14 @@ const Editor = () => { return; } - if (success) { + if (successAuth) { try { fileInfo = await getFileInfo(fileId); } catch (err) { console.error(err); } - setIsAuthenticated(success); + setIsAuthenticated(successAuth); } config = await openEdit(fileId, version, doc); @@ -163,9 +165,8 @@ const Editor = () => { i18n.t ); } - //console.log("config.document.info", config, "fileInfo", fileInfo); - if (fileInfo) { + if (successAuth) { const recentFolderList = await getRecentFolderList(); let recentFilesArray = []; @@ -251,7 +252,7 @@ const Editor = () => { const folderName = folder.title; const fileName = file.title; const url = file.webUrl; - if (fileInfo.id !== file.id) + if (fileId !== file.id) obj = { folder: folderName, title: fileName, @@ -374,7 +375,7 @@ const Editor = () => { onRequestRename = onSDKRequestRename; } - if (fileInfo) { + if (successAuth) { onRequestCreateNew = onSDKRequestCreateNew; } @@ -431,7 +432,11 @@ const Editor = () => { const defaultFileName = getDefaultFileName(fileExst); - createNewFile(fileInfo.folderId, `${defaultFileName}.${fileExst}`); + fileInfo + ? createNewFile(fileInfo.folderId, `${defaultFileName}.${fileExst}`) + : createTextFileInMy(`${defaultFileName}.${fileExst}`).then((file) => + openDocEditor(file.id, file.providerKey) + ); }; const onSDKRequestRename = (event) => { From 3be8ab673cf4dcf386deebe8dae0c589103566de Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 28 Jul 2021 11:15:55 +0300 Subject: [PATCH 08/11] Web: Editor: Fixed not displaying data of Sharing Panel. --- products/ASC.Files/Client/src/HOCs/withLoader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/HOCs/withLoader.js b/products/ASC.Files/Client/src/HOCs/withLoader.js index 13a80060275..e53b44bc204 100644 --- a/products/ASC.Files/Client/src/HOCs/withLoader.js +++ b/products/ASC.Files/Client/src/HOCs/withLoader.js @@ -4,6 +4,9 @@ import { isMobile } from "react-device-detect"; import Loaders from "@appserver/common/components/Loaders"; +const pathname = window.location.pathname.toLowerCase(); +const isEditor = pathname.indexOf("doceditor") !== -1; + let loadTimeout = null; const withLoader = (WrappedComponent) => (Loader) => { const withLoader = (props) => { @@ -33,7 +36,10 @@ const withLoader = (WrappedComponent) => (Loader) => { }; }, [isLoading]); - return firstLoad || !isLoaded || (isMobile && inLoad) || !tReady ? ( + return (!isEditor && firstLoad) || + !isLoaded || + (isMobile && inLoad) || + !tReady ? ( Loader ? ( Loader ) : viewAs === "tile" ? ( From ccb268caf9a1b5b7b042b950fee6731242867acb Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 28 Jul 2021 11:19:15 +0300 Subject: [PATCH 09/11] Web: Editor: Added error checks. --- web/ASC.Web.Editor/src/Editor.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 3ef6424182c..7c901a4e33f 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -433,9 +433,14 @@ const Editor = () => { const defaultFileName = getDefaultFileName(fileExst); fileInfo - ? createNewFile(fileInfo.folderId, `${defaultFileName}.${fileExst}`) + ? createNewFile( + fileInfo.folderId, + `${defaultFileName}.${fileExst}` + ).catch((error) => console.log("error", error)) : createTextFileInMy(`${defaultFileName}.${fileExst}`).then((file) => - openDocEditor(file.id, file.providerKey) + openDocEditor(file.id, file.providerKey).catch((error) => + console.log("error", error) + ) ); }; From ede002065cdea8111e2ef4d762858a541ab367ff Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 28 Jul 2021 11:49:38 +0300 Subject: [PATCH 10/11] Web:Editor: Fixed folder of creating new file. --- web/ASC.Web.Editor/src/Editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 7c901a4e33f..5fdd70baec9 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -432,7 +432,7 @@ const Editor = () => { const defaultFileName = getDefaultFileName(fileExst); - fileInfo + fileInfo && fileInfo.rootFolderType !== FolderType.SHARE ? createNewFile( fileInfo.folderId, `${defaultFileName}.${fileExst}` From f99090ec9bf4d81accea5ab4aa54383beb56ce32 Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 28 Jul 2021 12:33:09 +0300 Subject: [PATCH 11/11] Web: Files: Remove Comments. --- products/ASC.Files/Client/src/HOCs/withContent.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withContent.js b/products/ASC.Files/Client/src/HOCs/withContent.js index 247bac5134a..2656e007cde 100644 --- a/products/ASC.Files/Client/src/HOCs/withContent.js +++ b/products/ASC.Files/Client/src/HOCs/withContent.js @@ -37,21 +37,6 @@ export default function withContent(WrappedContent) { } } - // getDefaultName = (format) => { - // const { t } = this.props; - - // switch (format) { - // case "docx": - // return t("NewDocument"); - // case "xlsx": - // return t("NewSpreadsheet"); - // case "pptx": - // return t("NewPresentation"); - // default: - // return t("NewFolder"); - // } - // }; - completeAction = (id) => { const { editCompleteAction, item } = this.props;