@seafile/sdoc-editor 1.0.119 → 1.0.121
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/basic-sdk/comment/components/comment-operation/index.css +14 -0
- package/dist/basic-sdk/comment/components/comment-operation/index.js +32 -0
- package/dist/basic-sdk/comment/hooks/use-participants.js +2 -86
- package/dist/basic-sdk/comment/provider/index.js +2 -1
- package/dist/basic-sdk/comment/provider/participants-content-provider.js +96 -0
- package/dist/basic-sdk/editor/sdoc-editor.js +1 -2
- package/dist/basic-sdk/layout/editor-content.js +9 -13
- package/dist/hooks/use-plugins.js +2 -1
- package/dist/pages/simple-editor.js +24 -32
- package/dist/pages/simple-viewer.js +7 -27
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.sdoc-notification-count {
|
|
2
|
+
position: absolute;
|
|
3
|
+
color: #fff;
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
top: -7px;
|
|
6
|
+
right: -10px;
|
|
7
|
+
padding: 2px;
|
|
8
|
+
background: #fc6440;
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
min-width: 20px;
|
|
11
|
+
min-height: 20px;
|
|
12
|
+
transform: scale(.7);
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = CommentsOperation;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ = require("../../..");
|
|
10
|
+
var _constants = require("../../../constants");
|
|
11
|
+
require("./index.css");
|
|
12
|
+
function CommentsOperation() {
|
|
13
|
+
const [unseenNotificationsCount, setUnseenNotificationsCount] = (0, _react.useState)(0);
|
|
14
|
+
const updateUnseenNotificationsCount = (0, _react.useCallback)(count => {
|
|
15
|
+
console.log(count);
|
|
16
|
+
setUnseenNotificationsCount(count);
|
|
17
|
+
}, []);
|
|
18
|
+
(0, _react.useEffect)(() => {
|
|
19
|
+
const eventBus = _.EventBus.getInstance();
|
|
20
|
+
const unsubscribeUnseenNotificationsCount = eventBus.subscribe(_constants.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, updateUnseenNotificationsCount);
|
|
21
|
+
return () => {
|
|
22
|
+
unsubscribeUnseenNotificationsCount();
|
|
23
|
+
};
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
}, []);
|
|
26
|
+
console.log(unseenNotificationsCount);
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("i", {
|
|
28
|
+
className: "sdocfont sdoc-comments"
|
|
29
|
+
}), unseenNotificationsCount > 0 && /*#__PURE__*/_react.default.createElement("span", {
|
|
30
|
+
className: "sdoc-notification-count"
|
|
31
|
+
}, unseenNotificationsCount));
|
|
32
|
+
}
|
|
@@ -1,96 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.useParticipantsContext = exports.
|
|
7
|
+
exports.useParticipantsContext = exports.ParticipantsContext = void 0;
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
|
-
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
|
-
var _model = require("../../../model");
|
|
13
|
-
var _toast = _interopRequireDefault(require("../../../components/toast"));
|
|
14
|
-
var _utils = require("../../../utils");
|
|
15
|
-
var _basicSdk = require("../../../basic-sdk");
|
|
16
|
-
var _constants = require("../../../constants");
|
|
17
|
-
const ParticipantsContext = /*#__PURE__*/_react.default.createContext(null);
|
|
18
|
-
const ParticipantsProvider = props => {
|
|
19
|
-
const isSdocRevision = _context.default.getSetting('isSdocRevision');
|
|
20
|
-
const isPublished = _context.default.getSetting('isPublished');
|
|
21
|
-
const [participants, setParticipants] = (0, _react.useState)([]);
|
|
22
|
-
const {
|
|
23
|
-
t
|
|
24
|
-
} = (0, _reactI18next.useTranslation)();
|
|
25
|
-
const updateLocalParticipants = (0, _react.useCallback)(function () {
|
|
26
|
-
let added = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
27
|
-
if (!Array.isArray(added) || added.length === 0) return;
|
|
28
|
-
let newParticipants = participants.slice(0);
|
|
29
|
-
added.forEach(participant => {
|
|
30
|
-
const newParticipant = new _model.User(participant);
|
|
31
|
-
if (!newParticipants.find(item => item.username === newParticipant.username)) {
|
|
32
|
-
newParticipants.push(newParticipant);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
setParticipants(newParticipants);
|
|
36
|
-
}, [participants]);
|
|
37
|
-
const addParticipants = (0, _react.useCallback)(otherEmail => {
|
|
38
|
-
if (participants.find(participant => participant.username === otherEmail)) return;
|
|
39
|
-
_context.default.addParticipants([otherEmail]).then(res => {
|
|
40
|
-
const {
|
|
41
|
-
success
|
|
42
|
-
} = res.data;
|
|
43
|
-
updateLocalParticipants(success);
|
|
44
|
-
}).catch(error => {
|
|
45
|
-
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
46
|
-
_toast.default.danger(t(errorMessage));
|
|
47
|
-
});
|
|
48
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
-
}, [updateLocalParticipants, participants]);
|
|
50
|
-
const deleteLocalParticipant = (0, _react.useCallback)(email => {
|
|
51
|
-
if (!participants.find(participant => participant.username === email)) return;
|
|
52
|
-
let newParticipants = participants.slice(0);
|
|
53
|
-
newParticipants = newParticipants.filter(participant => participant.username !== email);
|
|
54
|
-
setParticipants(newParticipants);
|
|
55
|
-
}, [participants]);
|
|
56
|
-
const deleteParticipant = (0, _react.useCallback)(email => {
|
|
57
|
-
if (!participants.find(participant => participant.username === email)) return;
|
|
58
|
-
_context.default.deleteParticipants(email).then(res => {
|
|
59
|
-
let newParticipants = participants.slice(0);
|
|
60
|
-
newParticipants = newParticipants.filter(participant => participant.username !== email);
|
|
61
|
-
setParticipants(newParticipants);
|
|
62
|
-
}).catch(error => {
|
|
63
|
-
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
64
|
-
_toast.default.danger(t(errorMessage));
|
|
65
|
-
});
|
|
66
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, [participants]);
|
|
68
|
-
(0, _react.useEffect)(() => {
|
|
69
|
-
if (isSdocRevision && isPublished) return;
|
|
70
|
-
_context.default.listParticipants().then(res => {
|
|
71
|
-
const participants = res.data.participant_list;
|
|
72
|
-
updateLocalParticipants(participants);
|
|
73
|
-
}).catch(error => {});
|
|
74
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
-
}, []);
|
|
76
|
-
(0, _react.useEffect)(() => {
|
|
77
|
-
const eventBus = _basicSdk.EventBus.getInstance();
|
|
78
|
-
const unsubscribeParticipantAdded = eventBus.subscribe(_constants.EXTERNAL_EVENT.PARTICIPANT_ADDED, updateLocalParticipants);
|
|
79
|
-
const unsubscribeParticipantRemoved = eventBus.subscribe(_constants.EXTERNAL_EVENT.PARTICIPANT_REMOVED, deleteLocalParticipant);
|
|
80
|
-
return () => {
|
|
81
|
-
unsubscribeParticipantAdded();
|
|
82
|
-
unsubscribeParticipantRemoved();
|
|
83
|
-
};
|
|
84
|
-
}, [updateLocalParticipants, deleteLocalParticipant]);
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement(ParticipantsContext.Provider, {
|
|
86
|
-
value: {
|
|
87
|
-
participants,
|
|
88
|
-
addParticipants,
|
|
89
|
-
deleteParticipant
|
|
90
|
-
}
|
|
91
|
-
}, props.children);
|
|
92
|
-
};
|
|
93
|
-
exports.ParticipantsProvider = ParticipantsProvider;
|
|
9
|
+
const ParticipantsContext = exports.ParticipantsContext = /*#__PURE__*/_react.default.createContext(null);
|
|
94
10
|
const useParticipantsContext = () => {
|
|
95
11
|
const context = (0, _react.useContext)(ParticipantsContext);
|
|
96
12
|
if (!context) {
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _commentContextProvider = _interopRequireDefault(require("./comment-context-provider"));
|
|
10
10
|
var _notificationContextProvider = _interopRequireDefault(require("./notification-context-provider"));
|
|
11
|
+
var _participantsContentProvider = _interopRequireDefault(require("./participants-content-provider"));
|
|
11
12
|
const Provider = _ref => {
|
|
12
13
|
let {
|
|
13
14
|
children,
|
|
@@ -17,6 +18,6 @@ const Provider = _ref => {
|
|
|
17
18
|
editor: editor
|
|
18
19
|
}, /*#__PURE__*/_react.default.createElement(_commentContextProvider.default, {
|
|
19
20
|
editor: editor
|
|
20
|
-
}, children));
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement(_participantsContentProvider.default, null, children)));
|
|
21
22
|
};
|
|
22
23
|
var _default = exports.default = Provider;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
11
|
+
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
|
+
var _model = require("../../../model");
|
|
13
|
+
var _toast = _interopRequireDefault(require("../../../components/toast"));
|
|
14
|
+
var _utils = require("../../../utils");
|
|
15
|
+
var _basicSdk = require("../../../basic-sdk");
|
|
16
|
+
var _constants = require("../../../constants");
|
|
17
|
+
var _useParticipants = require("../hooks/use-participants");
|
|
18
|
+
const ParticipantsProvider = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children
|
|
21
|
+
} = _ref;
|
|
22
|
+
const isSdocRevision = _context.default.getSetting('isSdocRevision');
|
|
23
|
+
const isPublished = _context.default.getSetting('isPublished');
|
|
24
|
+
const [participants, setParticipants] = (0, _react.useState)([]);
|
|
25
|
+
const {
|
|
26
|
+
t
|
|
27
|
+
} = (0, _reactI18next.useTranslation)();
|
|
28
|
+
const updateLocalParticipants = (0, _react.useCallback)(function () {
|
|
29
|
+
let added = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
30
|
+
if (!Array.isArray(added) || added.length === 0) return;
|
|
31
|
+
let newParticipants = participants.slice(0);
|
|
32
|
+
added.forEach(participant => {
|
|
33
|
+
const newParticipant = new _model.User(participant);
|
|
34
|
+
if (!newParticipants.find(item => item.username === newParticipant.username)) {
|
|
35
|
+
newParticipants.push(newParticipant);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
setParticipants(newParticipants);
|
|
39
|
+
}, [participants]);
|
|
40
|
+
const addParticipants = (0, _react.useCallback)(otherEmail => {
|
|
41
|
+
if (participants.find(participant => participant.username === otherEmail)) return;
|
|
42
|
+
_context.default.addParticipants([otherEmail]).then(res => {
|
|
43
|
+
const {
|
|
44
|
+
success
|
|
45
|
+
} = res.data;
|
|
46
|
+
updateLocalParticipants(success);
|
|
47
|
+
}).catch(error => {
|
|
48
|
+
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
49
|
+
_toast.default.danger(t(errorMessage));
|
|
50
|
+
});
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, [updateLocalParticipants, participants]);
|
|
53
|
+
const deleteLocalParticipant = (0, _react.useCallback)(email => {
|
|
54
|
+
if (!participants.find(participant => participant.username === email)) return;
|
|
55
|
+
let newParticipants = participants.slice(0);
|
|
56
|
+
newParticipants = newParticipants.filter(participant => participant.username !== email);
|
|
57
|
+
setParticipants(newParticipants);
|
|
58
|
+
}, [participants]);
|
|
59
|
+
const deleteParticipant = (0, _react.useCallback)(email => {
|
|
60
|
+
if (!participants.find(participant => participant.username === email)) return;
|
|
61
|
+
_context.default.deleteParticipants(email).then(res => {
|
|
62
|
+
let newParticipants = participants.slice(0);
|
|
63
|
+
newParticipants = newParticipants.filter(participant => participant.username !== email);
|
|
64
|
+
setParticipants(newParticipants);
|
|
65
|
+
}).catch(error => {
|
|
66
|
+
const errorMessage = (0, _utils.getErrorMsg)(error);
|
|
67
|
+
_toast.default.danger(t(errorMessage));
|
|
68
|
+
});
|
|
69
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
|
+
}, [participants]);
|
|
71
|
+
(0, _react.useEffect)(() => {
|
|
72
|
+
if (isSdocRevision && isPublished) return;
|
|
73
|
+
_context.default.listParticipants().then(res => {
|
|
74
|
+
const participants = res.data.participant_list;
|
|
75
|
+
updateLocalParticipants(participants);
|
|
76
|
+
}).catch(error => {});
|
|
77
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
|
+
}, []);
|
|
79
|
+
(0, _react.useEffect)(() => {
|
|
80
|
+
const eventBus = _basicSdk.EventBus.getInstance();
|
|
81
|
+
const unsubscribeParticipantAdded = eventBus.subscribe(_constants.EXTERNAL_EVENT.PARTICIPANT_ADDED, updateLocalParticipants);
|
|
82
|
+
const unsubscribeParticipantRemoved = eventBus.subscribe(_constants.EXTERNAL_EVENT.PARTICIPANT_REMOVED, deleteLocalParticipant);
|
|
83
|
+
return () => {
|
|
84
|
+
unsubscribeParticipantAdded();
|
|
85
|
+
unsubscribeParticipantRemoved();
|
|
86
|
+
};
|
|
87
|
+
}, [updateLocalParticipants, deleteLocalParticipant]);
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_useParticipants.ParticipantsContext.Provider, {
|
|
89
|
+
value: {
|
|
90
|
+
participants,
|
|
91
|
+
addParticipants,
|
|
92
|
+
deleteParticipant
|
|
93
|
+
}
|
|
94
|
+
}, children);
|
|
95
|
+
};
|
|
96
|
+
var _default = exports.default = ParticipantsProvider;
|
|
@@ -31,8 +31,7 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
31
31
|
isReloading,
|
|
32
32
|
showComment,
|
|
33
33
|
isShowHeaderToolbar = true,
|
|
34
|
-
showOutline = true
|
|
35
|
-
plugins = []
|
|
34
|
+
showOutline = true
|
|
36
35
|
} = _ref;
|
|
37
36
|
const validEditor = (0, _react.useMemo)(() => {
|
|
38
37
|
if (propsEditor) return propsEditor;
|
|
@@ -11,7 +11,6 @@ var _useScrollContext = require("../hooks/use-scroll-context");
|
|
|
11
11
|
var _outline = _interopRequireDefault(require("../outline"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _provider = _interopRequireDefault(require("../comment/provider"));
|
|
14
|
-
var _useParticipants = require("../comment/hooks/use-participants");
|
|
15
14
|
var _rightPanel = _interopRequireDefault(require("../right-panel"));
|
|
16
15
|
const EditorContent = _ref => {
|
|
17
16
|
let {
|
|
@@ -34,7 +33,14 @@ const EditorContent = _ref => {
|
|
|
34
33
|
'readonly': readonly,
|
|
35
34
|
'no-outline': !showOutline
|
|
36
35
|
});
|
|
37
|
-
|
|
36
|
+
|
|
37
|
+
// If you don't display comment, use Fragment to replace CommentProvider
|
|
38
|
+
const AboutCommentProvider = showComment ? _provider.default : _react.Fragment;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(AboutCommentProvider, showComment && {
|
|
40
|
+
editor
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
className: "sdoc-content-wrapper"
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
38
44
|
ref: scrollRef,
|
|
39
45
|
className: "sdoc-scroll-container",
|
|
40
46
|
onScroll: onWrapperScroll,
|
|
@@ -50,17 +56,7 @@ const EditorContent = _ref => {
|
|
|
50
56
|
doc: docValue
|
|
51
57
|
}), children))), /*#__PURE__*/_react.default.createElement(_rightPanel.default, {
|
|
52
58
|
editor: editor
|
|
53
|
-
}));
|
|
54
|
-
if (!showComment) {
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
-
className: "sdoc-content-wrapper"
|
|
57
|
-
}, dom);
|
|
58
|
-
}
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
-
className: "sdoc-content-wrapper"
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_provider.default, {
|
|
62
|
-
editor: editor
|
|
63
|
-
}, /*#__PURE__*/_react.default.createElement(_useParticipants.ParticipantsProvider, null, dom)));
|
|
59
|
+
})));
|
|
64
60
|
};
|
|
65
61
|
EditorContent.defaultProps = {
|
|
66
62
|
readonly: false,
|
|
@@ -9,6 +9,7 @@ exports.usePlugins = exports.PluginsProvider = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _constants = require("../basic-sdk/constants");
|
|
11
11
|
var _comment = _interopRequireDefault(require("../basic-sdk/comment"));
|
|
12
|
+
var _commentOperation = _interopRequireDefault(require("../basic-sdk/comment/components/comment-operation"));
|
|
12
13
|
const PluginsContext = /*#__PURE__*/_react.default.createContext(null);
|
|
13
14
|
const PluginsProvider = _ref => {
|
|
14
15
|
let {
|
|
@@ -25,7 +26,7 @@ const PluginsProvider = _ref => {
|
|
|
25
26
|
if (showComment) {
|
|
26
27
|
allPlugins.push({
|
|
27
28
|
name: 'sdoc-comment',
|
|
28
|
-
icon:
|
|
29
|
+
icon: /*#__PURE__*/_react.default.createElement(_commentOperation.default, null),
|
|
29
30
|
resizable_width: true,
|
|
30
31
|
display_type: _constants.PLUGIN_DISPLAY_TYPE.RIGHT_PANEL,
|
|
31
32
|
component: _comment.default
|
|
@@ -106,31 +106,14 @@ const SimpleEditor = _ref => {
|
|
|
106
106
|
setPublished(true);
|
|
107
107
|
});
|
|
108
108
|
}, [setErrorMessage]);
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
if (isPublished) {
|
|
119
|
-
return /*#__PURE__*/_react.default.createElement(_views.PublishedRevisionDiffViewer, {
|
|
120
|
-
isShowChanges: isShowChanges,
|
|
121
|
-
revisionContent: revisionContent,
|
|
122
|
-
didMountCallback: setDiffChanges
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return /*#__PURE__*/_react.default.createElement(_basicSdk.RevisionEditor, {
|
|
126
|
-
ref: editorRef,
|
|
127
|
-
isShowChanges: isShowChanges,
|
|
128
|
-
isReloading: isReloading,
|
|
129
|
-
document: document,
|
|
130
|
-
revisionContent: revisionContent,
|
|
131
|
-
didMountCallback: setDiffChanges
|
|
132
|
-
});
|
|
133
|
-
}, [isSdocRevision, isPublished, isShowChanges, isReloading, document, revisionContent, setDiffChanges, showComment]);
|
|
109
|
+
const docOperationsProps = {
|
|
110
|
+
isPublished,
|
|
111
|
+
isShowChanges,
|
|
112
|
+
changes,
|
|
113
|
+
handleViewChangesToggle,
|
|
114
|
+
handleRevisionMerged,
|
|
115
|
+
handleRevisionPublished
|
|
116
|
+
};
|
|
134
117
|
if (isFirstLoading) {
|
|
135
118
|
return /*#__PURE__*/_react.default.createElement(_loading.default, null);
|
|
136
119
|
}
|
|
@@ -151,13 +134,22 @@ const SimpleEditor = _ref => {
|
|
|
151
134
|
isDraft: isDraft,
|
|
152
135
|
isPublished: isPublished,
|
|
153
136
|
isEditMode: isPublished ? false : !isShowChanges
|
|
154
|
-
}), showDocOperations && /*#__PURE__*/_react.default.createElement(_docOperations.default, {
|
|
137
|
+
}), showDocOperations && /*#__PURE__*/_react.default.createElement(_docOperations.default, docOperationsProps)), /*#__PURE__*/_react.default.createElement(_layout.Content, null, !isSdocRevision && /*#__PURE__*/_react.default.createElement(_basicSdk.SDocEditor, {
|
|
138
|
+
ref: editorRef,
|
|
139
|
+
isReloading: isReloading,
|
|
140
|
+
document: document,
|
|
141
|
+
showComment: showComment
|
|
142
|
+
}), isSdocRevision && !isPublished && /*#__PURE__*/_react.default.createElement(_basicSdk.RevisionEditor, {
|
|
143
|
+
ref: editorRef,
|
|
144
|
+
isReloading: isReloading,
|
|
145
|
+
document: document,
|
|
146
|
+
revisionContent: revisionContent,
|
|
155
147
|
isShowChanges: isShowChanges,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}))
|
|
148
|
+
didMountCallback: setDiffChanges
|
|
149
|
+
}), isSdocRevision && isPublished && /*#__PURE__*/_react.default.createElement(_views.PublishedRevisionDiffViewer, {
|
|
150
|
+
revisionContent: revisionContent,
|
|
151
|
+
isShowChanges: isShowChanges,
|
|
152
|
+
didMountCallback: setDiffChanges
|
|
153
|
+
}))))));
|
|
162
154
|
};
|
|
163
155
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(SimpleEditor);
|
|
@@ -66,27 +66,12 @@ class SimpleViewer extends _react.default.Component {
|
|
|
66
66
|
sharePermissionText,
|
|
67
67
|
downloadURL
|
|
68
68
|
} = _context.default.getSettings();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
className: "sdoc-share-permission ml-2"
|
|
76
|
-
}, sharePermissionText)), /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
-
className: "doc-ops"
|
|
78
|
-
}, downloadURL && /*#__PURE__*/_react.default.createElement("a", {
|
|
79
|
-
href: downloadURL,
|
|
80
|
-
className: "op-item"
|
|
81
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
82
|
-
className: "sdocfont sdoc-download"
|
|
83
|
-
})))), /*#__PURE__*/_react.default.createElement(_layout.Content, null, /*#__PURE__*/_react.default.createElement(_basicSdk.SDocViewer, {
|
|
84
|
-
document: document,
|
|
85
|
-
showToolbar: false,
|
|
86
|
-
showOutline: false,
|
|
87
|
-
showComment: false
|
|
88
|
-
}))));
|
|
89
|
-
}
|
|
69
|
+
const sdocViewProps = {
|
|
70
|
+
document: document,
|
|
71
|
+
showToolbar: _utils.isMobile ? false : true,
|
|
72
|
+
showOutline: _utils.isMobile ? false : true,
|
|
73
|
+
showComment: false
|
|
74
|
+
};
|
|
90
75
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_layout.default, null, /*#__PURE__*/_react.default.createElement(_layout.Header, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
76
|
className: "doc-info"
|
|
92
77
|
}, /*#__PURE__*/_react.default.createElement("h2", {
|
|
@@ -100,12 +85,7 @@ class SimpleViewer extends _react.default.Component {
|
|
|
100
85
|
className: "op-item"
|
|
101
86
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
102
87
|
className: "sdocfont sdoc-download"
|
|
103
|
-
})))), /*#__PURE__*/_react.default.createElement(_layout.Content, null, /*#__PURE__*/_react.default.createElement(_basicSdk.SDocViewer,
|
|
104
|
-
document: document,
|
|
105
|
-
showToolbar: true,
|
|
106
|
-
showOutline: true,
|
|
107
|
-
showComment: false
|
|
108
|
-
}))));
|
|
88
|
+
})))), /*#__PURE__*/_react.default.createElement(_layout.Content, null, /*#__PURE__*/_react.default.createElement(_basicSdk.SDocViewer, sdocViewProps))));
|
|
109
89
|
}
|
|
110
90
|
}
|
|
111
91
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(SimpleViewer);
|