@seafile/sdoc-editor 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/api/sdoc-server-api.js +13 -0
  2. package/dist/assets/css/collaborator-popover.css +75 -0
  3. package/dist/assets/css/simple-editor.css +5 -0
  4. package/dist/basic-sdk/assets/css/layout.css +2 -2
  5. package/dist/basic-sdk/assets/css/sdoc-editor-toolbar.css +1 -0
  6. package/dist/basic-sdk/extension/menu/menu.css +1 -1
  7. package/dist/basic-sdk/index.js +2 -1
  8. package/dist/basic-sdk/socket/socket-client.js +2 -2
  9. package/dist/basic-sdk/socket/socket-manager.js +1 -4
  10. package/dist/basic-sdk/utils/event-bus.js +8 -0
  11. package/dist/components/doc-operations/collaborators-operation/collaborators-popover.js +54 -0
  12. package/dist/components/doc-operations/collaborators-operation/index.js +107 -0
  13. package/dist/components/doc-operations/index.js +37 -0
  14. package/dist/components/doc-operations/style.css +25 -0
  15. package/dist/components/tip-message/index.js +48 -11
  16. package/dist/context.js +5 -0
  17. package/dist/layout/layout.css +1 -1
  18. package/dist/pages/simple-editor.js +3 -42
  19. package/package.json +1 -1
  20. package/public/index.html +1 -1
  21. package/public/locales/en/sdoc-editor.json +4 -1
  22. package/public/locales/zh-CN/sdoc-editor.json +3 -1
  23. package/public/media/sdoc-editor-font/iconfont.eot +0 -0
  24. package/public/media/sdoc-editor-font/iconfont.svg +129 -0
  25. package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
  26. package/public/media/sdoc-editor-font/iconfont.woff +0 -0
  27. package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
  28. package/public/media/{seafile-editor-font.css → sdoc-editor-font.css} +124 -107
  29. package/public/locales/zh-CN/seafile-editor.json +0 -225
  30. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  31. package/public/media/seafile-editor-font/iconfont.svg +0 -121
  32. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  33. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  34. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
@@ -47,6 +47,19 @@ var SDocServerApi = /*#__PURE__*/function () {
47
47
  }
48
48
  });
49
49
  }
50
+ }, {
51
+ key: "getCollaborators",
52
+ value: function getCollaborators() {
53
+ var server = this.server,
54
+ docUuid = this.docUuid,
55
+ accessToken = this.accessToken;
56
+ var url = "".concat(server, "/api/v1/docs/").concat(docUuid, "/collaborators/");
57
+ return axios.get(url, {
58
+ headers: {
59
+ Authorization: "Token ".concat(accessToken)
60
+ }
61
+ });
62
+ }
50
63
  }]);
51
64
  return SDocServerApi;
52
65
  }();
@@ -0,0 +1,75 @@
1
+ .collaborators-popover.popover {
2
+ width: 300px;
3
+ max-width: 300px;
4
+ }
5
+
6
+ .collaborators-popover .popover-container {
7
+ padding: 0;
8
+ margin: 0;
9
+ max-height: 360px;
10
+ display: flex;
11
+ flex-direction: column;
12
+ justify-content: center;
13
+ }
14
+
15
+ .collaborators-popover .popover-header {
16
+ height: 50px;
17
+ min-height: 50px;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ font-weight: 600;
22
+ font-size: 16px;
23
+ border-bottom: 1px solid #ededed;
24
+ color: #212529;
25
+ }
26
+
27
+ .collaborators-popover .popover-container .content-list {
28
+ flex: 1;
29
+ display: flex;
30
+ flex-direction: column;
31
+ min-height: 0;
32
+ overflow: auto;
33
+ padding: 5px 0;
34
+ }
35
+
36
+ .content-list .collaborator-details {
37
+ height: 32px;
38
+ line-height: 32px;
39
+ width: 100%;
40
+ display: flex;
41
+ align-items: center;
42
+ padding: 3px 12px;
43
+
44
+ }
45
+
46
+ .content-list .collaborator-details:hover {
47
+ background-color: #f8f8f8;
48
+ }
49
+
50
+ .content-list .collaborator-details .collaborator-tag {
51
+ margin-right: 8px;
52
+ height: 5px;
53
+ width: 5px;
54
+ background-color: #08DB6B;
55
+ border-radius: 50%;
56
+ overflow: hidden;
57
+ }
58
+
59
+ .content-list .collaborator-details .collaborator-avatar {
60
+ margin-right: 8px;
61
+ height: 20px;
62
+ width: 20px;
63
+ border-radius: 50%;
64
+ overflow: hidden;
65
+ }
66
+
67
+ .content-list .collaborator-details .collaborator-name {
68
+ max-width: calc(100% - 20px);
69
+ overflow: hidden;
70
+ white-space: nowrap;
71
+ text-overflow: ellipsis;
72
+ color: #212529;
73
+ }
74
+
75
+
@@ -2,3 +2,8 @@
2
2
  display: flex;
