@seafile/sdoc-editor 0.1.8 → 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.
- package/dist/api/sdoc-server-api.js +13 -0
- package/dist/assets/css/collaborator-popover.css +75 -0
- package/dist/assets/css/simple-editor.css +9 -0
- package/dist/basic-sdk/assets/css/layout.css +2 -2
- package/dist/basic-sdk/assets/css/sdoc-editor-toolbar.css +1 -0
- package/dist/basic-sdk/extension/menu/menu.css +1 -1
- package/dist/basic-sdk/index.js +2 -1
- package/dist/basic-sdk/socket/socket-client.js +2 -2
- package/dist/basic-sdk/socket/socket-manager.js +1 -1
- package/dist/basic-sdk/utils/event-bus.js +8 -0
- package/dist/components/doc-operations/collaborators-operation/collaborators-popover.js +54 -0
- package/dist/components/doc-operations/collaborators-operation/index.js +107 -0
- package/dist/components/doc-operations/index.js +37 -0
- package/dist/components/doc-operations/style.css +25 -0
- package/dist/components/tip-message/index.js +76 -0
- package/dist/components/tip-message/style.css +9 -0
- package/dist/context.js +5 -0
- package/dist/layout/layout.css +1 -1
- package/dist/pages/simple-editor.js +16 -4
- package/package.json +1 -1
- package/public/index.html +1 -1
- package/public/locales/en/sdoc-editor.json +6 -1
- package/public/locales/zh-CN/sdoc-editor.json +5 -1
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +129 -0
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/{seafile-editor-font.css → sdoc-editor-font.css} +124 -107
- package/dist/assets/css/custom-editor.css +0 -28
- package/public/locales/zh-CN/seafile-editor.json +0 -225
- package/public/media/seafile-editor-font/iconfont.eot +0 -0
- package/public/media/seafile-editor-font/iconfont.svg +0 -121
- package/public/media/seafile-editor-font/iconfont.ttf +0 -0
- package/public/media/seafile-editor-font/iconfont.woff +0 -0
- 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
|
+
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
.sdoc-editor-container .sdoc-editor-toolbar {
|
|
15
15
|
display: flex;
|
|
16
16
|
justify-content: center;
|
|
17
|
-
height:
|
|
17
|
+
height: 44px;
|
|
18
18
|
align-items: center;
|
|
19
19
|
padding: 0 10px;
|
|
20
|
-
background-color: #
|
|
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%)
|
package/dist/basic-sdk/index.js
CHANGED
|
@@ -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
|
-
|
|
130
|
-
|
|
129
|
+
auth: {
|
|
130
|
+
token: config.accessToken
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
this.socket.on('connect', this.onConnected);
|
|
@@ -169,7 +169,7 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
169
169
|
this.pendingOperationList = []; // Two-dimensional arrays: [operations, operations, ...]
|
|
170
170
|
this.remoteOperationsList = []; // Same with pending operations
|
|
171
171
|
this.revertOperationList = [];
|
|
172
|
-
this.eventBus =
|
|
172
|
+
this.eventBus = EventBus.getInstance();
|
|
173
173
|
});
|
|
174
174
|
SocketManager.getInstance = function (editor, document, socketConfig) {
|
|
175
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
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { EventBus } from '../../basic-sdk';
|
|
8
|
+
import './style.css';
|
|
9
|
+
var TipMessage = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(TipMessage, _React$Component);
|
|
11
|
+
var _super = _createSuper(TipMessage);
|
|
12
|
+
function TipMessage(props) {
|
|
13
|
+
var _this;
|
|
14
|
+
_classCallCheck(this, TipMessage);
|
|
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
|
+
};
|
|
35
|
+
_this.render = function () {
|
|
36
|
+
var t = _this.props.t;
|
|
37
|
+
var _this$state = _this.state,
|
|
38
|
+
isSaved = _this$state.isSaved,
|
|
39
|
+
isSaving = _this$state.isSaving;
|
|
40
|
+
if (isSaving && !isSaved) {
|
|
41
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
42
|
+
className: "tip-message"
|
|
43
|
+
}, t('Saving'));
|
|
44
|
+
}
|
|
45
|
+
if (!isSaving && isSaved) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
47
|
+
className: "tip-message"
|
|
48
|
+
}, t('All_changes_saved'));
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
52
|
+
_this.state = {
|
|
53
|
+
isSaved: false,
|
|
54
|
+
isSaving: false
|
|
55
|
+
};
|
|
56
|
+
_this.saveTimer = null;
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
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;
|
|
75
|
+
}(React.Component);
|
|
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
|
}();
|
package/dist/layout/layout.css
CHANGED
|
@@ -7,9 +7,12 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { SDocEditor } from '../basic-sdk';
|
|
9
9
|
import Loading from '../components/loading';
|
|
10
|
+
import TipMessage from '../components/tip-message';
|
|
11
|
+
import DocOperations from '../components/doc-operations';
|
|
10
12
|
import Layout, { Header, Content } from '../layout';
|
|
11
13
|
import { generateDefaultDocContent } from '../utils';
|
|
12
14
|
import context from '../context';
|
|
15
|
+
import '../assets/css/simple-editor.css';
|
|
13
16
|
var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
14
17
|
_inherits(SimpleEditor, _React$Component);
|
|
15
18
|
var _super = _createSuper(SimpleEditor);
|
|
@@ -34,11 +37,17 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
};
|
|
40
|
+
_this.setEditorRef = function (ref) {
|
|
41
|
+
_this.editorRef = ref;
|
|
42
|
+
};
|
|
37
43
|
_this.state = {
|
|
38
44
|
isContextInit: false,
|
|
39
45
|
errorMessage: null,
|
|
40
|
-
document: null
|
|
46
|
+
document: null,
|
|
47
|
+
isSaved: false,
|
|
48
|
+
isSaving: false
|
|
41
49
|
};
|
|
50
|
+
_this.saveTimer = null;
|
|
42
51
|
return _this;
|
|
43
52
|
}
|
|
44
53
|
_createClass(SimpleEditor, [{
|
|
@@ -108,9 +117,12 @@ var SimpleEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
108
117
|
}
|
|
109
118
|
var config = context.getEditorConfig();
|
|
110
119
|
var isOpenSocket = context.getSetting('isOpenSocket');
|
|
111
|
-
return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement("div",
|
|
112
|
-
|
|
113
|
-
},
|
|
120
|
+
return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: "doc-info"
|
|
122
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "doc-name"
|
|
124
|
+
}, config.docName), /*#__PURE__*/React.createElement(TipMessage, null)), /*#__PURE__*/React.createElement(DocOperations, null)), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocEditor, {
|
|
125
|
+
ref: this.setEditorRef,
|
|
114
126
|
config: config,
|
|
115
127
|
document: document,
|
|
116
128
|
isOpenSocket: isOpenSocket,
|
package/package.json
CHANGED
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/
|
|
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.
|
|
@@ -225,5 +225,10 @@
|
|
|
225
225
|
"Insert_column": "Insert column",
|
|
226
226
|
"The_link_address_is_required": "The link address is required.",
|
|
227
227
|
"The_link_title_is_required": "The link title is required.",
|
|
228
|
-
"The_link_address_is_invalid": "The link address is invalid, please enter a correct connection address."
|
|
228
|
+
"The_link_address_is_invalid": "The link address is invalid, please enter a correct connection address.",
|
|
229
|
+
"All_changes_saved": "All changes saved",
|
|
230
|
+
"Saving": "Saving...",
|
|
231
|
+
"Collaborators": "Collaborators",
|
|
232
|
+
"Online_members": "Online members",
|
|
233
|
+
"me": "me"
|
|
229
234
|
}
|
|
@@ -221,5 +221,9 @@
|
|
|
221
221
|
},
|
|
222
222
|
"The_link_address_is_required": "链接地址是必填项。",
|
|
223
223
|
"The_link_title_is_required": "链接标题是必填项。",
|
|
224
|
-
"The_link_address_is_invalid": "链接地址不合法,请输入一个正确的链接地址。"
|
|
224
|
+
"The_link_address_is_invalid": "链接地址不合法,请输入一个正确的链接地址。",
|
|
225
|
+
"All_changes_saved": "所有更改均已保存",
|
|
226
|
+
"Saving": "保存中...",
|
|
227
|
+
"Online_members": "在线成员",
|
|
228
|
+
"me": "我"
|
|
225
229
|
}
|
|
Binary file
|