@seafile/seafile-editor 0.3.132 → 0.3.134
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/components/{dialogs/add-formula-dialog.js → add-formula-dialog.js} +33 -12
- package/dist/components/{dialogs/add-image-dialog.js → add-image-dialog.js} +14 -2
- package/dist/components/{dialogs/add-link-dialog.js → add-link-dialog.js} +27 -10
- package/dist/components/click-outside.js +12 -0
- package/dist/components/{dialogs/comment-dialog.js → comment-dialog.js} +20 -4
- package/dist/components/context-menu.js +18 -3
- package/dist/components/error-boundary.js +7 -0
- package/dist/components/loading.js +7 -0
- package/dist/components/markdown-lint.js +16 -0
- package/dist/components/menu/item.js +15 -4
- package/dist/components/menu/menu.js +11 -0
- package/dist/components/modal-portal.js +8 -0
- package/dist/components/outline/index.js +22 -4
- package/dist/components/outline/outline-item.js +20 -6
- package/dist/components/select/_option.js +15 -3
- package/dist/components/select/field-setting.js +29 -6
- package/dist/components/select/index.js +32 -9
- package/dist/components/{dialogs/shortcut-dialog.js → shortcut-dialog.js} +16 -4
- package/dist/components/svg-icons/check-mark-icon.js +2 -0
- package/dist/components/svg-icons/column-icon.js +2 -0
- package/dist/components/svg-icons/text-icon.js +2 -0
- package/dist/components/toast/alert.js +12 -0
- package/dist/components/toast/toast.js +21 -1
- package/dist/components/toast/toastManager.js +27 -4
- package/dist/components/toast/toaster.js +17 -6
- package/dist/components/toolbar/header-list.js +14 -0
- package/dist/components/toolbar/help-group.js +7 -0
- package/dist/components/toolbar/insert-image.js +21 -2
- package/dist/components/toolbar/insert-table.js +35 -16
- package/dist/components/toolbar/table-group.js +8 -0
- package/dist/components/toolbar/toolbar.js +84 -103
- package/dist/components/toolbar/widgets/button-group.js +7 -0
- package/dist/components/toolbar/widgets/button-item.js +35 -16
- package/dist/components/toolbar/widgets/drop-list.js +13 -0
- package/dist/components/{user-help/index.js → user-help.js} +35 -3
- package/dist/constants/cell-types.js +1 -2
- package/dist/constants/column.js +2 -0
- package/dist/{containers → editor}/code-highlight-package.js +13 -0
- package/dist/{containers → editor}/controller/block-element-controller.js +88 -24
- package/dist/{containers → editor}/controller/inline-element-controller.js +25 -6
- package/dist/{containers → editor}/controller/normalize-controller.js +25 -11
- package/dist/{containers → editor}/controller/shortcut-controller.js +136 -74
- package/dist/{containers → editor}/controller/void-element-controller.js +3 -0
- package/dist/{containers → editor}/custom/custom.js +2 -3
- package/dist/{containers → editor}/custom/get-event-transfer.js +4 -3
- package/dist/{containers → editor}/custom/getNodesByTypeAtRange.js +21 -9
- package/dist/{containers → editor}/custom/insertNodes.js +35 -15
- package/dist/{containers → editor}/custom/is-empty-paragraph.js +4 -0
- package/dist/{containers → editor}/custom/set-event-transfer.js +3 -2
- package/dist/editor/custom/split-nodes-at-point.js +162 -0
- package/dist/{containers → editor}/custom/unwrap-node-by-type-at-range.js +25 -14
- package/dist/{containers/editor-context.js → editor/editor-builder.js} +38 -6
- package/dist/{containers/editor-widgets → editor/editor-component}/check-list-item.js +14 -3
- package/dist/{containers/editor-widgets → editor/editor-component}/code-block.js +27 -5
- package/dist/{containers/editor-widgets → editor/editor-component}/column.js +38 -14
- package/dist/{containers/editor-widgets → editor/editor-component}/formula.js +19 -5
- package/dist/{containers/editor-widgets → editor/editor-component}/image.js +56 -11
- package/dist/{containers/editor-widgets → editor/editor-component}/link.js +2 -0
- package/dist/{containers/editor-widgets → editor/editor-component}/table.js +41 -13
- package/dist/{components/text-link-hover-menu/index.js → editor/editor-component/textlink-hovermenu.js} +23 -1
- package/dist/editor/editor-plugin.js +270 -0
- package/dist/{containers → editor}/editor-utils/block-element-utils/blockquote-utils.js +25 -9
- package/dist/{containers → editor}/editor-utils/block-element-utils/code-utils.js +29 -6
- package/dist/{containers → editor}/editor-utils/block-element-utils/formula-utils.js +8 -1
- package/dist/{containers → editor}/editor-utils/block-element-utils/index.js +16 -9
- package/dist/{containers → editor}/editor-utils/block-element-utils/list-utils.js +105 -58
- package/dist/{containers → editor}/editor-utils/block-element-utils/table-utils.js +105 -40
- package/dist/{containers → editor}/editor-utils/clear-format-utils.js +19 -9
- package/dist/editor/editor-utils/common-editor-utils.js +622 -0
- package/dist/{containers → editor}/editor-utils/inline-element-utils/index.js +37 -18
- package/dist/{containers → editor}/editor-utils/mark-utils.js +8 -3
- package/dist/{containers → editor}/editor-utils/range-utils.js +2 -0
- package/dist/{containers → editor}/editor-utils/selection-utils.js +10 -7
- package/dist/{containers → editor}/editor-utils/text-utils.js +27 -17
- package/dist/editor/editor.js +35 -0
- package/dist/{containers → editor}/element-model/blockquote.js +6 -3
- package/dist/{containers → editor}/element-model/column.js +6 -3
- package/dist/{containers → editor}/element-model/image.js +6 -3
- package/dist/{containers → editor}/element-model/link.js +6 -3
- package/dist/{containers → editor}/element-model/table.js +24 -8
- package/dist/{containers → editor}/element-model/text.js +6 -3
- package/dist/{editors → editor}/index.js +23 -3
- package/dist/{components/load-script/index.js → editor/load-script.js} +17 -4
- package/dist/{editors → editor}/markdown-editor.js +77 -23
- package/dist/{editors → editor}/plain-markdown-editor.js +50 -6
- package/dist/{editors → editor}/seatable-editor.js +55 -33
- package/dist/{editors → editor}/simple-editor.js +51 -30
- package/dist/index.js +7 -6
- package/dist/lib/slate-hyperscript/creators.js +263 -0
- package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
- package/dist/lib/slate-hyperscript/index.js +3 -0
- package/dist/lib/slate-hyperscript/tokens.js +102 -0
- package/dist/lib/unified/index.js +470 -0
- package/dist/lib/vfile/core.js +172 -0
- package/dist/lib/vfile/index.js +48 -0
- package/dist/utils/copy-to-clipboard.js +47 -0
- package/dist/utils/deserialize-html.js +28 -6
- package/dist/utils/diff/compare-strings.js +9 -0
- package/dist/utils/diff/diff.js +123 -41
- package/dist/{containers/render-utils/viewer-utils.js → utils/render-slate.js} +48 -10
- package/dist/utils/seafile-markdown2html.js +28 -8
- package/dist/utils/slate2markdown/deserialize.js +143 -43
- package/dist/utils/slate2markdown/serialize.js +80 -19
- package/dist/utils/utils.js +18 -8
- package/dist/viewer/diff-viewer.js +16 -3
- package/dist/viewer/markdown-viewer.js +26 -5
- package/dist/viewer/seatable-viewer.js +11 -0
- package/dist/viewer/slate-viewer.js +28 -14
- package/dist/{containers/viewer-widgets/viewer-formula/index.js → viewer/viewer-formula.js} +16 -3
- package/dist/viewer/viewer-image.css +7 -0
- package/dist/{containers/viewer-widgets/viewer-image/index.js → viewer/viewer-image.js} +17 -3
- package/dist/viewer/viewer-outline.js +118 -0
- package/package.json +82 -27
- package/dist/containers/controller/index.js +0 -5
- package/dist/containers/custom/split-nodes-at-point.js +0 -136
- package/dist/containers/editor-utils/common-editor-utils.js +0 -492
- package/dist/containers/render-utils/common-utils.js +0 -80
- package/dist/containers/render-utils/editor-utils.js +0 -133
- package/dist/containers/viewer-widgets/viewer-image/viewer-image.css +0 -3
- package/dist/viewer/index.js +0 -4
|
@@ -6,85 +6,104 @@ import React, { Fragment } from 'react';
|
|
|
6
6
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
|
7
7
|
import { withTranslation } from 'react-i18next';
|
|
8
8
|
import { Editor } from 'slate';
|
|
9
|
-
import
|
|
9
|
+
import EditorBuilder from '../editor/editor-builder';
|
|
10
|
+
|
|
10
11
|
var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
12
|
_inherits(AddFormulaDialog, _React$PureComponent);
|
|
13
|
+
|
|
12
14
|
var _super = _createSuper(AddFormulaDialog);
|
|
15
|
+
|
|
13
16
|
function AddFormulaDialog(props) {
|
|
14
17
|
var _this;
|
|
18
|
+
|
|
15
19
|
_classCallCheck(this, AddFormulaDialog);
|
|
20
|
+
|
|
16
21
|
_this = _super.call(this, props);
|
|
22
|
+
|
|
17
23
|
_this.setInitialValue = function () {
|
|
18
|
-
var editor =
|
|
24
|
+
var editor = EditorBuilder.getEditor();
|
|
19
25
|
var nodes = Editor.match(editor, editor.selection, {
|
|
20
26
|
type: 'formula'
|
|
21
27
|
});
|
|
28
|
+
|
|
22
29
|
if (nodes) {
|
|
23
30
|
var data = nodes[0].data;
|
|
31
|
+
|
|
24
32
|
_this.setState({
|
|
25
33
|
formula: data.formula
|
|
26
34
|
});
|
|
35
|
+
|
|
27
36
|
_this.formulaNode = nodes;
|
|
28
37
|
}
|
|
29
38
|
};
|
|
39
|
+
|
|
30
40
|
_this.handleFormulaChange = function (event) {
|
|
31
41
|
_this.renderFormula(event.target.value);
|
|
42
|
+
|
|
32
43
|
_this.setState({
|
|
33
44
|
formula: event.target.value
|
|
34
45
|
});
|
|
35
46
|
};
|
|
47
|
+
|
|
36
48
|
_this.renderFormula = function (formula) {
|
|
37
49
|
_this.formulaPreviewer.innerHTML = '';
|
|
38
50
|
var dom = window.MathJax.tex2svg(formula);
|
|
51
|
+
|
|
39
52
|
_this.formulaPreviewer.appendChild(dom);
|
|
40
53
|
};
|
|
54
|
+
|
|
41
55
|
_this.handleSubmit = function (event) {
|
|
42
56
|
event.preventDefault();
|
|
43
57
|
var formula = _this.state.formula;
|
|
58
|
+
|
|
44
59
|
if (_this.formulaNode) {
|
|
45
60
|
_this.editorUtils.setFormula({
|
|
46
61
|
formula: formula,
|
|
47
62
|
at: _this.formulaNode[1]
|
|
48
63
|
});
|
|
49
64
|
} else {
|
|
50
|
-
_this.editorUtils.
|
|
65
|
+
_this.editorUtils.onAddFormula({
|
|
51
66
|
formula: formula,
|
|
52
67
|
at: _this.editorSelection
|
|
53
68
|
});
|
|
54
69
|
}
|
|
70
|
+
|
|
55
71
|
_this.props.toggleFormulaDialog();
|
|
56
72
|
};
|
|
73
|
+
|
|
74
|
+
_this.editorUtils = EditorBuilder.getEditorUtils();
|
|
57
75
|
_this.state = {
|
|
58
76
|
formula: ''
|
|
59
77
|
};
|
|
60
78
|
_this.formulaNode = null;
|
|
61
79
|
_this.editorSelection = null;
|
|
62
|
-
_this.editorUtils = EditorContext.getEditorUtils();
|
|
63
80
|
return _this;
|
|
64
81
|
}
|
|
82
|
+
|
|
65
83
|
_createClass(AddFormulaDialog, [{
|
|
66
|
-
key: "componentWillMount",
|
|
67
|
-
value: function componentWillMount() {
|
|
68
|
-
this.setInitialValue();
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
84
|
key: "componentDidMount",
|
|
72
85
|
value: function componentDidMount() {
|
|
73
|
-
var editor =
|
|
86
|
+
var editor = EditorBuilder.getEditor();
|
|
74
87
|
this.editorSelection = editor.selection;
|
|
88
|
+
|
|
75
89
|
if (this.formulaNode) {
|
|
76
90
|
this.renderFormula(this.state.formula);
|
|
77
91
|
}
|
|
78
92
|
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "componentWillMount",
|
|
95
|
+
value: function componentWillMount() {
|
|
96
|
+
this.setInitialValue();
|
|
97
|
+
}
|
|
79
98
|
}, {
|
|
80
99
|
key: "render",
|
|
81
100
|
value: function render() {
|
|
82
101
|
var _this2 = this;
|
|
102
|
+
|
|
83
103
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
84
104
|
isOpen: true,
|
|
85
105
|
toggle: this.props.toggleFormulaDialog,
|
|
86
|
-
className: this.props.className
|
|
87
|
-
returnFocusAfterClose: false
|
|
106
|
+
className: this.props.className
|
|
88
107
|
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
89
108
|
toggle: this.props.toggleFormulaDialog
|
|
90
109
|
}, this.props.t('insert_formula')), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -111,6 +130,8 @@ var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
111
130
|
}, this.props.t('insert_formula'))));
|
|
112
131
|
}
|
|
113
132
|
}]);
|
|
133
|
+
|
|
114
134
|
return AddFormulaDialog;
|
|
115
135
|
}(React.PureComponent);
|
|
136
|
+
|
|
116
137
|
export default withTranslation('seafile-editor')(AddFormulaDialog);
|
|
@@ -5,36 +5,46 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Form, FormGroup, Label, Input } from 'reactstrap';
|
|
7
7
|
import { withTranslation } from 'react-i18next';
|
|
8
|
-
import
|
|
8
|
+
import EditorBuilder from '../editor/editor-builder';
|
|
9
|
+
|
|
9
10
|
var AddImageDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
11
|
_inherits(AddImageDialog, _React$PureComponent);
|
|
12
|
+
|
|
11
13
|
var _super = _createSuper(AddImageDialog);
|
|
14
|
+
|
|
12
15
|
function AddImageDialog(props) {
|
|
13
16
|
var _this;
|
|
17
|
+
|
|
14
18
|
_classCallCheck(this, AddImageDialog);
|
|
19
|
+
|
|
15
20
|
_this = _super.call(this, props);
|
|
21
|
+
|
|
16
22
|
_this.handleUrlChange = function (event) {
|
|
17
23
|
_this.setState({
|
|
18
24
|
url: event.target.value
|
|
19
25
|
});
|
|
20
26
|
};
|
|
27
|
+
|
|
21
28
|
_this.handleSubmit = function (event) {
|
|
22
29
|
_this.props.insertImage({
|
|
23
30
|
url: _this.state.url,
|
|
24
31
|
selection: _this.editorSelection
|
|
25
32
|
});
|
|
33
|
+
|
|
26
34
|
_this.props.onToggleImageDialog();
|
|
27
35
|
};
|
|
36
|
+
|
|
28
37
|
_this.state = {
|
|
29
38
|
url: ''
|
|
30
39
|
};
|
|
31
40
|
_this.editorSelection = null;
|
|
32
41
|
return _this;
|
|
33
42
|
}
|
|
43
|
+
|
|
34
44
|
_createClass(AddImageDialog, [{
|
|
35
45
|
key: "componentDidMount",
|
|
36
46
|
value: function componentDidMount() {
|
|
37
|
-
var editor =
|
|
47
|
+
var editor = EditorBuilder.getEditor();
|
|
38
48
|
this.editorSelection = editor.selection;
|
|
39
49
|
}
|
|
40
50
|
}, {
|
|
@@ -64,6 +74,8 @@ var AddImageDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
74
|
}, this.props.t('submit')), ' '));
|
|
65
75
|
}
|
|
66
76
|
}]);
|
|
77
|
+
|
|
67
78
|
return AddImageDialog;
|
|
68
79
|
}(React.PureComponent);
|
|
80
|
+
|
|
69
81
|
export default withTranslation('seafile-editor')(AddImageDialog);
|
|
@@ -5,18 +5,26 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
|
7
7
|
import { withTranslation } from 'react-i18next';
|
|
8
|
-
import
|
|
8
|
+
import EditorBuilder from '../editor/editor-builder';
|
|
9
|
+
|
|
9
10
|
var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
11
|
_inherits(AddLinkDialog, _React$PureComponent);
|
|
12
|
+
|
|
11
13
|
var _super = _createSuper(AddLinkDialog);
|
|
14
|
+
|
|
12
15
|
function AddLinkDialog(props) {
|
|
13
16
|
var _this;
|
|
17
|
+
|
|
14
18
|
_classCallCheck(this, AddLinkDialog);
|
|
19
|
+
|
|
15
20
|
_this = _super.call(this, props);
|
|
21
|
+
|
|
16
22
|
_this.setInitialValue = function () {
|
|
17
23
|
var text = _this.editorUtils.getSelectedText();
|
|
24
|
+
|
|
18
25
|
if (_this.isLinkActive) {
|
|
19
26
|
var linkNode = _this.editorUtils.getCurrentLinkNode();
|
|
27
|
+
|
|
20
28
|
_this.setState({
|
|
21
29
|
title: _this.editorUtils.getLinkText(linkNode),
|
|
22
30
|
url: linkNode.data.href
|
|
@@ -28,19 +36,23 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
28
36
|
});
|
|
29
37
|
}
|
|
30
38
|
};
|
|
39
|
+
|
|
31
40
|
_this.handleUrlChange = function (event) {
|
|
32
41
|
_this.setState({
|
|
33
42
|
url: event.target.value
|
|
34
43
|
});
|
|
35
44
|
};
|
|
45
|
+
|
|
36
46
|
_this.handleTitleChange = function (event) {
|
|
37
47
|
_this.setState({
|
|
38
48
|
title: event.target.value
|
|
39
49
|
});
|
|
40
50
|
};
|
|
51
|
+
|
|
41
52
|
_this.handleSubmit = function (event) {
|
|
42
53
|
event.preventDefault();
|
|
43
54
|
if (_this.state.title.length === 0 || _this.state.url.length === 0) return;
|
|
55
|
+
|
|
44
56
|
if (!_this.isLinkActive) {
|
|
45
57
|
_this.editorUtils.insertLink({
|
|
46
58
|
text: _this.state.title,
|
|
@@ -54,14 +66,17 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
54
66
|
selection: _this.editorSelection
|
|
55
67
|
});
|
|
56
68
|
}
|
|
69
|
+
|
|
57
70
|
_this.props.toggleLinkDialog();
|
|
58
71
|
};
|
|
72
|
+
|
|
59
73
|
_this.onKeyDown = function (e) {
|
|
60
74
|
if (e.keyCode === 13) {
|
|
61
75
|
_this.handleSubmit(e);
|
|
62
76
|
}
|
|
63
77
|
};
|
|
64
|
-
|
|
78
|
+
|
|
79
|
+
_this.editorUtils = EditorBuilder.getEditorUtils();
|
|
65
80
|
_this.isLinkActive = _this.editorUtils.isLinkActive();
|
|
66
81
|
_this.editorSelection = null;
|
|
67
82
|
_this.state = {
|
|
@@ -70,17 +85,18 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
70
85
|
};
|
|
71
86
|
return _this;
|
|
72
87
|
}
|
|
88
|
+
|
|
73
89
|
_createClass(AddLinkDialog, [{
|
|
74
|
-
key: "componentWillMount",
|
|
75
|
-
value: function componentWillMount() {
|
|
76
|
-
this.setInitialValue();
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
90
|
key: "componentDidMount",
|
|
80
91
|
value: function componentDidMount() {
|
|
81
|
-
var editor =
|
|
92
|
+
var editor = EditorBuilder.getEditor();
|
|
82
93
|
this.editorSelection = editor.selection;
|
|
83
94
|
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "componentWillMount",
|
|
97
|
+
value: function componentWillMount() {
|
|
98
|
+
this.setInitialValue();
|
|
99
|
+
}
|
|
84
100
|
}, {
|
|
85
101
|
key: "render",
|
|
86
102
|
value: function render() {
|
|
@@ -89,8 +105,7 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
105
|
autoFocus: false,
|
|
90
106
|
toggle: this.props.toggleLinkDialog,
|
|
91
107
|
className: this.props.className,
|
|
92
|
-
zIndex: 1071
|
|
93
|
-
returnFocusAfterClose: false
|
|
108
|
+
zIndex: 1071
|
|
94
109
|
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
95
110
|
toggle: this.props.toggleLinkDialog
|
|
96
111
|
}, this.props.t('insert_link')), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -128,6 +143,8 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
128
143
|
}, this.props.t('add_link'))));
|
|
129
144
|
}
|
|
130
145
|
}]);
|
|
146
|
+
|
|
131
147
|
return AddLinkDialog;
|
|
132
148
|
}(React.PureComponent);
|
|
149
|
+
|
|
133
150
|
export default withTranslation('seafile-editor')(AddLinkDialog);
|
|
@@ -3,26 +3,36 @@ 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
7
|
var ClickOutside = /*#__PURE__*/function (_React$Component) {
|
|
7
8
|
_inherits(ClickOutside, _React$Component);
|
|
9
|
+
|
|
8
10
|
var _super = _createSuper(ClickOutside);
|
|
11
|
+
|
|
9
12
|
function ClickOutside(props) {
|
|
10
13
|
var _this;
|
|
14
|
+
|
|
11
15
|
_classCallCheck(this, ClickOutside);
|
|
16
|
+
|
|
12
17
|
_this = _super.call(this, props);
|
|
18
|
+
|
|
13
19
|
_this.handleDocumentMouseDown = function () {
|
|
14
20
|
if (_this.isClickedInside) {
|
|
15
21
|
_this.isClickedInside = false;
|
|
16
22
|
return;
|
|
17
23
|
}
|
|
24
|
+
|
|
18
25
|
_this.props.clickOutside();
|
|
19
26
|
};
|
|
27
|
+
|
|
20
28
|
_this.handleMouseDown = function (e) {
|
|
21
29
|
_this.isClickedInside = true;
|
|
22
30
|
};
|
|
31
|
+
|
|
23
32
|
_this.isClickedInside = false;
|
|
24
33
|
return _this;
|
|
25
34
|
}
|
|
35
|
+
|
|
26
36
|
_createClass(ClickOutside, [{
|
|
27
37
|
key: "componentDidMount",
|
|
28
38
|
value: function componentDidMount() {
|
|
@@ -41,6 +51,8 @@ var ClickOutside = /*#__PURE__*/function (_React$Component) {
|
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
53
|
}]);
|
|
54
|
+
|
|
44
55
|
return ClickOutside;
|
|
45
56
|
}(React.Component);
|
|
57
|
+
|
|
46
58
|
export default ClickOutside;
|
|
@@ -5,48 +5,62 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { withTranslation } from 'react-i18next';
|
|
7
7
|
import { Button } from 'reactstrap';
|
|
8
|
-
import { processor } from '
|
|
9
|
-
import '
|
|
8
|
+
import { processor } from '../utils/seafile-markdown2html';
|
|
9
|
+
import '../assets/css/comment-dialog.css';
|
|
10
|
+
|
|
10
11
|
var CommentDialog = /*#__PURE__*/function (_React$Component) {
|
|
11
12
|
_inherits(CommentDialog, _React$Component);
|
|
13
|
+
|
|
12
14
|
var _super = _createSuper(CommentDialog);
|
|
15
|
+
|
|
13
16
|
function CommentDialog(props) {
|
|
14
17
|
var _this;
|
|
18
|
+
|
|
15
19
|
_classCallCheck(this, CommentDialog);
|
|
20
|
+
|
|
16
21
|
_this = _super.call(this, props);
|
|
22
|
+
|
|
17
23
|
_this.handleCommentChange = function (event) {
|
|
18
24
|
var comment = event.target.value;
|
|
25
|
+
|
|
19
26
|
_this.setState({
|
|
20
27
|
comment: comment
|
|
21
28
|
});
|
|
22
29
|
};
|
|
30
|
+
|
|
23
31
|
_this.submitComment = function () {
|
|
24
32
|
var comment = _this.state.comment.trim();
|
|
33
|
+
|
|
25
34
|
if (comment.length > 0 && _this.props.quote.length > 0) {
|
|
26
35
|
var detail = {
|
|
27
36
|
quote: _this.props.quote,
|
|
28
37
|
position: _this.props.commentPosition
|
|
29
38
|
};
|
|
30
39
|
var detailJSON = JSON.stringify(detail);
|
|
40
|
+
|
|
31
41
|
_this.props.editorApi.postComment(comment, detailJSON).then(function (res) {
|
|
32
42
|
_this.props.onCommentAdded();
|
|
33
43
|
});
|
|
34
44
|
}
|
|
35
45
|
};
|
|
46
|
+
|
|
36
47
|
_this.setQuoteText = function (mdQuote) {
|
|
37
48
|
processor.process(mdQuote).then(function (result) {
|
|
38
49
|
var quote = String(result);
|
|
50
|
+
|
|
39
51
|
_this.setState({
|
|
40
52
|
quote: quote
|
|
41
53
|
});
|
|
42
54
|
});
|
|
43
55
|
};
|
|
56
|
+
|
|
44
57
|
_this.state = {
|
|
45
58
|
comment: '',
|
|
46
59
|
quote: ''
|
|
47
60
|
};
|
|
48
61
|
return _this;
|
|
49
62
|
}
|
|
63
|
+
|
|
50
64
|
_createClass(CommentDialog, [{
|
|
51
65
|
key: "componentDidMount",
|
|
52
66
|
value: function componentDidMount() {
|
|
@@ -64,8 +78,8 @@ var CommentDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
64
78
|
value: function render() {
|
|
65
79
|
var t = this.props.t;
|
|
66
80
|
var _this$state = this.state,
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
comment = _this$state.comment,
|
|
82
|
+
quote = _this$state.quote;
|
|
69
83
|
return /*#__PURE__*/React.createElement("div", {
|
|
70
84
|
className: "seafile-editor-comment comment-dialog"
|
|
71
85
|
}, /*#__PURE__*/React.createElement("div", null, this.props.editorApi.name), /*#__PURE__*/React.createElement("blockquote", {
|
|
@@ -92,6 +106,8 @@ var CommentDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
92
106
|
}));
|
|
93
107
|
}
|
|
94
108
|
}]);
|
|
109
|
+
|
|
95
110
|
return CommentDialog;
|
|
96
111
|
}(React.Component);
|
|
112
|
+
|
|
97
113
|
export default withTranslation('seafile-editor')(CommentDialog);
|
|
@@ -4,26 +4,36 @@ 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
|
+
|
|
7
8
|
var ContextMenu = /*#__PURE__*/function (_React$Component) {
|
|
8
9
|
_inherits(ContextMenu, _React$Component);
|
|
10
|
+
|
|
9
11
|
var _super = _createSuper(ContextMenu);
|
|
12
|
+
|
|
10
13
|
function ContextMenu(props) {
|
|
11
14
|
var _this;
|
|
15
|
+
|
|
12
16
|
_classCallCheck(this, ContextMenu);
|
|
17
|
+
|
|
13
18
|
_this = _super.call(this, props);
|
|
19
|
+
|
|
14
20
|
_this.setMenuPosition = function () {
|
|
15
|
-
var menuHeight = _this.menu.offsetHeight;
|
|
16
|
-
|
|
21
|
+
var menuHeight = _this.menu.offsetHeight; // get height of context menu when the menu is drawing completed in this page
|
|
22
|
+
|
|
17
23
|
if (menuHeight === 0) {
|
|
18
24
|
requestAnimationFrame(_this.setMenuPosition);
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
var top = 0;
|
|
28
|
+
|
|
21
29
|
if (_this.position.top + menuHeight > document.body.clientHeight) {
|
|
22
30
|
top = document.body.clientHeight - menuHeight - 5;
|
|
23
31
|
} else {
|
|
24
32
|
top = _this.position.top;
|
|
25
33
|
}
|
|
34
|
+
|
|
26
35
|
var left = _this.position.left + 3;
|
|
36
|
+
|
|
27
37
|
_this.setState({
|
|
28
38
|
contextStyle: {
|
|
29
39
|
top: top,
|
|
@@ -33,12 +43,14 @@ var ContextMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
33
43
|
}
|
|
34
44
|
});
|
|
35
45
|
};
|
|
46
|
+
|
|
47
|
+
_this.tableUtils = props.tableUtils;
|
|
36
48
|
_this.state = {
|
|
37
49
|
contextStyle: {}
|
|
38
50
|
};
|
|
39
|
-
_this.tableUtils = props.tableUtils;
|
|
40
51
|
return _this;
|
|
41
52
|
}
|
|
53
|
+
|
|
42
54
|
_createClass(ContextMenu, [{
|
|
43
55
|
key: "componentDidMount",
|
|
44
56
|
value: function componentDidMount() {
|
|
@@ -54,6 +66,7 @@ var ContextMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
54
66
|
key: "render",
|
|
55
67
|
value: function render() {
|
|
56
68
|
var _this2 = this;
|
|
69
|
+
|
|
57
70
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
71
|
role: 'menu',
|
|
59
72
|
style: this.state.contextStyle,
|
|
@@ -92,6 +105,8 @@ var ContextMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
92
105
|
}, this.props.t('Remove_Column')));
|
|
93
106
|
}
|
|
94
107
|
}]);
|
|
108
|
+
|
|
95
109
|
return ContextMenu;
|
|
96
110
|
}(React.Component);
|
|
111
|
+
|
|
97
112
|
export default withTranslation('seafile-editor')(ContextMenu);
|
|
@@ -3,13 +3,18 @@ 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, { Children } from 'react';
|
|
6
|
+
|
|
6
7
|
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
7
8
|
_inherits(ErrorBoundary, _React$Component);
|
|
9
|
+
|
|
8
10
|
var _super = _createSuper(ErrorBoundary);
|
|
11
|
+
|
|
9
12
|
function ErrorBoundary() {
|
|
10
13
|
_classCallCheck(this, ErrorBoundary);
|
|
14
|
+
|
|
11
15
|
return _super.apply(this, arguments);
|
|
12
16
|
}
|
|
17
|
+
|
|
13
18
|
_createClass(ErrorBoundary, [{
|
|
14
19
|
key: "componentDidCatch",
|
|
15
20
|
value: function componentDidCatch(error) {
|
|
@@ -23,6 +28,8 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
23
28
|
return children;
|
|
24
29
|
}
|
|
25
30
|
}]);
|
|
31
|
+
|
|
26
32
|
return ErrorBoundary;
|
|
27
33
|
}(React.Component);
|
|
34
|
+
|
|
28
35
|
export default ErrorBoundary;
|
|
@@ -3,13 +3,18 @@ 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
7
|
var Loading = /*#__PURE__*/function (_React$Component) {
|
|
7
8
|
_inherits(Loading, _React$Component);
|
|
9
|
+
|
|
8
10
|
var _super = _createSuper(Loading);
|
|
11
|
+
|
|
9
12
|
function Loading() {
|
|
10
13
|
_classCallCheck(this, Loading);
|
|
14
|
+
|
|
11
15
|
return _super.apply(this, arguments);
|
|
12
16
|
}
|
|
17
|
+
|
|
13
18
|
_createClass(Loading, [{
|
|
14
19
|
key: "render",
|
|
15
20
|
value: function render() {
|
|
@@ -20,6 +25,8 @@ var Loading = /*#__PURE__*/function (_React$Component) {
|
|
|
20
25
|
}, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null)));
|
|
21
26
|
}
|
|
22
27
|
}]);
|
|
28
|
+
|
|
23
29
|
return Loading;
|
|
24
30
|
}(React.Component);
|
|
31
|
+
|
|
25
32
|
export default Loading;
|
|
@@ -4,30 +4,42 @@ 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 '../assets/css/issue-card.css';
|
|
7
|
+
|
|
7
8
|
var MarkdownLint = /*#__PURE__*/function (_React$PureComponent) {
|
|
8
9
|
_inherits(MarkdownLint, _React$PureComponent);
|
|
10
|
+
|
|
9
11
|
var _super = _createSuper(MarkdownLint);
|
|
12
|
+
|
|
10
13
|
function MarkdownLint() {
|
|
11
14
|
var _this;
|
|
15
|
+
|
|
12
16
|
_classCallCheck(this, MarkdownLint);
|
|
17
|
+
|
|
13
18
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
19
|
args[_key] = arguments[_key];
|
|
15
20
|
}
|
|
21
|
+
|
|
16
22
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
+
|
|
17
24
|
_this.onClickCard = function (event, key) {
|
|
18
25
|
if (_this.props.document[key]) {
|
|
19
26
|
var node = _this.props.document[key];
|
|
20
27
|
node.key = key;
|
|
28
|
+
|
|
21
29
|
_this.props.scrollToNode(node);
|
|
22
30
|
}
|
|
23
31
|
};
|
|
32
|
+
|
|
24
33
|
return _this;
|
|
25
34
|
}
|
|
35
|
+
|
|
26
36
|
_createClass(MarkdownLint, [{
|
|
27
37
|
key: "render",
|
|
28
38
|
value: function render() {
|
|
29
39
|
var _this2 = this;
|
|
40
|
+
|
|
30
41
|
var issueCards = [];
|
|
42
|
+
|
|
31
43
|
if (this.props.issues.issue_list.length > 0) {
|
|
32
44
|
this.props.issues.issue_list.map(function (issue, index) {
|
|
33
45
|
if (issue.detail) {
|
|
@@ -57,9 +69,11 @@ var MarkdownLint = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
57
69
|
}, _this2.props.markdownLint[issue.issue_code].description));
|
|
58
70
|
issueCards.push(card);
|
|
59
71
|
}
|
|
72
|
+
|
|
60
73
|
return true;
|
|
61
74
|
});
|
|
62
75
|
}
|
|
76
|
+
|
|
63
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
78
|
className: 'issue-container'
|
|
65
79
|
}, issueCards.length > 0 ? issueCards : /*#__PURE__*/React.createElement("div", {
|
|
@@ -67,6 +81,8 @@ var MarkdownLint = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
81
|
}, this.props.t('no_document_improvement_suggestion')));
|
|
68
82
|
}
|
|
69
83
|
}]);
|
|
84
|
+
|
|
70
85
|
return MarkdownLint;
|
|
71
86
|
}(React.PureComponent);
|
|
87
|
+
|
|
72
88
|
export default MarkdownLint;
|
|
@@ -5,29 +5,38 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import CheckMarkIcon from '../svg-icons/check-mark-icon';
|
|
7
7
|
import './style.css';
|
|
8
|
+
|
|
8
9
|
var MenuItem = /*#__PURE__*/function (_React$Component) {
|
|
9
10
|
_inherits(MenuItem, _React$Component);
|
|
11
|
+
|
|
10
12
|
var _super = _createSuper(MenuItem);
|
|
13
|
+
|
|
11
14
|
function MenuItem() {
|
|
12
15
|
var _this;
|
|
16
|
+
|
|
13
17
|
_classCallCheck(this, MenuItem);
|
|
18
|
+
|
|
14
19
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
20
|
args[_key] = arguments[_key];
|
|
16
21
|
}
|
|
22
|
+
|
|
17
23
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
|
|
18
25
|
_this.onClick = function (e) {
|
|
19
26
|
_this.props.onClick(e);
|
|
20
27
|
};
|
|
28
|
+
|
|
21
29
|
return _this;
|
|
22
30
|
}
|
|
31
|
+
|
|
23
32
|
_createClass(MenuItem, [{
|
|
24
33
|
key: "render",
|
|
25
34
|
value: function render() {
|
|
26
35
|
var _this$props = this.props,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
children = _this$props.children,
|
|
37
|
+
itemClass = _this$props.itemClass,
|
|
38
|
+
iconClass = _this$props.iconClass,
|
|
39
|
+
isChecked = _this$props.isChecked;
|
|
31
40
|
var containerClass = "seafile-menu-item ".concat(itemClass || '');
|
|
32
41
|
var itemIconClass = "menu-item-icon ".concat(iconClass || '');
|
|
33
42
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -44,6 +53,8 @@ var MenuItem = /*#__PURE__*/function (_React$Component) {
|
|
|
44
53
|
}));
|
|
45
54
|
}
|
|
46
55
|
}]);
|
|
56
|
+
|
|
47
57
|
return MenuItem;
|
|
48
58
|
}(React.Component);
|
|
59
|
+
|
|
49
60
|
export default MenuItem;
|