@seafile/sdoc-editor 0.1.106 → 0.1.109
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/assets/css/layout.css +1 -5
- package/dist/basic-sdk/assets/css/simple-viewer.css +13 -0
- package/dist/basic-sdk/comment/comment/comment-list.css +1 -0
- package/dist/basic-sdk/editor.js +10 -38
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +18 -0
- package/dist/basic-sdk/extension/plugins/table/dialog/custom-table-size-dialog/index.js +21 -7
- package/dist/basic-sdk/extension/plugins/table/dialog/custom-table-size-dialog/number-input.js +1 -1
- package/dist/basic-sdk/layout/article-container.js +49 -0
- package/dist/basic-sdk/views/viewer.js +10 -15
- package/dist/components/doc-operations/index.js +2 -5
- package/dist/components/doc-operations/share-operation/index.js +15 -0
- package/dist/constants/index.js +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +1 -0
- package/public/locales/zh-CN/sdoc-editor.json +1 -0
|
@@ -26,10 +26,6 @@
|
|
|
26
26
|
position: relative;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.sdoc-editor-container .sdoc-editor-content.readonly {
|
|
30
|
-
height: 100%;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
.sdoc-editor-container .sdoc-absolute-wrapper {
|
|
34
30
|
position: absolute;
|
|
35
31
|
left: 0;
|
|
@@ -40,7 +36,7 @@
|
|
|
40
36
|
width: 100%;
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
.sdoc-editor-container .sdoc-
|
|
39
|
+
.sdoc-editor-container .sdoc-scroll-container {
|
|
44
40
|
position: absolute;
|
|
45
41
|
left: 0;
|
|
46
42
|
right: 0;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.sdoc-editor-container .sdoc-editor-content.readonly {
|
|
2
|
+
height: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.sdoc-editor-container.mobile .sdoc-editor-content.readonly .sdoc-article-container {
|
|
6
|
+
padding: 0;
|
|
7
|
+
width: auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sdoc-editor-container.mobile .sdoc-editor-content.readonly .article {
|
|
11
|
+
width: 100% !important;
|
|
12
|
+
padding: 1rem;
|
|
13
|
+
}
|
package/dist/basic-sdk/editor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, forwardRef, useImperativeHandle, Fragment } from 'react';
|
|
3
3
|
import { Editable, ReactEditor, Slate } from '@seafile/slate-react';
|
|
4
4
|
import defaultEditor, { renderLeaf, renderElement, Toolbar, ContextToolbar } from './extension';
|
|
5
5
|
import { focusEditor, getAboveBlockNode, getNextNode, getPrevNode, isSelectionAtBlockEnd, isSelectionAtBlockStart } from './extension/core';
|
|
@@ -17,6 +17,7 @@ import { usePipDecorate } from './decorates';
|
|
|
17
17
|
import { getCursorPosition, getDomHeight, getDomMarginTop } from './utils/dom-utils';
|
|
18
18
|
import EventBus from './utils/event-bus';
|
|
19
19
|
import { ColorProvider } from './hooks/use-color-context';
|
|
20
|
+
import ArticleContainer from './layout/article-container';
|
|
20
21
|
import './assets/css/layout.css';
|
|
21
22
|
import './assets/css/sdoc-editor-plugins.css';
|
|
22
23
|
import './assets/css/dropdown-menu.css';
|
|
@@ -42,7 +43,6 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
42
43
|
var _useCursors = useCursors(editor),
|
|
43
44
|
cursors = _useCursors.cursors;
|
|
44
45
|
var scrollRef = useRef(null);
|
|
45
|
-
var articleRef = useRef(null);
|
|
46
46
|
var decorate = usePipDecorate(editor);
|
|
47
47
|
|
|
48
48
|
// init eventHandler
|
|
@@ -73,8 +73,6 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
73
73
|
// useMount: focus editor
|
|
74
74
|
useEffect(function () {
|
|
75
75
|
var timer = setTimeout(function () {
|
|
76
|
-
// real width
|
|
77
|
-
editor.width = articleRef.current.children[0].clientWidth;
|
|
78
76
|
focusEditor(editor);
|
|
79
77
|
}, 300);
|
|
80
78
|
return function () {
|
|
@@ -185,32 +183,10 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
185
183
|
|
|
186
184
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
187
185
|
}, []);
|
|
188
|
-
var _useState3 = useState(
|
|
186
|
+
var _useState3 = useState(0),
|
|
189
187
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var handleWindowResize = useCallback(function () {
|
|
193
|
-
var rect = scrollRef.current.getBoundingClientRect();
|
|
194
|
-
var articleRect = articleRef.current.getBoundingClientRect();
|
|
195
|
-
if ((rect.width - articleRect.width) / 2 < 280) {
|
|
196
|
-
setContainerStyle({
|
|
197
|
-
marginLeft: '280px'
|
|
198
|
-
});
|
|
199
|
-
} else {
|
|
200
|
-
setContainerStyle({});
|
|
201
|
-
}
|
|
202
|
-
}, []);
|
|
203
|
-
useEffect(function () {
|
|
204
|
-
handleWindowResize();
|
|
205
|
-
window.addEventListener('resize', handleWindowResize);
|
|
206
|
-
return function () {
|
|
207
|
-
window.removeEventListener('resize', handleWindowResize);
|
|
208
|
-
};
|
|
209
|
-
}, [handleWindowResize]);
|
|
210
|
-
var _useState5 = useState(0),
|
|
211
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
212
|
-
scrollLeft = _useState6[0],
|
|
213
|
-
setScrollLeft = _useState6[1];
|
|
188
|
+
scrollLeft = _useState4[0],
|
|
189
|
+
setScrollLeft = _useState4[1];
|
|
214
190
|
var onWrapperScroll = useCallback(function (event) {
|
|
215
191
|
var scrollLeft = event.target.scrollLeft;
|
|
216
192
|
setScrollLeft(scrollLeft);
|
|
@@ -231,11 +207,8 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
231
207
|
className: "sdoc-absolute-wrapper"
|
|
232
208
|
}, /*#__PURE__*/React.createElement("div", {
|
|
233
209
|
ref: scrollRef,
|
|
234
|
-
className: "sdoc-
|
|
210
|
+
className: "sdoc-scroll-container",
|
|
235
211
|
onScroll: onWrapperScroll
|
|
236
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
237
|
-
className: "sdoc-article-container",
|
|
238
|
-
style: containerStyle
|
|
239
212
|
}, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
|
|
240
213
|
value: {
|
|
241
214
|
scrollRef: scrollRef
|
|
@@ -244,10 +217,9 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
244
217
|
editor: editor,
|
|
245
218
|
value: slateValue,
|
|
246
219
|
onChange: onChange
|
|
247
|
-
}, /*#__PURE__*/React.createElement(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
220
|
+
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
221
|
+
editor: editor
|
|
222
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ContextToolbar, null), /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
251
223
|
cursors: cursors,
|
|
252
224
|
renderElement: renderElement,
|
|
253
225
|
renderLeaf: renderLeaf,
|
|
@@ -255,6 +227,6 @@ var SDocEditor = forwardRef(function (_ref, ref) {
|
|
|
255
227
|
onMouseDown: onMouseDown,
|
|
256
228
|
decorate: decorate,
|
|
257
229
|
onCut: eventProxy.onCut
|
|
258
|
-
})), /*#__PURE__*/React.createElement(CommentWrapper, null)))))))))));
|
|
230
|
+
})), /*#__PURE__*/React.createElement(CommentContextProvider, null, /*#__PURE__*/React.createElement(CommentWrapper, null)))))))))));
|
|
259
231
|
});
|
|
260
232
|
export default SDocEditor;
|
|
@@ -97,6 +97,13 @@ var withCodeBlock = function withCodeBlock(editor) {
|
|
|
97
97
|
node = _ref2[0],
|
|
98
98
|
path = _ref2[1];
|
|
99
99
|
var type = getNodeType(node);
|
|
100
|
+
if (type === 'code-line' && path.length <= 1) {
|
|
101
|
+
Transforms.setNodes(newEditor, {
|
|
102
|
+
type: 'paragraph'
|
|
103
|
+
}, {
|
|
104
|
+
at: path
|
|
105
|
+
});
|
|
106
|
+
}
|
|
100
107
|
if (type === CODE_BLOCK) {
|
|
101
108
|
// code-block is the last node in the editor and needs to be followed by a p node
|
|
102
109
|
var isLast = isLastNode(newEditor, node);
|
|
@@ -116,6 +123,17 @@ var withCodeBlock = function withCodeBlock(editor) {
|
|
|
116
123
|
mode: 'highest'
|
|
117
124
|
});
|
|
118
125
|
}
|
|
126
|
+
if (node.children.length > 1) {
|
|
127
|
+
node.children.forEach(function (child, index) {
|
|
128
|
+
if (child.type !== 'code-line') {
|
|
129
|
+
Transforms.setNodes(newEditor, {
|
|
130
|
+
type: 'code-line'
|
|
131
|
+
}, {
|
|
132
|
+
at: [].concat(_toConsumableArray(path), [index])
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
119
137
|
}
|
|
120
138
|
|
|
121
139
|
// Perform default behavior
|
|
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React, { Component } from 'react';
|
|
6
6
|
import { withTranslation } from 'react-i18next';
|
|
7
|
-
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Label } from 'reactstrap';
|
|
7
|
+
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Label, Alert } from 'reactstrap';
|
|
8
8
|
import { TABLE_MAX_ROWS, TABLE_MAX_COLUMNS } from '../../constants';
|
|
9
9
|
import NumberInput from './number-input';
|
|
10
10
|
import './index.css';
|
|
@@ -22,25 +22,33 @@ var CustomTableSizeDialog = /*#__PURE__*/function (_Component) {
|
|
|
22
22
|
var _this$state = _this.state,
|
|
23
23
|
rows = _this$state.rows,
|
|
24
24
|
cols = _this$state.cols;
|
|
25
|
+
if (!rows || !cols || parseInt(rows) < 1 || parseInt(rows) > 50 || parseInt(cols) < 1 || parseInt(cols) > 50) {
|
|
26
|
+
_this.setState({
|
|
27
|
+
errorMessage: 'Valid_values_for_rows_and_columns'
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
25
31
|
_this.props.submit([parseInt(rows), parseInt(cols)]);
|
|
26
32
|
};
|
|
27
33
|
_this.rowsChange = function (event) {
|
|
28
34
|
var value = event.target.value;
|
|
29
35
|
if (value === _this.state.rows) return;
|
|
30
36
|
_this.setState({
|
|
31
|
-
rows: value
|
|
37
|
+
rows: value,
|
|
38
|
+
errorMessage: ''
|
|
32
39
|
});
|
|
33
40
|
};
|
|
34
41
|
_this.colsChange = function (event) {
|
|
35
42
|
var value = event.target.value;
|
|
36
43
|
if (value === _this.state.cols) return;
|
|
37
44
|
_this.setState({
|
|
38
|
-
cols: value
|
|
45
|
+
cols: value,
|
|
46
|
+
errorMessage: ''
|
|
39
47
|
});
|
|
40
48
|
};
|
|
41
49
|
_this.state = {
|
|
42
|
-
rows: '
|
|
43
|
-
cols: '
|
|
50
|
+
rows: '1',
|
|
51
|
+
cols: '5'
|
|
44
52
|
};
|
|
45
53
|
return _this;
|
|
46
54
|
}
|
|
@@ -50,7 +58,8 @@ var CustomTableSizeDialog = /*#__PURE__*/function (_Component) {
|
|
|
50
58
|
var t = this.props.t;
|
|
51
59
|
var _this$state2 = this.state,
|
|
52
60
|
rows = _this$state2.rows,
|
|
53
|
-
cols = _this$state2.cols
|
|
61
|
+
cols = _this$state2.cols,
|
|
62
|
+
errorMessage = _this$state2.errorMessage;
|
|
54
63
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
55
64
|
isOpen: true,
|
|
56
65
|
toggle: this.toggle,
|
|
@@ -66,6 +75,7 @@ var CustomTableSizeDialog = /*#__PURE__*/function (_Component) {
|
|
|
66
75
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
67
76
|
className: "mb-2"
|
|
68
77
|
}, t('Rows')), /*#__PURE__*/React.createElement(NumberInput, {
|
|
78
|
+
min: 1,
|
|
69
79
|
max: TABLE_MAX_ROWS,
|
|
70
80
|
value: rows,
|
|
71
81
|
onChange: this.rowsChange
|
|
@@ -74,10 +84,14 @@ var CustomTableSizeDialog = /*#__PURE__*/function (_Component) {
|
|
|
74
84
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
75
85
|
className: "mb-2"
|
|
76
86
|
}, t('Columns')), /*#__PURE__*/React.createElement(NumberInput, {
|
|
87
|
+
min: 1,
|
|
77
88
|
max: TABLE_MAX_COLUMNS,
|
|
78
89
|
value: cols,
|
|
79
90
|
onChange: this.colsChange
|
|
80
|
-
})))
|
|
91
|
+
}))), errorMessage && /*#__PURE__*/React.createElement(Alert, {
|
|
92
|
+
className: "mt-2 mb-0",
|
|
93
|
+
color: "danger"
|
|
94
|
+
}, t(errorMessage))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
81
95
|
color: "secondary",
|
|
82
96
|
onClick: this.toggle
|
|
83
97
|
}, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useScrollContext } from '../hooks/use-scroll-context';
|
|
4
|
+
export default function ArticleContainer(_ref) {
|
|
5
|
+
var editor = _ref.editor,
|
|
6
|
+
readOnly = _ref.readOnly,
|
|
7
|
+
children = _ref.children;
|
|
8
|
+
var articleRef = useRef(null);
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
editor.width = articleRef.current.children[0].clientWidth;
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
}, []);
|
|
13
|
+
var scrollRef = useScrollContext();
|
|
14
|
+
var _useState = useState({}),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
containerStyle = _useState2[0],
|
|
17
|
+
setContainerStyle = _useState2[1];
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
if (readOnly) return;
|
|
20
|
+
var handleWindowResize = function handleWindowResize() {
|
|
21
|
+
var rect = scrollRef.current.getBoundingClientRect();
|
|
22
|
+
var articleRect = articleRef.current.getBoundingClientRect();
|
|
23
|
+
if ((rect.width - articleRect.width) / 2 < 280) {
|
|
24
|
+
setContainerStyle({
|
|
25
|
+
marginLeft: '280px'
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
setContainerStyle({});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
window.addEventListener('resize', handleWindowResize);
|
|
32
|
+
return function () {
|
|
33
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
34
|
+
};
|
|
35
|
+
}, [readOnly, scrollRef]);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "sdoc-article-container",
|
|
38
|
+
style: containerStyle
|
|
39
|
+
}, React.Children.count(children) === 1 && /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "article",
|
|
41
|
+
ref: articleRef
|
|
42
|
+
}, children), React.Children.count(children) === 2 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "article",
|
|
44
|
+
ref: articleRef
|
|
45
|
+
}, children[0]), children[1]));
|
|
46
|
+
}
|
|
47
|
+
ArticleContainer.defaultProps = {
|
|
48
|
+
readOnly: false
|
|
49
|
+
};
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Fragment, useRef } from 'react';
|
|
2
2
|
import { Editable, Slate } from '@seafile/slate-react';
|
|
3
3
|
import defaultEditor, { renderLeaf as _renderLeaf, renderElement as _renderElement } from '../extension';
|
|
4
4
|
import withNodeId from '../node-id';
|
|
5
5
|
import { ScrollContext } from '../hooks/use-scroll-context';
|
|
6
|
-
import { generateDefaultDocContent } from '../../utils';
|
|
6
|
+
import { generateDefaultDocContent, isMobile } from '../../utils';
|
|
7
7
|
import { SetNodeToDecorations } from '../highlight-decorate/setNodeToDecorations';
|
|
8
8
|
import { usePipDecorate } from '../decorates';
|
|
9
|
+
import ArticleContainer from '../layout/article-container';
|
|
9
10
|
import '../assets/css/layout.css';
|
|
10
11
|
import '../assets/css/sdoc-editor-plugins.css';
|
|
11
12
|
import '../assets/css/dropdown-menu.css';
|
|
13
|
+
import '../assets/css/simple-viewer.css';
|
|
12
14
|
var SDocViewer = function SDocViewer(_ref) {
|
|
13
15
|
var document = _ref.document,
|
|
14
16
|
customRenderLeaf = _ref.renderLeaf,
|
|
15
17
|
customRenderElement = _ref.renderElement;
|
|
16
18
|
var editor = withNodeId(defaultEditor);
|
|
17
19
|
var slateValue = (document || generateDefaultDocContent()).children;
|
|
18
|
-
var articleRef = useRef(null);
|
|
19
20
|
var scrollRef = useRef(null);
|
|
20
21
|
var decorate = usePipDecorate(editor);
|
|
21
|
-
useEffect(function () {
|
|
22
|
-
editor.width = articleRef.current.children[0].clientWidth;
|
|
23
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
-
}, []);
|
|
25
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: "sdoc-editor-container"
|
|
23
|
+
className: "sdoc-editor-container ".concat(isMobile ? 'mobile' : '')
|
|
27
24
|
}, /*#__PURE__*/React.createElement("div", {
|
|
28
25
|
className: "sdoc-editor-content readonly"
|
|
29
26
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
27
|
ref: scrollRef,
|
|
31
|
-
className: "sdoc-
|
|
32
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
-
className: "sdoc-article-container"
|
|
28
|
+
className: "sdoc-scroll-container"
|
|
34
29
|
}, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
|
|
35
30
|
value: {
|
|
36
31
|
scrollRef: scrollRef
|
|
@@ -38,10 +33,10 @@ var SDocViewer = function SDocViewer(_ref) {
|
|
|
38
33
|
}, /*#__PURE__*/React.createElement(Slate, {
|
|
39
34
|
editor: editor,
|
|
40
35
|
value: slateValue
|
|
41
|
-
}, /*#__PURE__*/React.createElement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
36
|
+
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
37
|
+
editor: editor,
|
|
38
|
+
readOnly: true
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
45
40
|
readOnly: true,
|
|
46
41
|
placeholder: "",
|
|
47
42
|
renderElement: function renderElement(props) {
|
|
@@ -6,6 +6,7 @@ import HistoryOperation from './history-operation';
|
|
|
6
6
|
import CollaboratorsOperation from './collaborators-operation';
|
|
7
7
|
import MoreOperations from './more-operations';
|
|
8
8
|
import CommentsOperation from './comments-operation';
|
|
9
|
+
import ShareOperation from './share-operation';
|
|
9
10
|
import './style.css';
|
|
10
11
|
var DocOperations = function DocOperations(_ref) {
|
|
11
12
|
var isShowChanges = _ref.isShowChanges,
|
|
@@ -16,10 +17,6 @@ var DocOperations = function DocOperations(_ref) {
|
|
|
16
17
|
}, /*#__PURE__*/React.createElement(RevisionOperations, {
|
|
17
18
|
isShowChanges: isShowChanges,
|
|
18
19
|
toggleViewChanges: toggleViewChanges
|
|
19
|
-
}), /*#__PURE__*/React.createElement(CommentsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(
|
|
20
|
-
className: "op-item"
|
|
21
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
22
|
-
className: "sdocfont sdoc-share"
|
|
23
|
-
})), /*#__PURE__*/React.createElement(HistoryOperation, null), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
20
|
+
}), /*#__PURE__*/React.createElement(CommentsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(ShareOperation, null), /*#__PURE__*/React.createElement(HistoryOperation, null), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
24
21
|
};
|
|
25
22
|
export default withTranslation('sdoc-editor')(DocOperations);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { EventBus } from '../../../basic-sdk';
|
|
3
|
+
import { EXTERNAL_EVENT } from '../../../constants';
|
|
4
|
+
export default function ShareOperation() {
|
|
5
|
+
var onShareToggle = useCallback(function () {
|
|
6
|
+
var eventBus = EventBus.getInstance();
|
|
7
|
+
eventBus.dispatch(EXTERNAL_EVENT.SHARE_SDOC);
|
|
8
|
+
}, []);
|
|
9
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10
|
+
className: "op-item",
|
|
11
|
+
onClick: onShareToggle
|
|
12
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
13
|
+
className: "sdocfont sdoc-share"
|
|
14
|
+
}));
|
|
15
|
+
}
|
package/dist/constants/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export var EXTERNAL_EVENT = {
|
|
|
2
2
|
INTERNAL_LINK_CLICK: 'internal_link_click',
|
|
3
3
|
TOGGLE_STAR: 'toggle_star',
|
|
4
4
|
UNMARK_AS_DRAFT: 'unmark_as_draft',
|
|
5
|
+
SHARE_SDOC: 'share_sdoc',
|
|
5
6
|
CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range',
|
|
6
7
|
SET_TABLE_SELECT_RANGE: 'set_table_select_range'
|
|
7
8
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -44,4 +44,5 @@ export var isMac = function isMac() {
|
|
|
44
44
|
var platform = navigator.platform;
|
|
45
45
|
return platform === 'Mac68K' || platform === 'MacPPC' || platform === 'Macintosh' || platform === 'MacIntel';
|
|
46
46
|
};
|
|
47
|
+
export var isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);
|
|
47
48
|
export { DateUtils, LocalStorage };
|
package/package.json
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"Code_block": "Code block",
|
|
26
26
|
"Insert_link": "Insert link",
|
|
27
27
|
"Insert_table": "Insert table",
|
|
28
|
+
"Valid_values_for_rows_and_columns": "Valid values for the number of rows and columns are 0 to 50",
|
|
28
29
|
"Save": "Save",
|
|
29
30
|
"More": "More",
|
|
30
31
|
"Invalid_url": "Invalid URL",
|