diff --git a/package.json b/package.json index e2760c58..7cd5526f 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,11 @@ "@fortawesome/fontawesome-free": "^5.15.3", "amis": "6.7.0", "amis-core": "6.7.0", - "amis-formula": "6.7.0", - "amis-ui": "6.7.0", "amis-editor": "6.7.0", "amis-editor-core": "6.7.0", + "amis-editor-demo": "file:", + "amis-formula": "6.7.0", + "amis-ui": "6.7.0", "axios": "0.21.1", "copy-to-clipboard": "^3.2.0", "mobx": "4.15.7", @@ -43,6 +44,7 @@ "react-router-dom": "5.0.1" }, "devDependencies": { + "@types/file-saver": "^2.0.7", "@types/lodash": "^4.14.123", "@types/node": "^11.13.8", "@types/qs": "^6.5.3", diff --git a/src/route/Preview.tsx b/src/route/Preview.tsx index e1ab2378..5fdd6f7b 100644 --- a/src/route/Preview.tsx +++ b/src/route/Preview.tsx @@ -7,6 +7,7 @@ import {Link} from 'react-router-dom'; import NotFound from './NotFound'; import AMISRenderer from '../component/AMISRenderer'; import AddPageModal from '../component/AddPageModal'; +import {saveAs} from 'file-saver'; function isActive(link: any, location: any) { const ret = matchPath(location?.pathname, { @@ -24,6 +25,12 @@ export default inject('store')( location, history }: {store: IMainStore} & RouteComponentProps) { + function handleExportAll() { + const data = JSON.stringify(store.pages, null, 2); + const blob = new Blob([data], {type: 'application/json'}); + saveAs(blob, 'amis_pages_export.json'); + } + function renderHeader() { return ( <> @@ -35,7 +42,7 @@ export default inject('store')(