3
3
  align-items: center;
4
4
  }
5
+
6
+ .sdoc-editor-page-header .doc-info .doc-name {
7
+ font-size: 18px;
8
+ color: #212529;
9
+ }
@@ -14,10 +14,10 @@
14
14
  .sdoc-editor-container .sdoc-editor-toolbar {
15
15
  display: flex;
16
16
  justify-content: center;
17
- height: 39px;
17
+ height: 44px;
18
18
  align-items: center;
19
19
  padding: 0 10px;
20
- background-color: #fcfcfc;
20
+ background-color: #fff;
21
21
  user-select: none;
22
22
  border-bottom: 1px solid #e5e5e5;
23
23
  box-shadow: 0 3px 2px -2px rgb(200 200 200 / 15%)
@@ -14,6 +14,7 @@
14
14
  display: flex;
15
15
  justify-content: space-between;
16
16
  align-items: center;
17
+ margin: 0 5px;
17
18
  }
18
19
 
19
20
  .header-menu .header-toggle .iconfont {
@@ -13,7 +13,7 @@
13
13
  border: 1px solid transparent;
14
14
  line-height: 30px;
15
15
  color: #555555;
16
- background-color: #fcfcfc;
16
+ background-color: #fff;
17
17
  }
18
18
 
19
19
  .menu-group .menu-group-item:disabled {
@@ -1,3 +1,4 @@
1
1
  import SDocEditor from './editor';
2
2
  import SDocViewer from './viewer';
3
- export { SDocEditor, SDocViewer };
3
+ import EventBus from './utils/event-bus';
4
+ export { SDocEditor, SDocViewer, EventBus };
@@ -126,8 +126,8 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
126
126
  this.isReconnect = false;
127
127
  this.socket = io(config.sdocServer, {
128
128
  reconnection: true,
129
- query: {
130
- doc_uuid: config.docUuid
129
+ auth: {
130
+ token: config.accessToken
131
131
  }
132
132
  });
133
133
  this.socket.on('connect', this.onConnected);
@@ -156,9 +156,6 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
156
156
  _this.editor.isRemote = false;
157
157
  });
158
158
  };
159
- this.subscribe = function (type, handler) {
160
- return _this.eventBus.subscribe(type, handler);
161
- };
162
159
  this.dispatchConnectState = function (type, message) {
163
160
  _this.eventBus.dispatch(type, message);
164
161
  };
@@ -172,7 +169,7 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
172
169
  this.pendingOperationList = []; // Two-dimensional arrays: [operations, operations, ...]
173
170
  this.remoteOperationsList = []; // Same with pending operations
174
171
  this.revertOperationList = [];
175
- this.eventBus = new EventBus();
172
+ this.eventBus = EventBus.getInstance();
176
173
  });
177
174
  SocketManager.getInstance = function (editor, document, socketConfig) {
178
175
  if (SocketManager.instance) {
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  var EventBus = /*#__PURE__*/function () {
4
4
  function EventBus() {
5
5
  _classCallCheck(this, EventBus);
6
+ this.instance = null;
6
7
  this.subscribers = {};
7
8
  }
8
9
  _createClass(EventBus, [{
@@ -33,6 +34,13 @@ var EventBus = /*#__PURE__*/function () {
33
34
  });
34
35
  }
35
36
  }
37
+ }], [{
38
+ key: "getInstance",
39
+ value: function getInstance() {
40
+ if (this.instance) return this.instance;
41
+ this.instance = new EventBus();
42
+ return this.instance;
43
+ }
36
44
  }]);
37
45
  return EventBus;
38
46
  }();
