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