merge branch develop into branch feat/doublelink220820

This commit is contained in:
xiaodong zuo
2022-09-05 11:45:19 +08:00
175 changed files with 6576 additions and 4627 deletions
@@ -4,7 +4,7 @@ import { CloseIcon } from '@toeverything/components/common';
import { IconButton, MuiSnackbar, styled } from '@toeverything/components/ui';
import { services } from '@toeverything/datasource/db-service';
import { useLocalTrigger } from '@toeverything/datasource/state';
import { useTranslation } from 'react-i18next';
const cleanupWorkspace = (workspace: string) =>
new Promise((resolve, reject) => {
const req = indexedDB.deleteDatabase(workspace);
@@ -75,7 +75,7 @@ export const FileSystem = () => {
setError(true);
setTimeout(() => setError(false), 3000);
}, []);
const { t } = useTranslation();
const apiSupported = useMemo(() => fsApiSupported(), []);
if (apiSupported && !selected) {
@@ -105,7 +105,7 @@ export const FileSystem = () => {
}
}}
>
Sync to Disk
{t('Sync to Disk')}
</StyledFileSystem>
</>
);
@@ -11,6 +11,7 @@ import {
useShowSettingsSidebar,
} from '@toeverything/datasource/state';
import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { EditorBoardSwitcher } from './EditorBoardSwitcher';
import { FileSystem, fsApiSupported } from './FileSystem';
import { CurrentPageTitle } from './Title';
@@ -19,16 +20,17 @@ export const LayoutHeader = () => {
const [isLocalWorkspace] = useLocalTrigger();
const { toggleSettingsSidebar: toggleInfoSidebar, showSettingsSidebar } =
useShowSettingsSidebar();
const { t } = useTranslation();
const warningTips = useMemo(() => {
if (!fsApiSupported()) {
return 'Welcome to the AFFiNE demo. To begin saving changes you can SYNC DATA TO DISK with the latest version of Chromium based browser like Chrome/Edge';
return t('WarningTips.IsNotfsApiSupported');
} else if (!isLocalWorkspace) {
return 'Welcome to the AFFiNE demo. To begin saving changes you can SYNC TO DISK.';
return t('WarningTips.IsNotLocalWorkspace');
} else {
return 'AFFiNE is under active development and the current version is UNSTABLE. Please DO NOT store information or data';
return t('WarningTips.DoNotStore');
}
}, [isLocalWorkspace]);
}, [isLocalWorkspace, t]);
const { currentEditors } = useCurrentEditors();
@@ -50,7 +52,7 @@ export const LayoutHeader = () => {
<FlexContainer>
<StyledHelper>
<FileSystem />
<StyledShare disabled={true}>Share</StyledShare>
<StyledShare disabled={true}>{t('Share')}</StyledShare>
<div style={{ margin: '0px 12px' }}>
<IconButton
size="large"
@@ -153,9 +153,7 @@ function PageSettingPortal() {
const handleExportHtml = async () => {
//@ts-ignore
const htmlContent = await virgo.clipboard
.getClipboardParse()
.page2html();
const htmlContent = await virgo.clipboard.clipboardUtils.page2html();
const htmlTitle = pageBlock.title;
FileExporter.exportHtml(htmlTitle, htmlContent);
@@ -163,9 +161,7 @@ function PageSettingPortal() {
const handleExportMarkdown = async () => {
//@ts-ignore
const htmlContent = await virgo.clipboard
.getClipboardParse()
.page2html();
const htmlContent = await virgo.clipboard.clipboardUtils.page2html();
const htmlTitle = pageBlock.title;
FileExporter.exportMarkdown(htmlTitle, htmlContent);
};