Merge branch 'feature/new-viewer' of github.com:ONLYOFFICE/DocSpace into feature/new-viewer

This commit is contained in:
DmitrySychugov 2023-01-18 18:50:49 +05:00
commit 9a0b15354d
12 changed files with 53 additions and 32 deletions

View File

@ -10,7 +10,7 @@
"OriginalCopy": "Save the file copy in the original format as well", "OriginalCopy": "Save the file copy in the original format as well",
"StoringFileVersion": "Storing file versions", "StoringFileVersion": "Storing file versions",
"ThirdPartyAccounts": "Third-party accounts", "ThirdPartyAccounts": "Third-party accounts",
"ThirdPartyBtn": "Allow Room admins to connect third-party storages", "ThirdPartyBtn": "Allow connection of third-party storages",
"UpdateOrCreate": "Update the file version for the existing file with the same name. Otherwise, a copy of the file will be created.", "UpdateOrCreate": "Update the file version for the existing file with the same name. Otherwise, a copy of the file will be created.",
"UploadPluginsHere": "Upload plugins here" "UploadPluginsHere": "Upload plugins here"
} }

View File

@ -10,7 +10,7 @@
"OriginalCopy": "Сохранять также копию файла в исходном формате", "OriginalCopy": "Сохранять также копию файла в исходном формате",
"StoringFileVersion": "Хранение версий файлов", "StoringFileVersion": "Хранение версий файлов",
"ThirdPartyAccounts": "Сторонние аккаунты", "ThirdPartyAccounts": "Сторонние аккаунты",
"ThirdPartyBtn": "Разрешить администраторам комнаты подключать сторонние хранилища", "ThirdPartyBtn": "Разрешить подключение сторонних хранилищ",
"UpdateOrCreate": "Обновлять версию файла для существующего файла с таким же именем. В противном случае будет создаваться копия файла.", "UpdateOrCreate": "Обновлять версию файла для существующего файла с таким же именем. В противном случае будет создаваться копия файла.",
"UploadPluginsHere": "Загрузите плагины сюда" "UploadPluginsHere": "Загрузите плагины сюда"
} }

View File

@ -30,7 +30,6 @@ const CreateRoomEvent = ({
fetchFiles, fetchFiles,
setInfoPanelIsVisible, setInfoPanelIsVisible,
setView, setView,
isAdmin,
enableThirdParty, enableThirdParty,
}) => { }) => {
const { t } = useTranslation(["CreateEditRoomDialog", "Common", "Files"]); const { t } = useTranslation(["CreateEditRoomDialog", "Common", "Files"]);
@ -144,7 +143,6 @@ const CreateRoomEvent = ({
setIsLoading={setIsLoading} setIsLoading={setIsLoading}
deleteThirdParty={deleteThirdParty} deleteThirdParty={deleteThirdParty}
fetchThirdPartyProviders={fetchThirdPartyProviders} fetchThirdPartyProviders={fetchThirdPartyProviders}
isAdmin={isAdmin}
enableThirdParty={enableThirdParty} enableThirdParty={enableThirdParty}
/> />
); );
@ -188,8 +186,6 @@ export default inject(
setView, setView,
} = auth.infoPanelStore; } = auth.infoPanelStore;
const { isAdmin } = auth;
const { enableThirdParty } = settingsStore; const { enableThirdParty } = settingsStore;
return { return {
@ -213,7 +209,6 @@ export default inject(
fetchFiles, fetchFiles,
setInfoPanelIsVisible, setInfoPanelIsVisible,
setView, setView,
isAdmin,
enableThirdParty, enableThirdParty,
}; };
} }

View File