@@ -0,0 +1,54 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import { withTranslation } from 'react-i18next';
7
+ import { UncontrolledPopover, PopoverBody, PopoverHeader } from 'reactstrap';
8
+ import '../../../assets/css/collaborator-popover.css';
9
+ var CollaboratorsPopover = /*#__PURE__*/function (_React$PureComponent) {
10
+ _inherits(CollaboratorsPopover, _React$PureComponent);
11
+ var _super = _createSuper(CollaboratorsPopover);
12
+ function CollaboratorsPopover() {
13
+ _classCallCheck(this, CollaboratorsPopover);
14
+ return _super.apply(this, arguments);
15
+ }
16
+ _createClass(CollaboratorsPopover, [{
17
+ key: "render",
18
+ value: function render() {
19
+ var _this$props = this.props,
20
+ t = _this$props.t,
21
+ collaborators = _this$props.collaborators;
22
+ return /*#__PURE__*/React.createElement(UncontrolledPopover, {
23
+ target: "collaborators",
24
+ placement: "bottom-end",
25
+ popperClassName: "collaborators-popover",
26
+ trigger: "legacy",
27
+ hideArrow: true,
28
+ security: "fixed"
29
+ }, /*#__PURE__*/React.createElement(PopoverHeader, {
30
+ className: "popover-header"
31
+ }, t('Online_members'), ' ', "(", collaborators.length, ")"), /*#__PURE__*/React.createElement(PopoverBody, {
32
+ className: "popover-container"
33
+ }, /*#__PURE__*/React.createElement("div", {
34
+ className: "content-list"
35
+ }, collaborators.map(function (item, index) {
36
+ var name = index === 0 ? "".concat(item.name, " (").concat(t('me'), ")") : item.name;
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ key: index,
39
+ className: "collaborator-details"
40
+ }, /*#__PURE__*/React.createElement("span", {
41
+ className: "collaborator-tag"
42
+ }), /*#__PURE__*/React.createElement("img", {
43
+ className: "collaborator-avatar",
44
+ alt: name,
45
+ src: item.avatar_url
46
+ }), /*#__PURE__*/React.createElement("span", {
47
+ className: "collaborator-name"
48
+ }, name));
49
+ }))));
50
+ }
51
+ }]);
52
+ return CollaboratorsPopover;
53
+ }(React.PureComponent);
54
+ export default withTranslation('sdoc-editor')(CollaboratorsPopover);
@@ -0,0 +1,107 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Fragment } from 'react';
6
+ import { EventBus } from '../../../basic-sdk';
7
+ import context from '../../../context';
8
+ import CollaboratorsPopover from './collaborators-popover';
9
+ var URL = 'https://tupian.qqw21.com/article/UploadPic/2020-8/20208522181570993.jpg';
10
+ var CollaboratorsOperation = /*#__PURE__*/function (_React$PureComponent) {
11
+ _inherits(CollaboratorsOperation, _React$PureComponent);
12
+ var _super = _createSuper(CollaboratorsOperation);
13
+ function CollaboratorsOperation(props) {
14
+ var _this;
15
+ _classCallCheck(this, CollaboratorsOperation);
16
+ _this = _super.call(this, props);
17
+ _this.getUserInfo = function (username) {
18
+ return {
19
+ name: username,
20
+ username: username,
21
+ avatar_url: URL
22
+ };
23
+ };
24
+ _this.onUserJoinRoom = function (username) {
25
+ var collaborators = _this.state.collaborators;
26
+ var newCollaborators = collaborators.slice();
27
+ if (!newCollaborators.find(function (user) {
28
+ return user.username === username;
29
+ })) {
30
+ var newUser = _this.getUserInfo(username);
31
+ newCollaborators.push(newUser);
32
+ _this.setState({
33
+ collaborators: newCollaborators
34
+ });
35
+ }
36
+ };
37
+ _this.onUserLeaveRoom = function (username) {
38
+ if (_this.currentUser.username === username) return;
39
+ var collaborators = _this.state.collaborators;
40
+ var newCollaborators = collaborators.slice();
41
+ if (newCollaborators.find(function (user) {
42
+ return user.username === username;
43
+ })) {
44
+ newCollaborators = newCollaborators.filter(function (user) {
45
+ return user.username !== username;
46
+ });
47
+ _this.setState({
48
+ collaborators: newCollaborators
49
+ });
50
+ }
51
+ };
52
+ var _username = context.getSetting('username');
53
+ _this.currentUser = _this.getUserInfo(_username);
54
+ _this.state = {
55
+ collaborators: [_this.currentUser]
56
+ };
57
+ return _this;
58
+ }
59
+ _createClass(CollaboratorsOperation, [{
60
+ key: "componentDidMount",
61
+ value: function componentDidMount() {
62
+ var _this2 = this;
63
+ context.getCollaborators().then(function (res) {
64
+ var collaborators = res.data.collaborators;
65
+ var newCollaborators = collaborators.map(function (item) {
66
+ return _this2.getUserInfo(item);
67
+ });
68
+ // delete current user and push it at first one
69
+ var currentUserIndex = newCollaborators.findIndex(function (user) {
70
+ return user.username === _this2.currentUser.username;
71
+ });
72
+ console.log(currentUserIndex);
73
+ if (currentUserIndex > -1) {
74
+ newCollaborators.splice(currentUserIndex, 1);
75
+ }
76
+ newCollaborators.unshift(_this2.currentUser);
77
+ _this2.setState({
78
+ collaborators: newCollaborators
79
+ });
80
+ });
81
+ var eventBus = EventBus.getInstance();
82
+ this.unsubscribeJoinEvent = eventBus.subscribe('join-room', this.onUserJoinRoom);
83
+ this.unsubscribeLeaveEvent = eventBus.subscribe('leave-room', this.onUserLeaveRoom);
84
+ }
85
+ }, {
86
+ key: "componentWillUnmount",
87
+ value: function componentWillUnmount() {
88
+ this.unsubscribeJoinEvent();
89
+ this.unsubscribeLeaveEvent();
90
+ }
91
+ }, {
92
+ key: "render",
93
+ value: function render() {
94
+ var collaborators = this.state.collaborators;
95
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
96
+ className: "op-item",
97
+ id: "collaborators"
98
+ }, /*#__PURE__*/React.createElement("i", {
99
+ className: "iconfont icon-user mr-1"
100
+ }), collaborators.length), /*#__PURE__*/React.createElement(CollaboratorsPopover, {
101
+ collaborators: collaborators
102
+ }));
103
+ }
104
+ }]);
105
+ return CollaboratorsOperation;
106
+ }(React.PureComponent);
107
+ export default CollaboratorsOperation;
@@ -0,0 +1,37 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Fragment } from 'react';
6
+ import CollaboratorsOperation from './collaborators-operation';
7
+ import './style.css';
8
+ var DocOperations = /*#__PURE__*/function (_React$Component) {
9
+ _inherits(DocOperations, _React$Component);
10
+ var _super = _createSuper(DocOperations);
11
+ function DocOperations() {
12
+ _classCallCheck(this, DocOperations);
13
+ return _super.apply(this, arguments);
14
+ }
15
+ _createClass(DocOperations, [{
16
+ key: "render",
17
+ value: function render() {
18
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
19
+ className: "doc-ops"
20
+ }, /*#__PURE__*/React.createElement("span", {
21
+ className: "op-item"
22
+ }, /*#__PURE__*/React.createElement("i", {
23
+ className: "iconfont icon-share"
24
+ })), /*#__PURE__*/React.createElement("span", {
25
+ className: "op-item"
26
+ }, /*#__PURE__*/React.createElement("i", {
27
+ className: "iconfont icon-history"
28
+ })), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement("span", {
29
+ className: "op-item"
30
+ }, /*#__PURE__*/React.createElement("i", {
31
+ className: "iconfont icon-menu"
32
+ }))));
33
+ }
34
+ }]);
35
+ return DocOperations;
36
+ }(React.Component);
37
+ export default DocOperations;
@@ -0,0 +1,25 @@
1
+ .doc-ops {
2
+ display: flex;
3
+ align-items: center;
4
+ }
5
+
6
+ .doc-ops .op-item {
7
+ margin-right: 1rem;
8
+ display: flex;
9
+ position: relative;
10
+ }
11
+
12
+ .doc-ops .op-item .iconfont {
13
+ color: #666;
14
+ cursor: pointer;
15
+ }
16
+
17
+ .doc-ops .op-item .iconfont:hover {
18
+ color: #333;
19
+ cursor: pointer;
20
+ }
21
+
22
+ .doc-ops .popover-wrapper {
23
+ width: 300px;
24
+ }
25
+
@@ -1,25 +1,42 @@
1
- import _createClass from "@babel/runtime/helpers/esm/createClass";
2
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import { withTranslation } from 'react-i18next';
7
+ import { EventBus } from '../../basic-sdk';
7
8
  import './style.css';
