Merge branch 'develop' into feature/new-profile-loader

This commit is contained in:
Viktor Fomin 2022-11-13 03:59:43 +05:00
commit 8c2fb8f8e8
36 changed files with 2519 additions and 4602 deletions

File diff suppressed because one or more lines are too long

801
.yarn/releases/yarn-3.2.4.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.2.2.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs

View File

@ -30,7 +30,7 @@ RUN apt-get -y update && \
npm && \
locale-gen en_US.UTF-8 && \
npm install --global yarn && \
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && \
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
@ -93,7 +93,7 @@ COPY --from=base --chown=onlyoffice:onlyoffice /app/onlyoffice/config/* /app/onl
EXPOSE 5050
ENTRYPOINT ["python3", "docker-entrypoint.py"]
FROM node:16.16-slim as noderun
FROM node:18.12.1-slim as noderun
ARG BUILD_PATH
ARG SRC_PATH
ENV BUILD_PATH=${BUILD_PATH}

View File

@ -30,7 +30,7 @@ RUN apt-get -y update && \
npm && \
locale-gen en_US.UTF-8 && \
npm install --global yarn && \
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && \
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
@ -91,7 +91,7 @@ COPY --from=base --chown=onlyoffice:onlyoffice /app/onlyoffice/config/* /app/onl
EXPOSE 5050
ENTRYPOINT ["python3", "docker-entrypoint.py"]
FROM node:16.16-slim as noderun
FROM node:18.12.1-slim as noderun
ARG BUILD_PATH
ARG SRC_PATH
ENV BUILD_PATH=${BUILD_PATH}

View File

@ -8204,7 +8204,7 @@ __metadata:
"typescript@patch:typescript@4.7.4#~builtin<compat/typescript>, typescript@patch:typescript@^4.3.5#~builtin<compat/typescript>":
version: 4.7.4
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=f456af"
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=701156"
bin:
tsc: bin/tsc
tsserver: bin/tsserver

View File

@ -13,19 +13,21 @@
},
"scripts": {
"build": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run build",
"build:test": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run build:test",
"build:test.translation": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run build:test.translation",
"bump": "yarn version apply --all",
"clean": "yarn workspaces foreach -vptiR run clean",
"deploy": "shx rm -rf build/deploy/products && shx rm -rf build/deploy/public && shx rm -rf build/deploy/client && yarn workspaces foreach -ptR --from '{@docspace/client,@docspace/login,@docspace/editor}' run deploy && shx cp -r public build/deploy && node build/scripts/minify-common-locales.js",
"serve": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run serve",
"start": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run start",
"start-prod": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run start-prod",
"storybook": "yarn workspace @docspace/components storybook",
"storybook-build": "yarn workspace @docspace/components run storybook-build",
"storybook-serve": "yarn workspace @docspace/components run storybook-serve",
"test": "yarn workspace @docspace/components test",
"wipe": "shx rm -rf node_modules yarn.lock packages/**/node_modules",
"debug-info": "auto-changelog --unreleased-only --template debuginfo --output public/debuginfo.md",
"debug-info": "auto-changelog --unreleased-only --template debuginfo --output public/debuginfo.md"
},
"old-scripts": {
"build:test": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run build:test",
"build:test.translation": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login,@docspace/editor}' run build:test.translation",
"e2e.test": "yarn workspaces foreach -vptiR --from '{@docspace/client,@docspace/login}' run test:sequential",
"e2e.test:sequential": "yarn workspace @docspace/client test:sequential && yarn workspace @docspace/login test:sequential",
"e2e.test:model": "yarn workspace @docspace/client test:model && yarn workspace @docspace/login test:model",
@ -36,5 +38,5 @@
"shx": "^0.3.3",
"terser": "^5.8.0"
},
"packageManager": "yarn@3.2.2"
"packageManager": "yarn@3.2.4"
}

View File

