Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into feature/security-settings

This commit is contained in:
Viktor Fomin 2022-06-09 12:01:36 +03:00
commit 5aa615f315
7 changed files with 74 additions and 37 deletions

View File

@ -1072,6 +1072,11 @@ const Dark = {
borderRadius: "50%",
},
icon: {
background: grayMain,
color: globalColors.lightHover,
},
width: {
min: "32px",
small: "36px",

View File

@ -198,7 +198,7 @@ export default function withContent(WrappedContent) {
fileCopyAs,
fromTemplate,
gallerySelected,
setCreatedFolderId,
setCreatedItem,
} = this.props;
const { itemTitle } = this.state;
const { parentId, fileExst } = item;
@ -241,7 +241,7 @@ export default function withContent(WrappedContent) {
.then((folder) => {
createdFolderId = folder.id;
addActiveItems(null, [folder.id]);
setCreatedFolderId(createdFolderId);
setCreatedItem({ id: createdFolderId, type: "folder" });
})
.then(() => this.completeAction(itemId))
.catch((e) => toastr.error(e))
@ -312,6 +312,7 @@ export default function withContent(WrappedContent) {
)
.then((file) => {
createdFileId = file.id;
setCreatedItem({ id: createdFileId, type: "file" });
addActiveItems([file.id]);
return open && openDocEditor(file.id, file.providerKey, tab);
@ -330,6 +331,7 @@ export default function withContent(WrappedContent) {
createFile(item.parentId, `${title}.${item.fileExst}`)
.then((file) => {
createdFileId = file.id;
setCreatedItem({ id: createdFileId, type: "file" });
addActiveItems([file.id]);
if (isPrivacy) {
@ -504,7 +506,7 @@ export default function withContent(WrappedContent) {
passwordEntryProcess,
addActiveItems,
gallerySelected,
setCreatedFolderId,
setCreatedItem,
} = filesStore;
const { clearActiveOperations, fileCopyAs } = uploadDataStore;
const { isRecycleBinFolder, isPrivacyFolder } = treeFoldersStore;
@ -571,7 +573,7 @@ export default function withContent(WrappedContent) {
titleWithoutExt,
fromTemplate,
gallerySelected,
setCreatedFolderId,
setCreatedItem,
personal,
};
}

View File

@ -29,6 +29,9 @@ const FilesMediaViewer = (props) => {
setExpandedKeys,
setToPreviewFile,
expandedKeys,
setScrollToItem,
setCurrentId,
setSelection,
} = props;
useEffect(() => {
@ -58,6 +61,7 @@ const FilesMediaViewer = (props) => {
const onChangeUrl = (id) => {
const url = "/products/files/#preview/" + id;
setCurrentId(id);
window.history.pushState(null, null, url);
};
@ -121,9 +125,12 @@ const FilesMediaViewer = (props) => {
.finally(() => {
setIsLoading(false);
setFirstLoad(false);
setScrollToItem({ id: previewFile.id, type: "file" });
setSelection([previewFile]);
setToPreviewFile(null);
});
}
setMediaViewerData({ visible: false, id: null });
if (e) {
@ -132,6 +139,11 @@ const FilesMediaViewer = (props) => {
if (!url) {
return;
}
setScrollToItem({ id: currentMediaFileId, type: "file" });
const targetFile = files.find((item) => item.id === currentMediaFileId);
if (targetFile) setSelection([targetFile]);
window.history.replaceState(null, null, url);
}
};
@ -176,6 +188,8 @@ export default inject(
fetchFiles,
setIsLoading,
setFirstLoad,
setScrollToItem,
setSelection,
} = filesStore;
const {
visible,
@ -184,6 +198,7 @@ export default inject(
playlist,
previewFile,
setToPreviewFile,
setCurrentId,
} = mediaViewerDataStore;
const { deleteItemAction } = filesActionsStore;
const { extsVideo, extsImage } = settingsStore;
@ -208,6 +223,9 @@ export default inject(
setExpandedKeys,
setToPreviewFile,
expandedKeys,
setScrollToItem,
setCurrentId,
setSelection,
};
}
)(

View File

@ -37,8 +37,8 @@ const SectionBodyContent = (props) => {
tooltipPageY,
setHotkeyCaretStart,
setHotkeyCaret,
scrollToFolderId,
setScrollToFolderId,
scrollToItem,
setScrollToItem,
filesList,
} = props;
@ -71,29 +71,31 @@ const SectionBodyContent = (props) => {
}, [onMouseUp, onMouseMove, startDrag, folderId, viewAs]);
useEffect(() => {
if (scrollToFolderId) {
const newFolder = document.querySelector(
`div[value='folder_${scrollToFolderId}_draggable']`
if (scrollToItem) {
const { type, id } = scrollToItem;
const targetElement = document.querySelector(
`div[value='${type}_${id}_draggable']`
);
let isInViewport = isElementInViewport(newFolder);
if (!targetElement) return;
let isInViewport = isElementInViewport(targetElement);
if (!isInViewport || viewAs === "table") {
const bodyScroll = isMobileOnly
? document.querySelector("#customScrollBar > div")
: document.querySelector(".section-scroll");
const rectNewFolder = newFolder.getBoundingClientRect();
const count =
viewAs === "table"
? filesList.findIndex((elem) => elem.id === scrollToFolderId) * 40
: rectNewFolder.bottom - window.innerHeight + 300;
filesList.findIndex((elem) => elem.id === scrollToItem.id) *
(isMobileOnly ? 57 : 48);
bodyScroll.scrollTo(0, count);
}
setScrollToFolderId(null);
setScrollToItem(null);
}
}, [scrollToFolderId]);
}, [scrollToItem]);
const onMouseDown = (e) => {
if (
@ -280,11 +282,10 @@ export default inject(
setBufferSelection,
setHotkeyCaretStart,
setHotkeyCaret,
scrollToFolderId,
setScrollToFolderId,
scrollToItem,
setScrollToItem,
filesList,
} = filesStore;
return {
dragging,
startDrag,
@ -303,8 +304,8 @@ export default inject(
tooltipPageY,
setHotkeyCaretStart,
setHotkeyCaret,
scrollToFolderId,
setScrollToFolderId,
scrollToItem,
setScrollToItem,
filesList,
};
}

View File

@ -67,8 +67,8 @@ class FilesStore {
oformFiles = null;
gallerySelected = null;
createdFolderId = null;
scrollToFolderId = null;
createdItem = null;
scrollToItem = null;
isLoadingFilesFind = false;
pageItemsLength = null;
@ -569,7 +569,8 @@ class FilesStore {
folderId,
filter,
clearFilter = true,
withSubfolders = false
withSubfolders = false,
clearSelection = true
) => {
const {
treeFolders,
@ -646,7 +647,9 @@ class FilesStore {
if (clearFilter) {
this.fileActionStore.setAction({ type: null });
this.setSelected("close");
if (clearSelection) {
this.setSelected("close");
}
}
const navigationPath = await Promise.all(
@ -675,17 +678,20 @@ class FilesStore {
this.viewAs === "tile" && this.createThumbnails();
if (this.createdFolderId) {
const newFolder = this.filesList.find(
(item) => item.id === this.createdFolderId
if (this.createdItem) {
const newItem = this.filesList.find(
(item) => item.id === this.createdItem.id
);
if (newFolder) {
this.setSelection([newFolder]);
this.setScrollToFolderId(newFolder.id);
if (newItem) {
this.setSelection([newItem]);
this.setScrollToItem({
id: newItem.id,
type: this.createdItem.type,
});
}
this.setCreatedFolderId(null);
this.setCreatedItem(null);
}
return Promise.resolve(selectedFolder);
})
@ -2077,12 +2083,12 @@ class FilesStore {
this.enabledHotkeys = enabledHotkeys;
};
setCreatedFolderId = (createdFolderId) => {
this.createdFolderId = createdFolderId;
setCreatedItem = (createdItem) => {
this.createdItem = createdItem;
};
setScrollToFolderId = (folderId) => {
this.scrollToFolderId = folderId;
setScrollToItem = (item) => {
this.scrollToItem = item;
};
}

View File

@ -41,6 +41,10 @@ class MediaViewerDataStore {
this.currentItem = item;
};
setCurrentId = (id) => {
this.id = id;
};
get playlist() {
const { isMediaOrImage } = this.settingsStore;
const { files } = this.filesStore;

View File

@ -1188,7 +1188,8 @@ class UploadDataStore {
updatedFolder,
newFilter ? newFilter : filter,
true,
true
true,
false
).finally(() => {
this.clearActiveOperations(fileIds, folderIds);
setTimeout(() => clearSecondaryProgressData(), TIMEOUT);