8
9
  var TipMessage = /*#__PURE__*/function (_React$Component) {
9
10
  _inherits(TipMessage, _React$Component);
10
11
  var _super = _createSuper(TipMessage);
11
- function TipMessage() {
12
+ function TipMessage(props) {
12
13
  var _this;
13
14
  _classCallCheck(this, TipMessage);
14
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15
- args[_key] = arguments[_key];
16
- }
17
- _this = _super.call.apply(_super, [this].concat(args));
15
+ _this = _super.call(this, props);
16
+ _this.onDocumentSaving = function () {
17
+ _this.setState({
18
+ isSaving: true,
19
+ isSaved: false
20
+ });
21
+ };
22
+ _this.onDocumentSaved = function () {
23
+ _this.setState({
24
+ isSaving: false,
25
+ isSaved: true
26
+ });
27
+ if (_this.saveTimer) clearTimeout(_this.saveTimer);
28
+ _this.saveTimer = setTimeout(function () {
29
+ _this.setState({
30
+ isSaving: false,
31
+ isSaved: false
32
+ });
33
+ }, 2000);
34
+ };
18
35
  _this.render = function () {
19
- var _this$props = _this.props,
20
- t = _this$props.t,
21
- isSaved = _this$props.isSaved,
22
- isSaving = _this$props.isSaving;
36
+ var t = _this.props.t;
37
+ var _this$state = _this.state,
38
+ isSaved = _this$state.isSaved,
39
+ isSaving = _this$state.isSaving;
23
40
  if (isSaving && !isSaved) {
24
41
  return /*#__PURE__*/React.createElement("span", {
25
42
  className: "tip-message"
@@ -32,8 +49,28 @@ var TipMessage = /*#__PURE__*/function (_React$Component) {
32
49
  }
33
50
  return null;
34
51
  };
52
+ _this.state = {
53
+ isSaved: false,
54
+ isSaving: false
55
+ };
56
+ _this.saveTimer = null;
35
57
  return _this;
36
58
  }
37
- return _createClass(TipMessage);
59
+ _createClass(TipMessage, [{
60
+ key: "componentDidMount",
61
+ value: function componentDidMount() {
62
+ var eventBus = EventBus.getInstance();
63
+ this.unsubscribeSavingEvent = eventBus.subscribe('is-saving', this.onDocumentSaving);
64
+ this.unsubscribeSavedEvent = eventBus.subscribe('saved', this.onDocumentSaved);
65
+ }
66
+ }, {
67
+ key: "componentWillUnmount",
68
+ value: function componentWillUnmount() {
69
+ this.unsubscribeSavingEvent();
70
+ this.unsubscribeSavedEvent();
71
+ clearTimeout(this.saveTimer);
72
+ }
73
+ }]);
74
+ return TipMessage;
38
75
  }(React.Component);
39
76
  export default withTranslation('sdoc-editor')(TipMessage);
package/dist/context.js CHANGED
@@ -155,6 +155,11 @@ var Context = /*#__PURE__*/function () {
155
155
  return _this3.api.updateFile(uploadLink, docPath, docName, content);
156
156
  });
157
157
  }
158
+ }, {
159
+ key: "getCollaborators",
160
+ value: function getCollaborators() {
161
+ return this.sdocServerApi.getCollaborators();
162
+ }
158
163
  }]);
