merge branch develop into branch feat/doublelink220820

This commit is contained in:
xiaodong zuo
2022-09-06 10:01:09 +08:00
20 changed files with 284 additions and 260 deletions
@@ -13,7 +13,7 @@ import {
import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { EditorBoardSwitcher } from './EditorBoardSwitcher';
import { FileSystem, fsApiSupported } from './FileSystem';
import { fsApiSupported } from './FileSystem';
import { CurrentPageTitle } from './Title';
export const LayoutHeader = () => {
@@ -51,7 +51,6 @@ export const LayoutHeader = () => {
</FlexContainer>
<FlexContainer>
<StyledHelper>
<FileSystem />
<StyledShare disabled={true}>{t('Share')}</StyledShare>
<div style={{ margin: '0px 12px' }}>
<IconButton
@@ -76,9 +75,6 @@ export const LayoutHeader = () => {
<EditorBoardSwitcher />
</StyledContainerForEditorBoardSwitcher>
</StyledHeaderRoot>
<StyledUnstableTips>
<StyledUnstableTipsText>{warningTips}</StyledUnstableTipsText>
</StyledUnstableTips>
</StyledContainerForHeaderRoot>
);
};
@@ -58,8 +58,6 @@ function PageSettingPortal() {
const navigate = useNavigate();
const { user } = useUserAndSpaces();
const BooleanFullWidthChecked = useFlag('BooleanFullWidthChecked', false);
const BooleanExportWorkspace = useFlag('BooleanExportWorkspace', false);
const BooleanImportWorkspace = useFlag('BooleanImportWorkspace', false);
const BooleanExportHtml = useFlag('BooleanExportHtml', false);
const BooleanExportPdf = useFlag('BooleanExportPdf', false);
const BooleanExportMarkdown = useFlag('BooleanExportMarkdown', false);
@@ -217,18 +215,14 @@ function PageSettingPortal() {
/>
)}
<Divider />
{BooleanImportWorkspace && (
<ListButton
content="Import Workspace"
onClick={handleImportWorkspace}
/>
)}
{BooleanExportWorkspace && (
<ListButton
content="Export Workspace"
onClick={handleExportWorkspace}
/>
)}
<ListButton
content="Import Workspace"
onClick={handleImportWorkspace}
/>
<ListButton
content="Export Workspace"
onClick={handleExportWorkspace}
/>
<p className="textDescription">
Last edited by {user && user.nickname}
@@ -49,7 +49,7 @@ export const SettingsList = () => {
{item.key === 'Language' ? (
<div style={{ marginLeft: '12em' }}>
<Select
defaultValue={options[0].value}
defaultValue={i18n.language}
onChange={changeLanguage}
>
{options.map(option => (
@@ -2,8 +2,6 @@ import { useFlag } from '@toeverything/datasource/feature-flags';
export const useSettingFlags = () => {
const booleanFullWidthChecked = useFlag('BooleanFullWidthChecked', false);
const booleanExportWorkspace = useFlag('BooleanExportWorkspace', false);
const booleanImportWorkspace = useFlag('BooleanImportWorkspace', false);
const booleanExportHtml = useFlag('BooleanExportHtml', false);
const booleanExportPdf = useFlag('BooleanExportPdf', false);
const booleanExportMarkdown = useFlag('BooleanExportMarkdown', false);
@@ -11,8 +9,6 @@ export const useSettingFlags = () => {
return {
booleanFullWidthChecked,
booleanExportWorkspace,
booleanImportWorkspace,
booleanExportHtml,
booleanExportPdf,
booleanExportMarkdown,
@@ -145,26 +145,24 @@ export const useSettings = (): SettingItem[] => {
type: 'separator',
key: 'separator2',
},
{
type: 'button',
name: t('Clear Workspace'),
key: 'Clear Workspace',
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},
{
type: 'button',
name: t('Import Workspace'),
key: 'Import Workspace',
onClick: () => importWorkspace(workspaceId),
flag: 'booleanImportWorkspace',
onClick: () => importWorkspace(),
},
{
type: 'button',
name: t('Export Workspace'),
key: 'Export Workspace',
onClick: () => exportWorkspace(),
flag: 'booleanExportWorkspace',
},
{
type: 'button',
name: t('Clear Workspace'),
key: 'Clear Workspace',
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},
];
@@ -1,14 +1,15 @@
/**
* @deprecated debugging method, deprecated
*/
export const importWorkspace = (workspaceId: string) => {
//@ts-ignore
window.client
.inspector()
.load()
.then(() => {
window.location.href = `/${workspaceId}/`;
});
export const importWorkspace = async () => {
if (window.confirm('Your currently open data will be lost.')) {
//@ts-ignore
const status = await window.client.inspector().load();
if (status) {
window.location.reload();
}
}
};
/**