@ -66,6 +66,7 @@ const ConflictResolveDialog = (props) => {
setActiveFiles, setActiveFiles,
setMoveToPanelVisible, setMoveToPanelVisible,
setCopyPanelVisible, setCopyPanelVisible,
setRestoreAllPanelVisible,
} = props; } = props;
const { const {
@ -86,6 +87,7 @@ const ConflictResolveDialog = (props) => {
setConflictResolveDialogVisible(false); setConflictResolveDialogVisible(false);
setMoveToPanelVisible(false); setMoveToPanelVisible(false);
setCopyPanelVisible(false); setCopyPanelVisible(false);
setRestoreAllPanelVisible(false);
}; };
const onCloseDialog = () => { const onCloseDialog = () => {
let newActiveFiles = activeFiles; let newActiveFiles = activeFiles;
@ -258,6 +260,7 @@ export default inject(({ auth, dialogsStore, uploadDataStore, filesStore }) => {
conflictResolveDialogData, conflictResolveDialogData,
conflictResolveDialogItems: items, conflictResolveDialogItems: items,
setMoveToPanelVisible, setMoveToPanelVisible,
setRestoreAllPanelVisible,
setCopyPanelVisible, setCopyPanelVisible,
} = dialogsStore; } = dialogsStore;
@ -275,6 +278,7 @@ export default inject(({ auth, dialogsStore, uploadDataStore, filesStore }) => {
activeFiles, activeFiles,
setActiveFiles, setActiveFiles,
setMoveToPanelVisible, setMoveToPanelVisible,
setRestoreAllPanelVisible,
setCopyPanelVisible, setCopyPanelVisible,
}; };
})( })(

View File

@ -39,7 +39,6 @@ const CreateRoomDialog = ({
deleteThirdParty, deleteThirdParty,
fetchThirdPartyProviders, fetchThirdPartyProviders,
isAdmin,
enableThirdParty, enableThirdParty,
}) => { }) => {
const [isScrollLocked, setIsScrollLocked] = useState(false); const [isScrollLocked, setIsScrollLocked] = useState(false);
@ -152,7 +151,6 @@ const CreateRoomDialog = ({
isDisabled={isLoading} isDisabled={isLoading}
isValidTitle={isValidTitle} isValidTitle={isValidTitle}
setIsValidTitle={setIsValidTitle} setIsValidTitle={setIsValidTitle}
isAdmin={isAdmin}
enableThirdParty={enableThirdParty} enableThirdParty={enableThirdParty}
/> />
)} )}

View File