159
164
  return Context;
160
165
  }();
@@ -23,7 +23,7 @@ html, body {
23
23
  padding: 4px 10px;
24
24
  border-bottom: 1px solid #c9c9c9;
25
25
  flex-shrink: 0;
26
- height: 58px;
26
+ height: 56px;
27
27
  }
28
28
 
29
29
  .sdoc-editor-page-wrapper .sdoc-editor-page-content {
@@ -8,6 +8,7 @@ import React from 'react';
8
8
  import { SDocEditor } from '../basic-sdk';
9
9
  import Loading from '../components/loading';
10
10
  import TipMessage from '../components/tip-message';
11
+ import DocOperations from '../components/doc-operations';
11
12
  import Layout, { Header, Content } from '../layout';
12
13
  import { generateDefaultDocContent } from '../utils';
13
14
  import context from '../context';
@@ -19,25 +20,6 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
19
20
  var _this;
20
21
  _classCallCheck(this, SimpleEditor);
21
22
  _this = _super.call(this, props);
22
- _this.onDocumentSaving = function () {
23
- _this.setState({
24
- isSaving: true,
25
- isSaved: false
26
- });
27
- };
28
- _this.onDocumentSaved = function () {
29
- _this.setState({
30
- isSaving: false,
31
- isSaved: true
32
- });
33
- if (_this.saveTimer) clearTimeout(_this.saveTimer);
34
- _this.saveTimer = setTimeout(function () {
35
- _this.setState({
36
- isSaving: false,
37
- isSaved: false
38
- });
39
- }, 2000);
40
- };
41
23
  _this.onValueChanged = function (value) {
42
24
  _this.isValueChanged = true;
43
25
  _this.value = value;
@@ -72,7 +54,7 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
72
54
  key: "componentDidMount",
73
55
  value: function () {
74
56
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
- var contentRes, result, socketManager;
57
+ var contentRes, result;
76
58
  return _regeneratorRuntime().wrap(function _callee$(_context) {
77
59
  while (1) switch (_context.prev = _context.next) {
78
60
  case 0:
@@ -108,10 +90,6 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
108
90
  document: null
109
91
  });
110
92
  case 15:
111
- socketManager = this.editorRef.getSocketManager();
112
- this.unsubscribeSavingEvent = socketManager.subscribe('is-saving', this.onDocumentSaving);
113
- this.unsubscribeSavedEvent = socketManager.subscribe('saved', this.onDocumentSaved);
114
- case 18:
115
93
  case "end":
116
94
  return _context.stop();
117
95
  }
@@ -122,13 +100,6 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
122
100
  }
123
101
  return componentDidMount;
124
102
  }()
125
- }, {
126
- key: "componentWillUnmount",
127
- value: function componentWillUnmount() {
128
- this.unsubscribeSavingEvent();
129
- this.unsubscribeSavedEvent();
130
- clearTimeout(this.saveTimer);
131
- }
132
103
  }, {
133
104
  key: "render",
134
105
  value: function render() {
@@ -146,21 +117,11 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
146
117
  }
147
118
  var config = context.getEditorConfig();
148
119
  var isOpenSocket = context.getSetting('isOpenSocket');
149
- var _this$state2 = this.state,
150
- isSaved = _this$state2.isSaved,
151
- isSaving = _this$state2.isSaving;
152
120
  return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement("div", {
153
121
  className: "doc-info"
154
122
  }, /*#__PURE__*/React.createElement("div", {
155
123
  className: "doc-name"
156
- }, config.docName), /*#__PURE__*/React.createElement(TipMessage, {
157
- isSaving: isSaving,
158
- isSaved: isSaved
159
- })), /*#__PURE__*/React.createElement("div", {
160
- className: "doc-ops"
161
- }, !isOpenSocket && /*#__PURE__*/React.createElement("button", {
162
- onClick: this.onSave
163
- }, "Save"))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocEditor, {
124
+ }, config.docName), /*#__PURE__*/React.createElement(TipMessage, null)), /*#__PURE__*/React.createElement(DocOperations, null)), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocEditor, {
164
125
  ref: this.setEditorRef,
165
126
  config: config,
166
127
  document: document,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
package/public/index.html CHANGED
@@ -13,7 +13,7 @@
13
13
  <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
14
14
 
15
15
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
16
- <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/media/seafile-editor-font.css" />
16
+ <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/media/sdoc-editor-font.css" />
17
17
  <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/media/seafile-ui.css" />
18
18
  <!--
19
19
  Notice the use of %PUBLIC_URL% in the tags above.
@@ -227,5 +227,8 @@
227
227
  "The_link_title_is_required": "The link title is required.",
228
228
  "The_link_address_is_invalid": "The link address is invalid, please enter a correct connection address.",
229
229
  "All_changes_saved": "All changes saved",
230
- "Saving": "Saving..."
230
+ "Saving": "Saving...",
231
+ "Collaborators": "Collaborators",
232
+ "Online_members": "Online members",
233
+ "me": "me"
231
234
  }
@@ -223,5 +223,7 @@
223
223
  "The_link_title_is_required": "链接标题是必填项。",
224
224
  "The_link_address_is_invalid": "链接地址不合法,请输入一个正确的链接地址。",
225
225
  "All_changes_saved": "所有更改均已保存",
226
- "Saving": "保存中..."
226
+ "Saving": "保存中...",
227
+ "Online_members": "在线成员",
228
+ "me": "我"
227
229
  }