@ -4,15 +4,16 @@
"private": true,
"homepage": "",
"scripts": {
"build": "webpack --mode production",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production",
"clean": "shx rm -rf dist",
"deploy": "shx --silent mkdir -p ../../build/deploy/client && shx cp -r dist/* ../../build/deploy/client",
"start": "NODE_OPTIONS=--openssl-legacy-provider webpack-cli serve",
"start-prod": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production && serve dist -p 5001"
},
"old-scripts": {
"build:test": "webpack --env minimize=false --mode production",
"build:test.translation": "webpack --env minimize=false hideText=true --mode production",
"build:test.translation:personal": "webpack --env minimize=false hideText=true personal=true --mode production",
"clean": "shx rm -rf dist",
"deploy": "shx --silent mkdir -p ../../build/deploy/client && shx cp -r dist/* ../../build/deploy/client",
"serve": "serve dist -p 5001",
"start": "webpack-cli serve",
"start-prod": "webpack --mode production && serve dist -p 5001",
"test:codeceptjs": "npx codeceptjs run --reporter mocha-multi",
"test:mobile": "cross-env DEVICE_TYPE=mobile yarn test:codeceptjs",
"test:smallTablet": "cross-env DEVICE_TYPE=smallTablet yarn test:codeceptjs",
@ -40,6 +41,7 @@
},
"dependencies": {
"copy-to-clipboard": "^3.3.1",
"element-resize-detector": "^1.2.4",
"file-saver": "^2.0.5",
"firebase": "^8.10.0",
"react-avatar-editor": "^13.0.0",
@ -57,13 +59,9 @@
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.18.6",
"@codeceptjs/configure": "^0.8.0",
"@codeceptjs/examples": "^1.2.1",
"@codeceptjs/ui": "^0.4.6",
"@svgr/webpack": "^5.5.0",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^4.0.0",
"codeceptjs": "^3.3.0",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.2.0",
"external-remotes-plugin": "^1.0.0",

View File

@ -201,10 +201,7 @@ export default function withFileActions(WrappedFileItem) {
checked,
dragging,
isFolder,
isDesktop,
personal,
canWebEdit,
canViewedDocs,
} = this.props;
const { fileExst, access, id } = item;
@ -226,13 +223,6 @@ export default function withFileActions(WrappedFileItem) {
? "38px"
: "96px";
const showShare =
!isShareable ||
(isPrivacy && (!isDesktop || !fileExst)) ||
(personal && !canWebEdit && !canViewedDocs)
? false
: true;
const checkedProps = id <= 0 ? false : checked;
return (
@ -252,7 +242,6 @@ export default function withFileActions(WrappedFileItem) {
value={value}
displayShareButton={displayShareButton}
isPrivacy={isPrivacy}
showShare={showShare}
checkedProps={checkedProps}
dragging={dragging}
getContextModel={this.getContextModel}
@ -265,14 +254,12 @@ export default function withFileActions(WrappedFileItem) {
return inject(
(
{
auth,
filesActionsStore,
dialogsStore,
treeFoldersStore,
selectedFolderStore,
filesStore,
uploadDataStore,
settingsStore,
contextOptionsStore,
},
{ item, t }
@ -320,8 +307,7 @@ export default function withFileActions(WrappedFileItem) {
const draggable = !isRecycleBinFolder && selectedItem;
const isFolder = selectedItem ? false : !item.isFolder ? false : true;
const canWebEdit = settingsStore.canWebEdit(item.fileExst);
const canViewedDocs = settingsStore.canViewedDocs(item.fileExst);
const inProgress =
activeFiles.findIndex((x) => x === item.id) !== -1 ||
activeFolders.findIndex(
@ -367,13 +353,9 @@ export default function withFileActions(WrappedFileItem) {
checked: !!selectedItem,
//parentFolder: selectedFolderStore.parentId,
setParentId: selectedFolderStore.setParentId,
canWebEdit,
canViewedDocs,
isTrashFolder: isRecycleBinFolder,
getFolderInfo,
viewAs,
isDesktop: auth.settingsStore.isDesktopClient,
personal: auth.settingsStore.personal,
setNewBadgeCount,
isActive,
inProgress,

View File

@ -49,14 +49,6 @@ export default function withQuickButtons(WrappedComponent) {
.catch((err) => toastr.error(err));
};
onClickShare = () => {
const { item, onSelectItem, setSharingPanelVisible } = this.props;
const { id, isFolder } = item;
onSelectItem({ id, isFolder });
setSharingPanelVisible(true);
};
render() {
const { isLoading, isCanWebEdit } = this.state;
@ -66,7 +58,6 @@ export default function withQuickButtons(WrappedComponent) {
item,
isTrashFolder,
isAdmin,
showShare,
sectionWidth,
viewAs,
} = this.props;
@ -84,7 +75,6 @@ export default function withQuickButtons(WrappedComponent) {
item={item}
sectionWidth={sectionWidth}
isAdmin={isAdmin}
showShare={showShare}
isTrashFolder={isTrashFolder}
accessToEdit={accessToEdit}
viewAs={viewAs}
@ -92,7 +82,6 @@ export default function withQuickButtons(WrappedComponent) {
isCanWebEdit={isCanWebEdit}
onClickLock={this.onClickLock}
onClickFavorite={this.onClickFavorite}
onClickShare={this.onClickShare}
/>
);

View File

@ -402,7 +402,10 @@ const ArticleMainButtonContent = (props) => {
onUploadFolderClick,
]);
const canInvite = isAccountsPage && selectedTreeNode[1] === "filter";
const canInvite =
isAccountsPage &&
selectedTreeNode.length > 1 &&
selectedTreeNode[1] === "filter";
const mainButtonText = isAccountsPage
? t("Common:Invite")
: t("Common:Actions");

View File

@ -18,30 +18,20 @@ const QuickButtons = (props) => {
sectionWidth,
isTrashFolder,
accessToEdit,
showShare,
onClickLock,
isDisabled,
onClickFavorite,
onClickShare,
viewAs,
isCanWebEdit,
} = props;
const { id, locked, fileStatus, title, fileExst, shared } = item;
const { id, locked, fileStatus, title, fileExst } = item;
const isFavorite =
(fileStatus & FileStatus.IsFavorite) === FileStatus.IsFavorite;
const isTile = viewAs === "tile";
const iconShare = shared
? "/static/images/shared.share.react.svg"
: "/static/images/share.react.svg";
const colorShare = shared
? theme.filesQuickButtons.sharedColor
: theme.filesQuickButtons.color;
const iconLock = locked
? "/static/images/file.actions.locked.react.svg"
: "/static/images/locked.react.svg";
@ -69,18 +59,6 @@ const QuickButtons = (props) => {
return (
<div className="badges additional-badges">
{item.canShare && showShare && displayBadges && (
<ColorTheme
themeId={ThemeType.IconButton}
shared={shared}
iconName={iconShare}
className="badge share-button-icon"
size={sizeQuickButton}
color={colorShare}
onClick={onClickShare}
hoverColor={theme.filesQuickButtons.sharedColor}
/>
)}
{fileExst &&
accessToEdit &&
!isTrashFolder &&

View File

@ -120,6 +120,10 @@ const StyledInviteInputContainer = styled.div`
align-items: center;
${fillAvailableWidth}
margin-bottom: 20px;
.header_aside-panel {
max-width: 100% !important;
}
`;
const StyledDropDown = styled(DropDown)`

View File

@ -10,10 +10,11 @@ const AccessSelector = ({
onSelectAccess,
containerRef,
defaultAccess,
isOwner,
}) => {
const width = containerRef?.current?.offsetWidth - 32;
const accessOptions = getAccessOptions(t, roomType, false, true);
const accessOptions = getAccessOptions(t, roomType, false, true, isOwner);
const selectedOption = accessOptions.filter(
(access) => access.access === +defaultAccess
@ -27,6 +28,8 @@ const AccessSelector = ({
accessOptions={accessOptions}
noBorder={false}
directionX="right"
directionY="bottom"
fixedDirection={true}
manualWidth={width + "px"}
isDefaultMode={false}
/>

View File

@ -27,6 +27,7 @@ const ExternalLinks = ({
defaultAccess,
shareLinks,
setInvitationLinks,
isOwner,
}) => {
const [linksVisible, setLinksVisible] = useState(false);
const [actionLinksVisible, setActionLinksVisible] = useState(false);
@ -35,37 +36,45 @@ const ExternalLinks = ({
const inputsRef = useRef();
const toggleLinks = (e) => {
let link = null;
if (roomId === -1) {
const link = shareLinks.find((l) => l.access === +defaultAccess);
link = shareLinks.find((l) => l.access === +defaultAccess);
setActiveLink(link);
} else {
setInvitationLinks(roomId, shareLinks[0].id, "Invite", +defaultAccess);
link = shareLinks[0];
setActiveLink(shareLinks[0]);
}
setLinksVisible(!linksVisible);
if (!linksVisible) copyLink(activeLink.shareLink);
if (!linksVisible) copyLink(link?.shareLink);
};
const onSelectAccess = (access) => {
let link = null;
if (roomId === -1) {
const link = shareLinks.find((l) => l.access === access.access);
link = shareLinks.find((l) => l.access === access.access);
setActiveLink(link);
} else {
setInvitationLinks(roomId, shareLinks[0].id, "Invite", +access.access);
link = shareLinks[0];
setActiveLink(shareLinks[0]);
}
copyLink(activeLink.shareLink);
copyLink(link.shareLink);
};
const copyLink = (link) => {
toastr.success(t("Translations:LinkCopySuccess"));
copy(link);
if (link) {
toastr.success(t("Translations:LinkCopySuccess"));
copy(link);
}
};
const toggleActionLinks = () => {
@ -165,6 +174,7 @@ const ExternalLinks = ({
defaultAccess={activeLink.access}
onSelectAccess={onSelectAccess}
containerRef={inputsRef}
isOwner={isOwner}
/>
</StyledInviteInputContainer>
)}
@ -172,7 +182,8 @@ const ExternalLinks = ({
);
};
export default inject(({ dialogsStore, filesStore }) => {
export default inject(({ auth, dialogsStore, filesStore }) => {
const { isOwner } = auth.userStore.user;
const { invitePanelOptions } = dialogsStore;
const { setInvitationLinks } = filesStore;
const { roomId, hideSelector, defaultAccess } = invitePanelOptions;
@ -182,5 +193,6 @@ export default inject(({ dialogsStore, filesStore }) => {
roomId,
hideSelector,
defaultAccess,
isOwner,
};
})(observer(ExternalLinks));

View File

@ -34,6 +34,7 @@ const InviteInput = ({
setInviteItems,
roomUsers,
t,
isOwner,
}) => {
const [inputValue, setInputValue] = useState("");
const [usersList, setUsersList] = useState([]);
@ -271,6 +272,7 @@ const InviteInput = ({
defaultAccess={selectedAccess}
onSelectAccess={onSelectAccess}
containerRef={inputsRef}
isOwner={isOwner}
/>
{!hideSelector && addUsersPanelVisible && (
@ -294,6 +296,7 @@ const InviteInput = ({
export default inject(({ auth, peopleStore, filesStore, dialogsStore }) => {
const { theme } = auth.settingsStore;
const { isOwner } = auth.userStore.user;
const { getUsersByQuery } = peopleStore.usersStore;
const { invitePanelOptions, setInviteItems, inviteItems } = dialogsStore;
@ -304,5 +307,6 @@ export default inject(({ auth, peopleStore, filesStore, dialogsStore }) => {
roomId: invitePanelOptions.roomId,
hideSelector: invitePanelOptions.hideSelector,
defaultAccess: invitePanelOptions.defaultAccess,
isOwner,
};
})(observer(InviteInput));

View File

@ -8,7 +8,8 @@ export const getAccessOptions = (
t,
roomType = RoomsType.CustomRoom,
withRemove = false,
withSeparator = false
withSeparator = false,
isOwner = false
) => {
let options = [];
const accesses = {
@ -113,8 +114,10 @@ export const getAccessOptions = (
];
break;
case -1:
if (isOwner) options.push(accesses.docSpaceAdmin);
options = [
accesses.docSpaceAdmin,
...options,
accesses.roomAdmin,
{ key: "s1", isSeparator: withSeparator },
accesses.user,

View File

@ -33,7 +33,9 @@ const InfoPanelBodyContent = ({
const isRooms = getIsRooms();
const isAccounts = getIsAccounts();
const isGallery = getIsGallery();
const isSeveralItems = props.selectedItems.length > 1;
const isSeveralItems = props.selectedItems?.length > 1;
const isNoItem =
(isGallery && !gallerySelected) ||
(!selection?.title && !isSeveralItems && !isAccounts) ||
@ -114,7 +116,10 @@ const InfoPanelBodyContent = ({
if (selection?.isRoom && roomsView === "members") return;
const currentFolderRoomId =
selectedFolder?.pathParts && selectedFolder.pathParts[1];
selectedFolder?.pathParts &&
selectedFolder?.pathParts?.length === 2 &&
selectedFolder.pathParts[1];
const storeRoomId = selectionParentRoom?.id;
if (!currentFolderRoomId || currentFolderRoomId === storeRoomId) return;
@ -172,6 +177,7 @@ export default inject(({ auth, selectedFolderStore }) => {
const { isRootFolder } = selectedFolderStore;
const selectedItems = auth.infoPanelStore.getSelectedItems();
const selectedFolder = auth.infoPanelStore.getSelectedFolder();
return {

View File

@ -1,4 +1,4 @@
import React, { useRef, useEffect } from "react";
import React, { useRef, useEffect, useState } from "react";
import { inject, observer } from "mobx-react";
import styled from "styled-components";
@ -16,26 +16,16 @@ const ItemContextOptions = ({
getContextOptions,
getContextOptionActions,
getUserContextOptions,
setBufferSelection,
isUser = false,
itemTitleRef,
}) => {
if (!selection) return null;
const [contextHelper, setContextHelper] = useState(null);
const contextMenuRef = useRef();
const contextHelper = new ContextHelper({
t,
isUser,
selection,
getContextOptions,
getContextOptionActions,
getUserContextOptions,
});
if (!selection) return null;
const onContextMenu = (e) => {
e.button === 2;
if (!contextMenuRef.current.menuRef.current) itemTitleRef.current.click(e);
@ -46,9 +36,31 @@ const ItemContextOptions = ({
contextMenuRef.current.hide();
}, [selection]);
const options = contextHelper.getItemContextOptions();
useEffect(() => {
const contextHelper = new ContextHelper({
t,
isUser,
selection,
getContextOptions,
getContextOptionActions,
getUserContextOptions,
});
const getData = () => options;
setContextHelper(contextHelper);
}, [
t,
isUser,
selection,
getContextOptions,
getContextOptionActions,
getUserContextOptions,
]);
const options = contextHelper?.getItemContextOptions();
const getData = () => {
return options;
};
return (
<StyledItemContextOptions>
@ -57,7 +69,7 @@ const ItemContextOptions = ({
getContextModel={getData}
withBackdrop={false}
/>
{options.length > 0 && (
{options?.length > 0 && (
<ContextMenuButton
className="expandButton"
title={"Show item actions"}

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useRef } from "react";
import { inject, observer } from "mobx-react";
import { withTranslation } from "react-i18next";
@ -34,6 +34,12 @@ const History = ({
const [history, setHistory] = useState(null);
const [showLoader, setShowLoader] = useState(false);
const isMount = useRef(true);
useEffect(() => {
return () => (isMount.current = false);
}, []);
const fetchHistory = async (itemId) => {
let module = "files";
if (selection.isRoom) module = "rooms";
@ -44,9 +50,11 @@ const History = ({
fetchedHistory = parseHistoryJSON(fetchedHistory);
clearTimeout(timerId);
setHistory(fetchedHistory);
setSelection({ ...selection, history: fetchedHistory });
setShowLoader(false);
if (isMount.current) {
setHistory(fetchedHistory);
setSelection({ ...selection, history: fetchedHistory });
setShowLoader(false);
}
};
const parseHistoryJSON = (fetchedHistory) => {
@ -77,10 +85,13 @@ const History = ({
};
useEffect(async () => {
if (!isMount.current) return;
if (selection.history) {
setHistory(selection.history);
return;
}
fetchHistory(selection.id);
}, [selection]);

View File

@ -84,7 +84,9 @@ const User = ({
{userRole && userRoleOptions && (
<div className="role-wrapper">
{currCanEditUsers && currentMember?.id !== user.id ? (
{currCanEditUsers &&
currentMember?.id !== user.id &&
userRole.access !== ShareAccessRights.FullAccess ? (
<ComboBox
className="role-combobox"
selectedOption={userRole}

View File

@ -118,8 +118,8 @@ const Members = ({
);
const currCanEditUsers =
currentMember?.isOwner ||
currentMember?.isAdmin ||
isOwner ||
isAdmin ||
currentMember?.access === ShareAccessRights.FullAccess ||
currentMember?.access === ShareAccessRights.RoomManager;

View File

@ -392,7 +392,11 @@ class FilesStore {
requests.push(getFilesSettings());
requests.push(this.getIsEmptyTrash());
return Promise.all(requests).then(() => (this.isInit = true));
return Promise.all(requests).then(() => this.setIsInit(true));
};
setIsInit = (isInit) => {
this.isInit = isInit;
};
reset = () => {

View File

@ -28,7 +28,7 @@ class InviteLinksStore {
};
getPortalInviteLinks = async () => {
const isViewerAdmin = this.peopleStore.authStore.isAdmin;
const isViewerAdmin = !this.peopleStore.authStore.isVisitor;
if (!isViewerAdmin) return Promise.resolve();

View File

@ -50,10 +50,12 @@ class AuthStore {
makeAutoObservable(this);
}
init = async () => {
init = async (skipRequest = false) => {
if (this.isInit) return;
this.isInit = true;
this.skipRequest = skipRequest;
try {
await this.userStore.init();
} catch (e) {
@ -63,7 +65,7 @@ class AuthStore {
const requests = [];
requests.push(this.settingsStore.init());
if (this.isAuthenticated) {
if (this.isAuthenticated && !skipRequest) {
requests.push(
this.currentQuotaStore.init(),
this.currentTariffStatusStore.init()

View File

@ -681,7 +681,10 @@ class SettingsStore {
};
getAppearanceTheme = async () => {
const res = await api.settings.getAppearanceTheme();
let res = null;
if (window?.__ASC_INITIAL_EDITOR_STATE__?.appearanceTheme)
res = window.__ASC_INITIAL_EDITOR_STATE__.appearanceTheme;
else res = await api.settings.getAppearanceTheme();
const currentColorScheme = res.themes.find((theme) => {
return res.selected === theme.id;

View File

@ -1,17 +1,17 @@
module.exports = {
parser: "babel-eslint",
extends: ["eslint:recommended", "plugin:react/recommended"],
extends: ["eslint:recommended", "plugin:react/recommended", "plugin:storybook/recommended"],
settings: {
react: {
version: "detect",
},
version: "detect"
}
},
env: {
browser: true,
node: true,
node: true
},
plugins: ["jest"],
env: {
"jest/globals": true,
},
};
"jest/globals": true
}
};

View File

@ -11,16 +11,16 @@ const Button = React.forwardRef((props, ref) => {
const { isLoading, icon, label, primary } = props;
return (
<ColorTheme {...props} innerRef={ref} themeId={ThemeType.Button}>
{isLoading && (
<Loader
className="loader"
size="20px"
type="track"
label={label}
primary={primary}
/>
)}
<div className="button-content">
{isLoading && (
<Loader
className="loader"
size="20px"
type="track"
label={label}
primary={primary}
/>
)}
{icon && <div className="icon">{icon}</div>}
{label}
</div>

View File

@ -72,29 +72,6 @@ const hoverCss = css`
}
`;
const loadingCss = css`
background-color: ${(props) =>
props.primary
? props.theme.button.backgroundColor.primaryLoading
: props.theme.button.backgroundColor.grayLight};
color: ${(props) =>
props.primary
? props.theme.button.color.primary
: props.theme.button.color.base};
${(props) =>
props.primary
? css`
border: ${(props) => props.theme.button.border.primaryLoading};
box-sizing: ${(props) => props.theme.button.boxSizing};
`
: css`
border: ${(props) => props.theme.button.border.baseLoading};
box-sizing: ${(props) => props.theme.button.boxSizing};
`}
`;
const disableCss = css`
background-color: ${(props) =>
props.primary
@ -222,22 +199,12 @@ const StyledButton = styled(ButtonWrapper).attrs((props) => ({
}
`)}
${(props) => props.isDisabled && disableCss}
${(props) => props.isLoading && loadingCss}
${(props) => (props.isDisabled || props.isLoading) && disableCss}
&:focus {
&:focus {
outline: ${(props) => props.theme.button.outline};
}
.button-content {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
}
.loader {
display: flex;
justify-content: center;
@ -253,10 +220,17 @@ const StyledButton = styled(ButtonWrapper).attrs((props) => ({
width: 100%;
height: 100%;
background-color: ${(props) =>
props.primary
? props.theme.button.backgroundColor.primaryLoading
: props.theme.button.backgroundColor.baseLoading};
background-color: transparent;
}
.button-content {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
visibility: ${(props) => (props.isLoading ? "hidden" : "visible")};
}
.icon {

View File

@ -8,8 +8,8 @@
"deploy": "echo 'skip it'",
"start": "echo 'skip it'",
"start-prod": "echo 'skip it'",
"storybook": "start-storybook -p 8082 -s public",
"storybook-build": "build-storybook",
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 8082 -s public",
"storybook-build": "NODE_OPTIONS=--openssl-legacy-provider build-storybook",
"storybook-serve": "serve storybook-static -p 8082",
"test": "jest",
"test:coverage": "jest --coverage",
@ -53,14 +53,14 @@
"@babel/preset-react": "^7.14.5",
"@emotion/babel-preset-css-prop": "^10.2.1",
"@emotion/styled": "^10.0.27",
"@storybook/addon-actions": "6.3.0",
"@storybook/addon-actions": "6.5.13",
"@storybook/addon-contexts": "^5.3.21",
"@storybook/addon-controls": "6.3.0",
"@storybook/addon-docs": "6.3.0",
"@storybook/addon-essentials": "6.3.0",
"@storybook/addon-links": "6.3.0",
"@storybook/addon-viewport": "6.3.0",
"@storybook/react": "6.3.0",
"@storybook/addon-controls": "6.5.13",
"@storybook/addon-docs": "6.5.13",
"@storybook/addon-essentials": "6.5.13",
"@storybook/addon-links": "6.5.13",
"@storybook/addon-viewport": "6.5.13",
"@storybook/react": "6.5.13",
"@svgr/rollup": "^5.5.0",
"@svgr/webpack": "^5.5.0",
"@testing-library/react": "^9.5.0",
@ -81,6 +81,7 @@
"eslint": "^8.11.0",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-storybook": "^0.6.7",
"jest": "^24.9.0",
"jest-enzyme": "^7.1.2",
"jest-junit": "^10.0.0",
@ -91,6 +92,7 @@
"react-dom": "^17.0.2",
"react-json-pretty": "^2.2.0",
"react-values": "^0.3.3",
"serve": "^14.1.1",
"styled-components": "^5.3.1",
"svg-inline-loader": "^0.8.2"
}

View File

@ -145,12 +145,11 @@ const Base = {
baseHover: white,
baseActive: grayLightMid,
baseDisabled: grayLight,
baseLoading: grayLight,
primary: blueDenim,
primaryHover: blueDenimTransparent,
primaryActive: blueMaya,
primaryDisabled: blueSky,
primaryLoading: blueSky,
},
border: {
@ -158,13 +157,11 @@ const Base = {
baseHover: `1px solid ${blueDenim}`,
baseActive: `1px solid ${globalColors.grayMid}`,
baseDisabled: `1px solid ${globalColors.grayLightMid}`,
baseLoading: `1px solid ${globalColors.grayLightMid}`,
primary: `1px solid ${blueDenim}`,
primaryHover: `1px solid ${blueDenimTransparent}`,
primaryActive: `1px solid ${blueMaya}`,
primaryDisabled: `1px solid ${blueSky}`,
primaryLoading: `1px solid ${blueSky}`,
},
loader: {

View File

@ -140,13 +140,11 @@ const Dark = {
baseHover: "#333333",
baseActive: "#282828",
baseDisabled: "#282828",
baseLoading: "#282828",
primary: "#5299E0",
primaryHover: "#4D8AC7",
primaryActive: "#427CB7",
primaryDisabled: "#45709B",
primaryLoading: "#45709B",
},
border: {
@ -154,13 +152,11 @@ const Dark = {
baseHover: `1px solid #858585`,
baseActive: `1px solid #CCCCCC`,
baseDisabled: `1px solid #474747`,
baseLoading: `1px solid #474747`,
primary: `1px solid #5299E0`,
primaryHover: `1px solid #4D8AC7`,
primaryActive: `1px solid #427CB7`,
primaryDisabled: `1px solid #45709B`,
primaryLoading: `1px solid #45709B`,
},
loader: {

View File

@ -5,15 +5,16 @@
"homepage": "/doceditor",
"scripts": {
"build": "yarn clean && yarn build:client && yarn build:server",
"build:server": "webpack --mode production --config webpack/webpack.server.js",
"build:client": "webpack --mode production --config webpack/webpack.client.js",
"build:dev-server": "webpack --config webpack/webpack.server.js",
"build:dev-client": "webpack --config webpack/webpack.client.js",
"build:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack/webpack.server.js",
"build:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack/webpack.client.js",
"build:dev-server": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.server.js",
"build:dev-client": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.client.js",
"clean": "shx rm -rf dist",
"start": "yarn clean && npm-run-all --parallel start:client start:server start:common",
"start:client": "webpack --config webpack/webpack.client.js --watch --no-cache",
"start:server": "webpack --config webpack/webpack.server.js --watch --no-cache",
"start:common": "yarn build:dev-client && yarn build:dev-server && nodemon --watch dist/server.js dist/server.js",
"start:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.client.js --watch --no-cache",
"start:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.server.js --watch --no-cache",
"start:common": "yarn build:dev-client && yarn build:dev-server && NODE_OPTIONS=--openssl-legacy-provider nodemon --watch dist/server.js dist/server.js",
"start-prod": "NODE_OPTIONS=--openssl-legacy-provider node dist/server.js",
"deploy": "shx --silent mkdir -p ../../build/deploy/editor && shx cp -r dist/* ../../build/deploy/editor"
},
"devDependencies": {

View File

@ -6,6 +6,7 @@ import {
getSettings,
getBuildVersion,
getCurrentCustomSchema,
getAppearanceTheme,
} from "@docspace/common/api/settings";
import combineUrl from "@docspace/common/utils/combineUrl";
import { AppServerConfig } from "@docspace/common/constants";
@ -69,12 +70,14 @@ export const initDocEditor = async (req) => {
filesSettings,
versionInfo,
customNames,
appearanceTheme,
] = await Promise.all([
getUser(),
getSettings(),
getSettingsFiles(),
getBuildVersion(),
getCurrentCustomSchema("Common"),
getAppearanceTheme(),
]);
const successAuth = !!user;
@ -124,6 +127,7 @@ export const initDocEditor = async (req) => {
portalSettings: settings,
versionInfo,
customNames,
appearanceTheme,
};
} catch (err) {
error = { errorMessage: typeof err === "string" ? err : err.message };

View File

@ -5,28 +5,30 @@
"homepage": "/login",
"scripts": {
"build": "yarn clean && yarn build:client && yarn build:server",
"build:client": "webpack --mode production --config webpack/webpack.client.js",
"build:server": "webpack --mode production --config webpack/webpack.server.js",
"build:dev-server": "webpack --config webpack/webpack.server.js",
"build:dev-client": "webpack --config webpack/webpack.client.js",
"build:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack/webpack.client.js",
"build:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack/webpack.server.js",
"build:dev-server": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.server.js",
"build:dev-client": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.client.js",
"build-rooms": "yarn clean && yarn build-rooms:client && yarn build-rooms-server",
"build-rooms:client": "webpack --mode production --env rooms=true --config webpack/webpack.client.js",
"build-rooms:server": "webpack --mode production --env rooms=true --config webpack/webpack.server.js",
"build-rooms:dev-server": "webpack --env rooms=true --config webpack/webpack.server.js",
"build-rooms:dev-client": "webpack --env rooms=true --config webpack/webpack.client.js",
"build:test": "webpack --env minimize=false --mode production",
"build:test.translation": "webpack --env minimize=false hideText=true --mode production",
"build-rooms:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --env rooms=true --config webpack/webpack.client.js",
"build-rooms:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --env rooms=true --config webpack/webpack.server.js",
"build-rooms:dev-server": "NODE_OPTIONS=--openssl-legacy-provider webpack --env rooms=true --config webpack/webpack.server.js",
"build-rooms:dev-client": "NODE_OPTIONS=--openssl-legacy-provider webpack --env rooms=true --config webpack/webpack.client.js",
"clean": "shx rm -rf dist",
"start": "yarn clean && npm-run-all --parallel start:client start:server start:common",
"start:client": "webpack --config webpack/webpack.client.js --watch --no-cache",
"start:server": "webpack --config webpack/webpack.server.js --watch --no-cache",
"start:common": "yarn build:dev-client && yarn build:dev-server && nodemon --watch dist/server.js dist/server.js",
"start:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.client.js --watch --no-cache",
"start:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack/webpack.server.js --watch --no-cache",
"start:common": "yarn build:dev-client && yarn build:dev-server && NODE_OPTIONS=--openssl-legacy-provider nodemon --watch dist/server.js dist/server.js",
"start-rooms": "yarn clean && npm-run-all --parallel start-rooms:client start-rooms:server start-rooms:common",
"start-rooms:client": "webpack --env rooms=true --config webpack/webpack.client.js --watch --no-cache",
"start-rooms:server": "webpack --env rooms=true --config webpack/webpack.server.js --watch --no-cache",
"start-rooms:client": "NODE_OPTIONS=--openssl-legacy-provider webpack --env rooms=true --config webpack/webpack.client.js --watch --no-cache",
"start-rooms:server": "NODE_OPTIONS=--openssl-legacy-provider webpack --env rooms=true --config webpack/webpack.server.js --watch --no-cache",
"start-rooms:common": "yarn build-rooms:dev-client && yarn build-rooms:dev-server && nodemon --watch dist/server.js dist/server.js",
"start-prod": "webpack --mode production && serve dist -p 5011",
"deploy": "shx --silent mkdir -p ../../build/deploy/login && shx cp -r dist/* ../../build/deploy/login",
"start-prod": "NODE_OPTIONS=--openssl-legacy-provider node dist/server.js",
"deploy": "shx --silent mkdir -p ../../build/deploy/login && shx cp -r dist/* ../../build/deploy/login"
},
"old-scripts": {
"build:test": "NODE_OPTIONS=--openssl-legacy-provider webpack --env minimize=false --mode production",
"build:test.translation": "NODE_OPTIONS=--openssl-legacy-provider webpack --env minimize=false hideText=true --mode production",
"test:codeceptjs": "npx codeceptjs run --reporter mocha-multi",
"test:mobile": "cross-env DEVICE_TYPE=mobile yarn test:codeceptjs",
"test:smallTablet": "cross-env DEVICE_TYPE=smallTablet yarn test:codeceptjs",
@ -58,9 +60,6 @@
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.18.6",
"@codeceptjs/configure": "^0.7.0",
"@codeceptjs/examples": "^1.2.1",
"@codeceptjs/ui": "^0.4.6",
"@svgr/webpack": "^5.5.0",
"@types/accept-language-parser": "^1.5.3",
"@types/compression": "^1.7.2",
@ -75,8 +74,6 @@
"@types/winston": "^2.4.4",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^4.0.0",
"codeceptjs": "^3.2.2",
"codeceptjs-resemblehelper": "^1.9.5",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.2.0",
"external-remotes-plugin": "^1.0.0",

5116
yarn.lock

File diff suppressed because it is too large Load Diff