import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons'; import { timeFormat } from '@src/components/docs/plugins/SideComment/utils'; import { Slate } from '@src/components/slate-packages/slate-react'; import { judgePhone, TripdocsSdkContext } from '@src/Docs'; import { getCache, setCache } from '@src/utils/cacheUtils'; import { createUUID } from '@src/utils/randomId'; import sessStorage from '@src/utils/sessStorage'; import { Button, Collapse } from 'antd'; import React, { useEffect, useMemo, useState } from 'react'; import { FallbackProps } from 'react-error-boundary'; const { Panel } = Collapse; export const FallbackComponent: React.FunctionComponent = (props: FallbackProps & any) => { const { docId, editor, fallback } = props; const docIdMemo = useMemo(() => docId, []); const docContentQueue = sessStorage.get('tripdocs_sdk/docContentCacheArr_' + docIdMemo) || []; const docContent = docContentQueue.length > 0 && docContentQueue[0]; console.log('[FallbackComponent] : ', props); const [showErrorMsg, setShowErrorMsg] = useState(false); const [count, setCount] = useState(0); useEffect(() => { const errorId = sessStorage.get('tripdocs_sdk/ubtErrorId'); const id = errorId || 'new_' + createUUID(); const options = getCache(docId, 'options'); setTimeout(() => { const eid = getCache(docId, 'e:' + id); if (!eid) { options?.fallbackCallback(); if (options?.openRrweb) { window.tripdocs?.rrwebRecord?.upload(() => {}, 'error id : ' + id, 'tripdocsError'); } setCache(docId, 'e:' + id, true); } }, 300); }, []); const isMobile = useMemo(judgePhone, []); function joinTripPalGroupForPC(url: string, isInElectron: boolean) { if (window?.ctxBridge) { window?.ctxBridge?.openExternal(url); } else { const cchatHref = url; const newWindow = window.open(cchatHref, '_blank'); isInElectron && setTimeout(() => newWindow.close(), 100); } } return (
{}
{ setCount(prev => prev + 1); }} style={{ textAlign: 'center', }} > 很抱歉😧, {isMobile &&
} 编辑器出现了异常,请
您可以选择 {!isMobile && ( <> 并 )} {!isMobile && (请在群里上传报错日志)}
{count >= 8 && ( <>
{ setShowErrorMsg(prev => !prev); }} > 报错信息 ▶️

{fallback.error.message}

{fallback.error.stack}

{editor?.history?.undos && JSON.stringify(editor.history.undos.length > 3 ? editor.history.undos.slice(0, 3) : editor.history.undos)}
)}
); };