@ -45,7 +45,6 @@ const SetRoomParams = ({
isDisabled, isDisabled,
isValidTitle, isValidTitle,
setIsValidTitle, setIsValidTitle,
isAdmin,
enableThirdParty, enableThirdParty,
}) => { }) => {
const [previewIcon, setPreviewIcon] = React.useState(null); const [previewIcon, setPreviewIcon] = React.useState(null);
@ -114,7 +113,7 @@ const SetRoomParams = ({
/> />
)} */} )} */}
{!isEdit && (enableThirdParty || isAdmin) && ( {!isEdit && enableThirdParty && (
<ThirdPartyStorage <ThirdPartyStorage
t={t} t={t}
roomTitle={roomParams.title} roomTitle={roomParams.title}

View File

@ -78,7 +78,7 @@ class NewFilesPanel extends React.Component {
.then(() => { .then(() => {
const { hasNew, refreshFiles } = this.props; const { hasNew, refreshFiles } = this.props;
return hasNew ? refreshFiles() : Promise.resolve(); return Promise.resolve(); //hasNew ? refreshFiles() :
}) })
.catch((err) => toastr.error(err)) .catch((err) => toastr.error(err))
.finally(() => { .finally(() => {
@ -121,7 +121,7 @@ class NewFilesPanel extends React.Component {
this.onFileClick(item); this.onFileClick(item);
}) })
.then(() => { .then(() => {
refreshFiles(); // refreshFiles();
}) })
.catch((err) => toastr.error(err)); .catch((err) => toastr.error(err));
}; };
@ -130,9 +130,13 @@ class NewFilesPanel extends React.Component {
const { id, fileExst, webUrl, fileType, providerKey } = item; const { id, fileExst, webUrl, fileType, providerKey } = item;
const { const {
filter, filter,
//setMediaViewerData, setMediaViewerData,
fetchFiles, fetchFiles,
addFileToRecentlyViewed, addFileToRecentlyViewed,
playlist,
setCurrentItem,
isMediaOrImage,
currentFolderId,
} = this.props; } = this.props;
if (!fileExst) { if (!fileExst) {
@ -141,7 +145,10 @@ class NewFilesPanel extends React.Component {
.finally(() => this.onClose()); .finally(() => this.onClose());
} else { } else {
const canEdit = [5, 6, 7].includes(fileType); //TODO: maybe dirty const canEdit = [5, 6, 7].includes(fileType); //TODO: maybe dirty
const isMedia = [2, 3, 4].includes(fileType); // const isMedia = [2, 3, 4].includes(fileType);
const isMedia = isMediaOrImage(fileExst);
const isMediaActive = playlist.findIndex((el) => el.fileId === id) !== -1;
if (canEdit && providerKey) { if (canEdit && providerKey) {
return addFileToRecentlyViewed(id) return addFileToRecentlyViewed(id)
@ -160,8 +167,21 @@ class NewFilesPanel extends React.Component {
} }
if (isMedia) { if (isMedia) {
//const mediaItem = { visible: true, id }; if (currentFolderId !== item.folderId) {
//setMediaViewerData(mediaItem); fetchFiles(item.folderId, null)
.then(() => {
const mediaItem = { visible: true, id };
setMediaViewerData(mediaItem);
})
.catch((err) => toastr.error(err))
.finally(() => this.onClose());
} else {
const mediaItem = { visible: true, id };
setMediaViewerData(mediaItem);
return this.onClose();
}
return; return;
} }
@ -311,10 +331,14 @@ export default inject(
refreshFiles, refreshFiles,
} = filesStore; } = filesStore;
//const { updateRootBadge } = treeFoldersStore; //const { updateRootBadge } = treeFoldersStore;
const { setMediaViewerData } = mediaViewerDataStore; const {
const { getIcon, getFolderIcon } = settingsStore; playlist,
setMediaViewerData,
setCurrentItem,
} = mediaViewerDataStore;
const { getIcon, getFolderIcon, isMediaOrImage } = settingsStore;
const { markAsRead } = filesActionsStore; const { markAsRead } = filesActionsStore;
const { pathParts } = selectedFolderStore; const { pathParts, id: currentFolderId } = selectedFolderStore;
const { const {
setNewFilesPanelVisible, setNewFilesPanelVisible,
@ -331,6 +355,11 @@ export default inject(
newFilesIds, newFilesIds,
isLoading, isLoading,
playlist,
setCurrentItem,
isMediaOrImage,
currentFolderId,
//setIsLoading, //setIsLoading,
fetchFiles, fetchFiles,
setMediaViewerData, setMediaViewerData,

View File

@ -37,21 +37,16 @@ const StyledInfoPanelBody = styled.div`
`; `;
const StyledTitle = styled.div` const StyledTitle = styled.div`
position: fixed; //position: fixed;
margin-top: -80px; margin-top: -80px;
margin-left: -20px; margin-left: -20px;
width: calc(100% - 40px); width: 100%;
padding: 24px 0 24px 20px; padding: 24px 0 24px 20px;
background: ${(props) => props.theme.infoPanel.backgroundColor}; background: ${(props) => props.theme.infoPanel.backgroundColor};
z-index: 100; z-index: 100;
@media ${tablet} {
padding: 24px 20px 24px 20px;
}
@media ${mobile} { @media ${mobile} {
width: calc(100% - 32px); padding: 24px -16px 24px 16px;
padding: 24px 0 24px 16px;
} }
display: flex; display: flex;

View File

@ -40,7 +40,7 @@ const SectionBodyContent = ({ isErrorSettings, history, user }) => {
const adminSettings = { const adminSettings = {
id: "admin", id: "admin",
name: t("Common:SettingsGenaral"), name: t("Common:SettingsGeneral"),
content: <GeneralSettings t={t} />, content: <GeneralSettings t={t} />,
}; };

View File

@ -287,6 +287,8 @@ class FilesStore {
console.log(`[WS] markasnew-file ${fileId}:${count}`); console.log(`[WS] markasnew-file ${fileId}:${count}`);
const foundIndex = fileId && this.files.findIndex((x) => x.id === fileId); const foundIndex = fileId && this.files.findIndex((x) => x.id === fileId);
this.treeFoldersStore.fetchTreeFolders();
if (foundIndex == -1) return; if (foundIndex == -1) return;
this.updateFileStatus( this.updateFileStatus(
@ -295,7 +297,6 @@ class FilesStore {
? this.files[foundIndex].fileStatus | FileStatus.IsNew ? this.files[foundIndex].fileStatus | FileStatus.IsNew
: this.files[foundIndex].fileStatus & ~FileStatus.IsNew : this.files[foundIndex].fileStatus & ~FileStatus.IsNew
); );
this.treeFoldersStore.fetchTreeFolders();
}); });
//WAIT FOR RESPONSES OF EDITING FILE //WAIT FOR RESPONSES OF EDITING FILE

View File

@ -194,7 +194,7 @@
"Sessions": "Sessions", "Sessions": "Sessions",
"Settings": "Settings", "Settings": "Settings",
"SettingsDocSpace": "DocSpace Settings", "SettingsDocSpace": "DocSpace Settings",
"SettingsGenaral": "Genaral", "SettingsGeneral": "General",
"SettingsPersonal": "Personal", "SettingsPersonal": "Personal",
"ShowMore": "Show more", "ShowMore": "Show more",
"SignInWithFacebook": "Sign in with Facebook", "SignInWithFacebook": "Sign in with Facebook",

View File

@ -194,7 +194,7 @@
"Sessions": "Сессии", "Sessions": "Сессии",
"Settings": "Настройки", "Settings": "Настройки",
"SettingsDocSpace": "Настройки DocSpace", "SettingsDocSpace": "Настройки DocSpace",
"SettingsGenaral": "Общие", "SettingsGeneral": "Общие",
"SettingsPersonal": "Персональные", "SettingsPersonal": "Персональные",
"ShowMore": "Показать еще", "ShowMore": "Показать еще",
"SignInWithFacebook": "Вход через Facebook", "SignInWithFacebook": "Вход через Facebook",