diff --git a/frontend/src/css/umind.css b/frontend/src/css/umind.css
deleted file mode 100644
index f7e0760005..0000000000
--- a/frontend/src/css/umind.css
+++ /dev/null
@@ -1,71 +0,0 @@
-#wrapper {
- width: 100%;
- height: 100%;
- display: flex;
- overflow: hidden;
-}
-
-.umind-container {
- display: flex;
- flex: 1;
- flex-direction: column;
-}
-
-.umind-container .umind-header {
- padding: 8px;
- border: 1px solid #E6E9ED;
-}
-
-.umind-container .umind-body {
- display: flex;
- flex: 1;
-}
-
-.toolbar-container {
- display: flex;
-}
-
-.toolbar-container .custom-toolbar {
- width: auto;
-}
-
-.toolbar-container .common-toolbar {
- display: flex;
- flex: 1;
-}
-
-
-.umind-body .umind-editor-content,
-.umind-body .umind-editor-sidebar {
- display: flex;
- flex-direction: column;
-}
-
-.umind-editor-content .umind-editor {
- display: flex;
- flex: 1;
- background-color: #eee;
-}
-
-.umind-editor-sidebar {
- background: #FAFAFA;
-}
-
-.umind-editor-sidebar:first-child {
- border-right: 1px solid #E6E9ED;
-}
-
-.umind-editor-sidebar:last-child {
- border-left: 1px solid #E6E9ED;
-}
-
-.umind-editor-sidebar .detail-panel {
- flex: 1;
- display: flex;
- background: #FAFAFA;
-}
-
-.detail-panel .node-detail {
- flex: 1;
- background: #FAFAFA;
-}
diff --git a/frontend/src/umind/index.js b/frontend/src/umind/index.js
deleted file mode 100644
index 95290a62af..0000000000
--- a/frontend/src/umind/index.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import { Row, Col } from 'antd';
-import GGEditor, { Mind } from 'gg-editor';
-import { seafileAPI } from '../utils/seafile-api';
-import UMindToolbar from './umind-toolbar/umind-toolbar';
-import UMindDetailPanel from './umind-detail-panel';
-import UMindEditorMinimap from './umind-editor/umind-editor-minimap';
-import UMindContextMenu from './umind-editor/umind-context-menu';
-import Loading from '../components/loading';
-
-// import data from './mock.js';
-import 'antd/dist/antd.css';
-import './theme/iconfont.css'
-import '../css/umind.css';
-
-const propTypes = {
-
-};
-
-const { repoID, fileName, filePath } = window.app.pageOptions;
-
-class UMind extends React.Component {
-
- constructor(props) {
- super(props);
- this.state = {
- isLoading: true,
- data: ''
- };
- this.umindContent = '';
- }
-
- componentDidMount() {
- seafileAPI.getFileDownloadLink(repoID, filePath).then(res => {
- let url = res.data;
- seafileAPI.getFileContent(url).then(res => {
- let data = res.data;
- this.umindContent = data;
- this.setState({
- isLoading: false,
- data: data
- });
- });
- })
- }
-
- render() {
- return (
-
-
-
-
-
-
-
-
- {this.state.isLoading && }
- {!this.state.isLoading && (
-
- )}
-
-
-
-
-
-
-
-
- );
- }
-}
-
-UMind.propTypes = propTypes;
-
-export default UMind;
diff --git a/frontend/src/umind/theme/iconfont.css b/frontend/src/umind/theme/iconfont.css
deleted file mode 100644
index 65d8f71574..0000000000
--- a/frontend/src/umind/theme/iconfont.css
+++ /dev/null
@@ -1,114 +0,0 @@
-
-@font-face {
- font-family: "iconfont";
- src: url('//at.alicdn.com/t/font_598462_3xve1872wizzolxr.eot?t=1522149591264');
- src: url('//at.alicdn.com/t/font_598462_3xve1872wizzolxr.eot?t=1522149591264#iefix') format('embedded-opentype'),
- url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAxkAAsAAAAAFhgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kqhY21hcAAAAYAAAACyAAACShfSB3RnbHlmAAACNAAAB60AAA5gHgLkoWhlYWQAAAnkAAAALwAAADYQ7NeLaGhlYQAAChQAAAAgAAAAJAfsA4tobXR4AAAKNAAAABgAAABEQ+8AAGxvY2EAAApMAAAAJAAAACQZwB0obWF4cAAACnAAAAAfAAAAIAE3AMhuYW1lAAAKkAAAAUUAAAJtPlT+fXBvc3QAAAvYAAAAigAAAL30adEGeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2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Kokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nG2LXQ6CMBAG+/FbUES8xx6qlmKI2CVlmyint8FX520mGZWpH636z4AMOQqUqFBDo0GLE87ocEGPKwbcFN65jdIZK9EstM27I64srx9iPbrFSfJ8mqXakljRq9nEBeIiuJG1ME2BvRTRj9zszC+aPXEd/SNwXNujcBTi8gh1Gu7GPpX6AjVyKhcAAA==') format('woff'),
- url('//at.alicdn.com/t/font_598462_3xve1872wizzolxr.ttf?t=1522149591264') format('truetype'),
- url('//at.alicdn.com/t/font_598462_3xve1872wizzolxr.svg?t=1522149591264#iconfont') format('svg');
-}
-
-@font-face {
- font-family: "bi-icon";
- src: url('//at.alicdn.com/t/font_538964_lt8h7c2h3hfo5hfr.eot');
- src: url('//at.alicdn.com/t/font_538964_lt8h7c2h3hfo5hfr.eot?#iefix') format('embedded-opentype'),
- url('//at.alicdn.com/t/font_538964_lt8h7c2h3hfo5hfr.woff') format('woff'),
- url('//at.alicdn.com/t/font_538964_lt8h7c2h3hfo5hfr.ttf') format('truetype'),
- url('//at.alicdn.com/t/font_538964_lt8h7c2h3hfo5hfr.svg#iconfont') format('svg');
-}
-
-.iconfont {
- font-family:"iconfont" !important;
- font-size:16px;
- font-style:normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-.bi-icon {
- font-family:"bi-icon" !important;
- font-size:16px;
- font-style:normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-.icon-save:before {
- content: "\e669";
-}
-
-.icon-undo:before {
- content: "\e8ab";
-}
-
-.icon-redo:before {
- content: "\e8a9";
-}
-
-.icon-cut:before {
- content: "\e8a2";
-}
-
-.icon-copy-o:before {
- content: "\e8a4";
-}
-
-.icon-paster-o:before {
- content: "\e8a8";
-}
-
-.icon-delete-o:before {
- content: "\e8a5";
-}
-
-.icon-zoom-in-o:before {
- content: "\e8ac";
-}
-
-.icon-zoom-out-o:before {
- content: "\e8ae";
-}
-
-.icon-fit:before {
- content: "\e8a6";
-}
-
-.icon-actual-size-o:before {
- content: "\e8a3";
-}
-
-.icon-to-back:before {
- content: "\e8b0";
-}
-
-.icon-to-front:before {
- content: "\e8aa";
-}
-
-.icon-select:before {
- content: "\e8a7";
-}
-
-.icon-group:before {
- content: "\e8af";
-}
-
-.icon-ungroup:before {
- content: "\e8ad";
-}
-
-.icon-insert-sibling:before {
- content: "\e8af";
-}
-
-.icon-insert-child:before {
- content: "\e8ae";
-}
-
-.icon-collapse-subtree:before {
- content: "\e8b3";
-}
-
-.icon-expand-subtree:before {
- content: "\e8b4";
-}
diff --git a/frontend/src/umind/umind-detail-panel/index.js b/frontend/src/umind/umind-detail-panel/index.js
deleted file mode 100644
index 4e2f84c66d..0000000000
--- a/frontend/src/umind/umind-detail-panel/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react';
-import { Card } from 'antd';
-import { NodePanel, CanvasPanel, DetailPanel } from 'gg-editor';
-import NodeDetail from './node-detail';
-
-class UMindDetails extends React.Component {
-
- render() {
- return (
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default UMindDetails;
diff --git a/frontend/src/umind/umind-detail-panel/node-detail.js b/frontend/src/umind/umind-detail-panel/node-detail.js
deleted file mode 100644
index 19c33f250f..0000000000
--- a/frontend/src/umind/umind-detail-panel/node-detail.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import React from 'react';
-import { Card, Form, Input } from 'antd';
-import { withPropsAPI } from 'gg-editor';
-
-const { Item } = Form;
-
-const inlineFormItemLayout = {
- labelCol: {
- sm: { span: 6 },
- },
- wrapperCol: {
- sm: { span: 18 },
- },
-};
-
-class NodeDetail extends React.Component {
- handleSubmit = (e) => {
- e.preventDefault();
-
- const { form, propsAPI } = this.props;
- const { getSelected, executeCommand, update } = propsAPI;
-
- form.validateFieldsAndScroll((err, values) => {
- if (err) {
- return;
- }
-
- const item = getSelected()[0];
-
- if (!item) {
- return;
- }
-
- executeCommand(() => {
- update(item, {
- ...values,
- });
- });
- });
- }
-
- render() {
- const { form, propsAPI } = this.props;
- const { getFieldDecorator } = form;
- const { getSelected } = propsAPI;
-
- const item = getSelected()[0];
-
- if (!item) {
- return null;
- }
-
- const { label } = item.getModel();
-
- return (
-
-
-
- );
- }
-}
-
-export default Form.create()(withPropsAPI(NodeDetail));
diff --git a/frontend/src/umind/umind-editor/context-menu.css b/frontend/src/umind/umind-editor/context-menu.css
deleted file mode 100644
index fefaae9c8d..0000000000
--- a/frontend/src/umind/umind-editor/context-menu.css
+++ /dev/null
@@ -1,33 +0,0 @@
-.context-menu {
- display: none;
- background: #FFFFFF;
- border-radius: 4px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
- overflow: hidden;
-}
-
-.context-menu .item {
- cursor: pointer;
- user-select: none;
- display: flex;
- align-items: center;
- padding: 5px 12px;
- transition: all .3s;
-}
-
-.context-menu .item:hover {
- background: #E6F7FF;
-}
-
-.context-menu .item i {
- margin-right: 8px;
-}
-
-.context-menu .disable .item {
- cursor: auto;
- color: rgba(0, 0, 0, 0.25);
-}
-
-.context-menu .disable .item:hover {
- background: #FFFFFF;
-}
diff --git a/frontend/src/umind/umind-editor/umind-context-menu.js b/frontend/src/umind/umind-editor/umind-context-menu.js
deleted file mode 100644
index 4b841352f6..0000000000
--- a/frontend/src/umind/umind-editor/umind-context-menu.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import React from 'react';
-import { Command, NodeMenu, CanvasMenu, ContextMenu } from 'gg-editor';
-
-import './context-menu.css';
-
-class UMindContextMenu extends React.Component {
- render() {
- return (
-
-
-
-
-
- 插入同级
-
-
-
-
-
- 插入子级
-
-
-
-
-
- 折叠
-
-
-
-
-
- 展开
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
- 撤销
-
-
-
-
-
- 重做
-
-
-
-
- );
- }
-}
-
-export default UMindContextMenu;
diff --git a/frontend/src/umind/umind-editor/umind-editor-minimap.js b/frontend/src/umind/umind-editor/umind-editor-minimap.js
deleted file mode 100644
index 3fd64f5934..0000000000
--- a/frontend/src/umind/umind-editor/umind-editor-minimap.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-import { Card } from 'antd';
-import { Minimap } from 'gg-editor';
-
-class UMindEditorMinimap extends React.Component {
- render() {
- return (
-
-
-
- );
- }
-}
-
-export default UMindEditorMinimap;
diff --git a/frontend/src/umind/umind-toolbar/toolbar.css b/frontend/src/umind/umind-toolbar/toolbar.css
deleted file mode 100644
index 1a54e43231..0000000000
--- a/frontend/src/umind/umind-toolbar/toolbar.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.common-toolbar {
- display: flex;
- align-items: center;
-}
-
-.common-toolbar .command i {
- cursor: pointer;
- display: inline-block;
- margin: 0 6px;
- width: 27px;
- height: 27px;
- text-align: center;
- border: 1px solid #FFFFFF;
-}
-
-.common-toolbar .command i:hover {
- border: 1px solid #E6E9ED;
-}
-
-.common-toolbar .disable i {
- cursor: auto;
- color: rgba(0, 0, 0, 0.25);
-}
-
-.common-toolbar .disable i:hover {
- border: 1px solid #FFFFFF;
-}
-
-.tooltip .ant-tooltip-inner {
- font-size: 12px;
- border-radius: 0;
-}
-
-.common-toolbar .anticon.custom-save {
- display: flex;
- justify-content: center;
- align-items: center;
-}
\ No newline at end of file
diff --git a/frontend/src/umind/umind-toolbar/umind-toolbar.js b/frontend/src/umind/umind-toolbar/umind-toolbar.js
deleted file mode 100644
index 70d4326562..0000000000
--- a/frontend/src/umind/umind-toolbar/umind-toolbar.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import React, { Fragment } from 'react';
-import { Tooltip, Divider, Icon } from 'antd';
-import { Toolbar, Command } from 'gg-editor';
-import withGGEditorContext from 'gg-editor/es/common/context/GGEditorContext/withGGEditorContext';
-import { gettext } from '../../utils/constants';
-import { seafileAPI } from '../../utils/seafile-api';
-import { Utils } from '../../utils/utils';
-import toaster from '../../components/toast';
-
-import './toolbar.css';
-
-const { repoID, filePath, fileName } = window.app.pageOptions;
-class UMindToolbar extends React.Component {
-
- onSaveClick = (e) => {
- e.preventDefault();
- let { editor } = this.props;
- let page = editor.getCurrentPage();
- let { data, defaultData } = page._cfg;
- let dirPath = Utils.getDirName(filePath);
- seafileAPI.getUpdateLink(repoID, dirPath).then(res => {
- let updateLink = res.data;
- // need optimized
- let updateData = data ? JSON.stringify(data) : JSON.stringify(defaultData);
- seafileAPI.updateFile(updateLink, filePath, fileName, updateData).then(res => {
- toaster.success(gettext('File saved.'));
- }).catch(() => {
- toaster.success(gettext('File save failed.'));
- });
- })
- }
-
- render() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default withGGEditorContext(UMindToolbar);
diff --git a/frontend/src/view-file-umind.js b/frontend/src/view-file-umind.js
index a1110416c4..46602528ff 100644
--- a/frontend/src/view-file-umind.js
+++ b/frontend/src/view-file-umind.js
@@ -1,17 +1,90 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import UMind from './umind';
+import { seafileAPI } from './utils/seafile-api';
+import { Utils } from './utils/utils';
+import { gettext, lang } from './utils/constants';
+import toaster from './components/toast';
-class ViewFileUMind extends React.Component {
+const { UMind, React, ReactDOM } = window;
+const { repoID, filePath, fileName, username } = window.app.pageOptions;
+
+const DEFAULT_DATA = {
+ roots: [{
+ label: '中心主题',
+ children: [{
+ label: '分支主题 1',
+ }, {
+ label: '分支主题 2',
+ }, {
+ label: '分支主题 3',
+ }],
+ }],
+};
+
+class ViewFileUmind extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ data: DEFAULT_DATA,
+ isDataLoading: true
+ };
+ this.locale = 'zh-CN';
+ this.config = {
+ file: {
+ id: repoID + filePath,
+ },
+ user: {
+ id: username,
+ },
+ socket: {
+ url: 'https://umind.alibaba-inc.com',
+ events: {
+ user: 'user',
+ operation: 'operation',
+ },
+ onUserListChange: () => {},
+ },
+ };
+ }
+
+ componentDidMount() {
+ seafileAPI.getFileDownloadLink(repoID, filePath).then(res => {
+ let url = res.data;
+ seafileAPI.getFileContent(url).then(res => {
+ if (res.data) {
+ this.setState({
+ isDataLoading: false,
+ data: res.data
+ });
+ } else {
+ this.setState({
+ isDataLoading: false,
+ data: DEFAULT_DATA
+ });
+ }
+ }).catch(() => {
+ // toaster.success(gettext('file loading error'));
+ });
+ });
+ }
+
+ handleSave = (data) => {
+ let dirPath = Utils.getDirName(filePath);
+ seafileAPI.getUpdateLink(repoID, dirPath).then(res => {
+ let updateLink = res.data;
+ let updateData = JSON.stringify(data);
+ seafileAPI.updateFile(updateLink, filePath, fileName, updateData).then(res => {
+ // toaster.success(gettext('File saved.'));
+ }).catch(() => {
+ // toaster.success(gettext('File saved failed.'));
+ });
+ });
+ }
render() {
return (
-
+
);
}
}
-ReactDOM.render(
- ,
- document.getElementById('wrapper')
-);
\ No newline at end of file
+ReactDOM.render(, document.getElementById('root'));
\ No newline at end of file
diff --git a/seahub/templates/umind_file_view_react.html b/seahub/templates/umind_file_view_react.html
new file mode 100644
index 0000000000..8aa7cad0d6
--- /dev/null
+++ b/seahub/templates/umind_file_view_react.html
@@ -0,0 +1,111 @@
+{% load seahub_tags i18n staticfiles %}
+{% load render_bundle from webpack_loader %}
+
+
+
+
+
+
+
+ {% block viewport %}
+
+ {% endblock %}
+ {% block sub_title %}{% endblock %}{{ site_title }}
+
+
+
+
+
+
+
+
+
+
+
+ {% block render_bundle %}
+ {% render_bundle 'viewFileUMind' 'js'%}
+ {% endblock %}
+
+
diff --git a/seahub/templates/view_file_umind.html b/seahub/templates/view_file_umind.html
deleted file mode 100644
index 805308c1e1..0000000000
--- a/seahub/templates/view_file_umind.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% extends 'file_view_react.html' %}
-{% load render_bundle from webpack_loader %}
-
-{% block extra_style %}
-{% render_bundle 'viewFileUMind' 'css' %}
-{% endblock %}
-
-{% block render_bundle %}
-{% render_bundle 'viewFileUMind' 'js'%}
-{% endblock %}
diff --git a/seahub/views/file.py b/seahub/views/file.py
index 4afced79a6..601b2586c1 100644
--- a/seahub/views/file.py
+++ b/seahub/views/file.py
@@ -728,7 +728,7 @@ def view_lib_file(request, repo_id, path):
return render(request, template, return_dict)
elif filetype == UMIND:
- return render(request, 'view_file_umind.html', return_dict)
+ return render(request, 'umind_file_view_react.html', return_dict)
elif filetype == IMAGE:
template = '%s_file_view_react.html' % filetype.lower()