@seafile/seafile-editor 0.3.76
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/README.md +119 -0
- package/TODO.md +55 -0
- package/dist/components/add-formula-dialog.js +135 -0
- package/dist/components/add-image-dialog.js +78 -0
- package/dist/components/add-link-dialog.js +148 -0
- package/dist/components/comment-dialog.js +107 -0
- package/dist/components/comment-panel.js +452 -0
- package/dist/components/context-menu.js +112 -0
- package/dist/components/detail-list-view.js +119 -0
- package/dist/components/generate-share-link.js +412 -0
- package/dist/components/internal-link-dialog.js +96 -0
- package/dist/components/loading.js +32 -0
- package/dist/components/markdown-lint.js +87 -0
- package/dist/components/modal-portal.js +46 -0
- package/dist/components/outline.js +130 -0
- package/dist/components/participants-list.js +126 -0
- package/dist/components/related-files-list.js +75 -0
- package/dist/components/shortcut-dialog.js +167 -0
- package/dist/components/side-panel.js +175 -0
- package/dist/components/toast/alert.js +150 -0
- package/dist/components/toast/index.js +3 -0
- package/dist/components/toast/toast.js +179 -0
- package/dist/components/toast/toastManager.js +158 -0
- package/dist/components/toast/toaster.js +76 -0
- package/dist/components/toolbar.js +235 -0
- package/dist/components/topbar-component/button-group.js +31 -0
- package/dist/components/topbar-component/editor-toolbar.js +545 -0
- package/dist/components/topbar-component/file-info.js +65 -0
- package/dist/components/topbar-component/header-list.js +128 -0
- package/dist/components/topbar-component/icon-button.js +99 -0
- package/dist/components/topbar-component/insert-file.js +67 -0
- package/dist/components/topbar-component/table-toolbar.js +175 -0
- package/dist/components/topbar-component/upload-img.js +122 -0
- package/dist/components/user-help.js +205 -0
- package/dist/css/diff-viewer.css +105 -0
- package/dist/css/history-viewer.css +104 -0
- package/dist/css/keyboard-shortcuts.css +59 -0
- package/dist/css/layout.css +110 -0
- package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
- package/dist/css/markdown-viewer.css +69 -0
- package/dist/css/plaineditor/markdown-editor.css +12 -0
- package/dist/css/react-mentions-default-style.js +72 -0
- package/dist/css/related-files-list.css +56 -0
- package/dist/css/richeditor/comments-list.css +184 -0
- package/dist/css/richeditor/detail-list-view.css +114 -0
- package/dist/css/richeditor/document-info.css +57 -0
- package/dist/css/richeditor/formula.css +19 -0
- package/dist/css/richeditor/image.css +141 -0
- package/dist/css/richeditor/link.css +7 -0
- package/dist/css/richeditor/navbar-imgbutton.css +79 -0
- package/dist/css/richeditor/participants-list.css +22 -0
- package/dist/css/richeditor/rich-editor-main.css +42 -0
- package/dist/css/richeditor/right-panel.css +84 -0
- package/dist/css/richeditor/side-panel.css +190 -0
- package/dist/css/richeditor/table.css +57 -0
- package/dist/css/richeditor/textlink-hovermenu.css +47 -0
- package/dist/css/richeditor/tree-view.css +67 -0
- package/dist/css/topbar.css +400 -0
- package/dist/editor/code-highlight-package.js +27 -0
- package/dist/editor/controller/block-element-controller.js +376 -0
- package/dist/editor/controller/inline-element-controller.js +129 -0
- package/dist/editor/controller/normalize-controller.js +107 -0
- package/dist/editor/controller/shortcut-controller.js +394 -0
- package/dist/editor/controller/void-element-controller.js +12 -0
- package/dist/editor/custom/custom.js +17 -0
- package/dist/editor/custom/get-event-transfer.js +34 -0
- package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
- package/dist/editor/custom/insertNodes.js +140 -0
- package/dist/editor/custom/is-empty-paragraph.js +13 -0
- package/dist/editor/custom/set-event-transfer.js +31 -0
- package/dist/editor/custom/split-nodes-at-point.js +162 -0
- package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
- package/dist/editor/editor-component/check-list-item.js +64 -0
- package/dist/editor/editor-component/code-block.js +150 -0
- package/dist/editor/editor-component/formula.js +79 -0
- package/dist/editor/editor-component/image.js +215 -0
- package/dist/editor/editor-component/link.js +11 -0
- package/dist/editor/editor-component/table.js +172 -0
- package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
- package/dist/editor/editor-plugin.js +249 -0
- package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
- package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
- package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
- package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
- package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
- package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
- package/dist/editor/editor-utils/common-editor-utils.js +587 -0
- package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
- package/dist/editor/editor-utils/mark-utils.js +25 -0
- package/dist/editor/editor-utils/range-utils.js +9 -0
- package/dist/editor/editor-utils/selection-utils.js +33 -0
- package/dist/editor/editor-utils/text-utils.js +130 -0
- package/dist/editor/editor.js +66 -0
- package/dist/editor/element-model/blockquote.js +16 -0
- package/dist/editor/element-model/image.js +19 -0
- package/dist/editor/element-model/link.js +19 -0
- package/dist/editor/element-model/table.js +50 -0
- package/dist/editor/element-model/text.js +13 -0
- package/dist/editor/load-script.js +83 -0
- package/dist/editor/plain-markdown-editor.js +324 -0
- package/dist/editor/rich-markdown-editor.js +580 -0
- package/dist/editor/seafile-editor.js +326 -0
- package/dist/editor/simple-editor.js +245 -0
- package/dist/editor-api.js +261 -0
- package/dist/index.css +97 -0
- 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/seafile-editor-chooser.js +45 -0
- package/dist/seafile-markdown-editor.js +301 -0
- package/dist/seafile-markdown-viewer.js +79 -0
- package/dist/seafile-simple-editor.js +56 -0
- package/dist/utils/copy-to-clipboard.js +47 -0
- package/dist/utils/deserialize-html.js +282 -0
- package/dist/utils/diff/compare-strings.js +46 -0
- package/dist/utils/diff/diff.js +855 -0
- package/dist/utils/diff/index.js +2 -0
- package/dist/utils/render-slate.js +219 -0
- package/dist/utils/seafile-markdown2html.js +62 -0
- package/dist/utils/slate2markdown/deserialize.js +689 -0
- package/dist/utils/slate2markdown/index.js +3 -0
- package/dist/utils/slate2markdown/serialize.js +407 -0
- package/dist/utils/utils.js +28 -0
- package/dist/viewer/diff-viewer.js +98 -0
- package/dist/viewer/markdown-viewer.js +139 -0
- package/dist/viewer/slate-viewer.js +73 -0
- package/dist/viewer/viewer-formula.js +67 -0
- package/dist/viewer/viewer-image.js +93 -0
- package/dist/viewer/viewer-outline.js +118 -0
- package/package.json +215 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +45 -0
- package/public/locales/cs/seafile-editor.json +169 -0
- package/public/locales/de/seafile-editor.json +169 -0
- package/public/locales/en/seafile-editor.json +222 -0
- package/public/locales/es/seafile-editor.json +169 -0
- package/public/locales/es-AR/seafile-editor.json +169 -0
- package/public/locales/es-MX/seafile-editor.json +169 -0
- package/public/locales/fr/seafile-editor.json +169 -0
- package/public/locales/it/seafile-editor.json +169 -0
- package/public/locales/ru/seafile-editor.json +169 -0
- package/public/locales/zh-CN/seafile-editor.json +219 -0
- package/public/manifest.json +15 -0
- package/public/media/scripts/mathjax/tex-svg.js +1 -0
- package/public/media/seafile-editor-font/iconfont.eot +0 -0
- package/public/media/seafile-editor-font/iconfont.svg +164 -0
- package/public/media/seafile-editor-font/iconfont.ttf +0 -0
- package/public/media/seafile-editor-font/iconfont.woff +0 -0
- package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
- package/public/media/seafile-editor-font.css +201 -0
- package/public/media/seafile-logo.png +0 -0
- package/public/media/seafile-ui.css +11169 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import { withTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
var HeaderList = /*#__PURE__*/function (_React$PureComponent) {
|
|
10
|
+
_inherits(HeaderList, _React$PureComponent);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(HeaderList);
|
|
13
|
+
|
|
14
|
+
function HeaderList(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, HeaderList);
|
|
18
|
+
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
|
|
21
|
+
_this.handleClick = function (event) {
|
|
22
|
+
if (_this.props.disabled) return;
|
|
23
|
+
|
|
24
|
+
var container = _this.getContainer();
|
|
25
|
+
|
|
26
|
+
if (container.contains(event.target)) {
|
|
27
|
+
_this.toggle();
|
|
28
|
+
} else {
|
|
29
|
+
if (_this.state.dropdownOpen) {
|
|
30
|
+
_this.setState({
|
|
31
|
+
dropdownOpen: !_this.state.dropdownOpen
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
_this.toggle = function () {
|
|
38
|
+
_this.setState({
|
|
39
|
+
dropdownOpen: !_this.state.dropdownOpen
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
_this.state = {
|
|
44
|
+
dropdownOpen: false
|
|
45
|
+
};
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_createClass(HeaderList, [{
|
|
50
|
+
key: "getContainer",
|
|
51
|
+
value: function getContainer() {
|
|
52
|
+
return ReactDOM.findDOMNode(this);
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "componentDidMount",
|
|
56
|
+
value: function componentDidMount() {
|
|
57
|
+
document.addEventListener('click', this.handleClick);
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "componentWillUnmount",
|
|
61
|
+
value: function componentWillUnmount() {
|
|
62
|
+
document.removeEventListener('click', this.handleClick);
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "render",
|
|
66
|
+
value: function render() {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* here need to use click event in DropdownItem instead of onMouseDown, reactStrap listen click, keyUp, to trigger toggle function,
|
|
71
|
+
* if we listen mouseDown event the tool bar will render,the position of the component will change
|
|
72
|
+
* and then the click event of this component will not be triggered
|
|
73
|
+
* */
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: 'header-list'
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: 'list-body ' + (this.props.disabled ? '' : 'header-list-body-hover') + (this.state.dropdownOpen ? ' header-list-body-highlight' : '')
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: 'list-title'
|
|
80
|
+
}, this.props.t(this.props.headerType)), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: 'list-caret'
|
|
82
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
83
|
+
className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
|
|
84
|
+
}))), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: 'list-dropdown'
|
|
86
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: 'list-dropdown-item',
|
|
88
|
+
onClick: function onClick(event) {
|
|
89
|
+
_this2.props.onClickHeader(event, 'paragraph');
|
|
90
|
+
}
|
|
91
|
+
}, this.props.t('paragraph')), /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: 'list-dropdown-item',
|
|
93
|
+
onClick: function onClick(event) {
|
|
94
|
+
_this2.props.onClickHeader(event, 'header_one');
|
|
95
|
+
}
|
|
96
|
+
}, this.props.t('header_one')), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: 'list-dropdown-item',
|
|
98
|
+
onClick: function onClick(event) {
|
|
99
|
+
_this2.props.onClickHeader(event, 'header_two');
|
|
100
|
+
}
|
|
101
|
+
}, this.props.t('header_two')), /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: 'list-dropdown-item',
|
|
103
|
+
onClick: function onClick(event) {
|
|
104
|
+
_this2.props.onClickHeader(event, 'header_three');
|
|
105
|
+
}
|
|
106
|
+
}, this.props.t('header_three')), /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
className: 'list-dropdown-item',
|
|
108
|
+
onClick: function onClick(event) {
|
|
109
|
+
_this2.props.onClickHeader(event, 'header_four');
|
|
110
|
+
}
|
|
111
|
+
}, this.props.t('header_four')), /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: 'list-dropdown-item',
|
|
113
|
+
onClick: function onClick(event) {
|
|
114
|
+
_this2.props.onClickHeader(event, 'header_five');
|
|
115
|
+
}
|
|
116
|
+
}, this.props.t('header_five')), /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
className: 'list-dropdown-item',
|
|
118
|
+
onClick: function onClick(event) {
|
|
119
|
+
_this2.props.onClickHeader(event, 'header_six');
|
|
120
|
+
}
|
|
121
|
+
}, this.props.t('header_six'))));
|
|
122
|
+
}
|
|
123
|
+
}]);
|
|
124
|
+
|
|
125
|
+
return HeaderList;
|
|
126
|
+
}(React.PureComponent);
|
|
127
|
+
|
|
128
|
+
export default withTranslation('seafile-editor')(HeaderList);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Tooltip } from 'reactstrap';
|
|
8
|
+
import { withTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
var IconButton = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(IconButton, _React$Component);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(IconButton);
|
|
14
|
+
|
|
15
|
+
function IconButton(props) {
|
|
16
|
+
var _this;
|
|
17
|
+
|
|
18
|
+
_classCallCheck(this, IconButton);
|
|
19
|
+
|
|
20
|
+
_this = _super.call(this, props);
|
|
21
|
+
|
|
22
|
+
_this.toggle = function () {
|
|
23
|
+
if (_this.props.disabled || _this.state.isFreezed && !_this.state.tooltipOpen) return;
|
|
24
|
+
|
|
25
|
+
_this.setState({
|
|
26
|
+
tooltipOpen: !_this.state.tooltipOpen,
|
|
27
|
+
isFreezed: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
var that = _assertThisInitialized(_this);
|
|
31
|
+
|
|
32
|
+
setTimeout(function () {
|
|
33
|
+
that.setState({
|
|
34
|
+
isFreezed: false
|
|
35
|
+
});
|
|
36
|
+
}, 100);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
_this.getClassName = function () {
|
|
40
|
+
var className = _this.props.isRichEditor ? 'rich-icon-btn ' + (_this.props.disabled ? 'rich-icon-btn-disabled' : 'rich-icon-btn-hover') : 'btn btn-icon btn-secondary btn-active';
|
|
41
|
+
className = className + ' ' + (_this.props.className || '');
|
|
42
|
+
return className;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
_this.state = {
|
|
46
|
+
tooltipOpen: false,
|
|
47
|
+
isFreezed: false
|
|
48
|
+
};
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_createClass(IconButton, [{
|
|
53
|
+
key: "shouldComponentUpdate",
|
|
54
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
55
|
+
if (this.props.disabled !== nextProps.disabled) {
|
|
56
|
+
this.setState({
|
|
57
|
+
tooltipOpen: false
|
|
58
|
+
});
|
|
59
|
+
return true;
|
|
60
|
+
} // only render iconButton when the button is active or show show tooltip
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if (nextState.tooltipOpen === this.state.tooltipOpen && nextProps.isActive === this.props.isActive) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "render",
|
|
71
|
+
value: function render() {
|
|
72
|
+
var className = this.getClassName();
|
|
73
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
id: this.props.id,
|
|
75
|
+
type: 'button',
|
|
76
|
+
onClick: this.props.disabled ? null : this.props.onClick,
|
|
77
|
+
onMouseDown: this.props.disabled ? null : this.props.onMouseDown,
|
|
78
|
+
className: className,
|
|
79
|
+
"data-active": this.props.isActive || false,
|
|
80
|
+
disabled: this.props.disabled
|
|
81
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
82
|
+
className: this.props.icon
|
|
83
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
84
|
+
toggle: this.toggle,
|
|
85
|
+
delay: {
|
|
86
|
+
show: 0,
|
|
87
|
+
hide: 0
|
|
88
|
+
},
|
|
89
|
+
target: this.props.id,
|
|
90
|
+
placement: "bottom",
|
|
91
|
+
isOpen: this.state.tooltipOpen
|
|
92
|
+
}, this.props.text));
|
|
93
|
+
}
|
|
94
|
+
}]);
|
|
95
|
+
|
|
96
|
+
return IconButton;
|
|
97
|
+
}(React.Component);
|
|
98
|
+
|
|
99
|
+
export default withTranslation('seafile-editor')(IconButton);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Tooltip } from 'reactstrap';
|
|
7
|
+
import { withTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
var InsertFile = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(InsertFile, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(InsertFile);
|
|
13
|
+
|
|
14
|
+
function InsertFile(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, InsertFile);
|
|
18
|
+
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
|
|
21
|
+
_this.toggle = function () {
|
|
22
|
+
if (_this.props.disabled) {
|
|
23
|
+
_this.setState({
|
|
24
|
+
tooltipOpen: false
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return;
|
|
28
|
+
} else {
|
|
29
|
+
_this.setState({
|
|
30
|
+
tooltipOpen: !_this.state.tooltipOpen
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_this.state = {
|
|
36
|
+
tooltipOpen: false
|
|
37
|
+
};
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_createClass(InsertFile, [{
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
var className = this.props.disabled ? 'insert-file insert-file-disabled rich-icon-btn rich-icon-btn-disabled' : 'insert-file rich-icon-btn';
|
|
45
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
46
|
+
className: className,
|
|
47
|
+
id: "insertFileButton",
|
|
48
|
+
onMouseDown: this.props.insertRepoFile
|
|
49
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
50
|
+
className: "iconfont icon-file"
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
52
|
+
toggle: this.toggle,
|
|
53
|
+
delay: {
|
|
54
|
+
show: 0,
|
|
55
|
+
hide: 0
|
|
56
|
+
},
|
|
57
|
+
target: "insertFileButton",
|
|
58
|
+
placement: "bottom",
|
|
59
|
+
isOpen: this.state.tooltipOpen
|
|
60
|
+
}, this.props.t('insert_file')));
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
|
|
64
|
+
return InsertFile;
|
|
65
|
+
}(React.Component);
|
|
66
|
+
|
|
67
|
+
export default withTranslation('seafile-editor')(InsertFile);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import IconButton from './icon-button';
|
|
8
|
+
import ButtonGroup from './button-group';
|
|
9
|
+
import { withTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
var TableToolBar = /*#__PURE__*/function (_React$PureComponent) {
|
|
12
|
+
_inherits(TableToolBar, _React$PureComponent);
|
|
13
|
+
|
|
14
|
+
var _super = _createSuper(TableToolBar);
|
|
15
|
+
|
|
16
|
+
function TableToolBar() {
|
|
17
|
+
_classCallCheck(this, TableToolBar);
|
|
18
|
+
|
|
19
|
+
return _super.apply(this, arguments);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_createClass(TableToolBar, [{
|
|
23
|
+
key: "render",
|
|
24
|
+
value: function render() {
|
|
25
|
+
var _this = this;
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
28
|
+
className: 'editor-btn-group'
|
|
29
|
+
}, /*#__PURE__*/React.createElement(DropList, {
|
|
30
|
+
icon: 'iconfont icon-left-alignment',
|
|
31
|
+
items: [{
|
|
32
|
+
handle: function handle(e) {
|
|
33
|
+
_this.props.onSetAlign(e, 'left');
|
|
34
|
+
},
|
|
35
|
+
icon: 'iconfont icon-left-alignment',
|
|
36
|
+
text: this.props.t('left')
|
|
37
|
+
}, {
|
|
38
|
+
handle: function handle(e) {
|
|
39
|
+
_this.props.onSetAlign(e, 'center');
|
|
40
|
+
},
|
|
41
|
+
icon: 'iconfont icon-center-horizontally',
|
|
42
|
+
text: this.props.t('center')
|
|
43
|
+
}, {
|
|
44
|
+
handle: function handle(e) {
|
|
45
|
+
_this.props.onSetAlign(e, 'right');
|
|
46
|
+
},
|
|
47
|
+
icon: 'icon icon-align-right',
|
|
48
|
+
text: this.props.t('right')
|
|
49
|
+
}]
|
|
50
|
+
}), /*#__PURE__*/React.createElement(DropList, {
|
|
51
|
+
icon: 'iconfont icon-column',
|
|
52
|
+
items: [{
|
|
53
|
+
handle: this.props.onInsertColumn,
|
|
54
|
+
text: this.props.t('Insert_Column')
|
|
55
|
+
}, {
|
|
56
|
+
handle: this.props.onRemoveColumn,
|
|
57
|
+
text: this.props.t('Remove_Column')
|
|
58
|
+
}]
|
|
59
|
+
}), /*#__PURE__*/React.createElement(DropList, {
|
|
60
|
+
icon: 'iconfont icon-row',
|
|
61
|
+
items: [{
|
|
62
|
+
handle: this.props.onInsertRow,
|
|
63
|
+
text: this.props.t('Insert_Row')
|
|
64
|
+
}, {
|
|
65
|
+
handle: this.props.onRemoveRow,
|
|
66
|
+
text: this.props.t('Remove_Row')
|
|
67
|
+
}]
|
|
68
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
69
|
+
disabled: false,
|
|
70
|
+
isRichEditor: true,
|
|
71
|
+
text: this.props.t('remove_table'),
|
|
72
|
+
id: 'removeTable',
|
|
73
|
+
icon: 'iconfont icon-delete-table',
|
|
74
|
+
onMouseDown: this.props.onRemoveTable
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
|
|
79
|
+
return TableToolBar;
|
|
80
|
+
}(React.PureComponent);
|
|
81
|
+
|
|
82
|
+
var DropList = /*#__PURE__*/function (_React$PureComponent2) {
|
|
83
|
+
_inherits(DropList, _React$PureComponent2);
|
|
84
|
+
|
|
85
|
+
var _super2 = _createSuper(DropList);
|
|
86
|
+
|
|
87
|
+
function DropList(props) {
|
|
88
|
+
var _this2;
|
|
89
|
+
|
|
90
|
+
_classCallCheck(this, DropList);
|
|
91
|
+
|
|
92
|
+
_this2 = _super2.call(this, props);
|
|
93
|
+
|
|
94
|
+
_this2.handleClick = function (event) {
|
|
95
|
+
if (_this2.props.disabled) return;
|
|
96
|
+
|
|
97
|
+
var container = _this2.getContainer();
|
|
98
|
+
|
|
99
|
+
if (container.contains(event.target)) {
|
|
100
|
+
_this2.toggle();
|
|
101
|
+
} else {
|
|
102
|
+
if (_this2.state.dropdownOpen) {
|
|
103
|
+
_this2.setState({
|
|
104
|
+
dropdownOpen: !_this2.state.dropdownOpen
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
_this2.toggle = function () {
|
|
111
|
+
_this2.setState({
|
|
112
|
+
dropdownOpen: !_this2.state.dropdownOpen
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
_this2.state = {
|
|
117
|
+
dropdownOpen: false
|
|
118
|
+
};
|
|
119
|
+
return _this2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
_createClass(DropList, [{
|
|
123
|
+
key: "getContainer",
|
|
124
|
+
value: function getContainer() {
|
|
125
|
+
return ReactDOM.findDOMNode(this);
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "componentDidMount",
|
|
129
|
+
value: function componentDidMount() {
|
|
130
|
+
document.addEventListener('click', this.handleClick);
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "componentWillUnmount",
|
|
134
|
+
value: function componentWillUnmount() {
|
|
135
|
+
document.removeEventListener('click', this.handleClick);
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "render",
|
|
139
|
+
value: function render() {
|
|
140
|
+
var items = [];
|
|
141
|
+
this.props.items.forEach(function (item, index) {
|
|
142
|
+
items.push( /*#__PURE__*/React.createElement("button", {
|
|
143
|
+
key: 'dropdown-item' + index,
|
|
144
|
+
onMouseDown: item.handle,
|
|
145
|
+
className: 'dropdown-item'
|
|
146
|
+
}, item.icon ? /*#__PURE__*/React.createElement("i", {
|
|
147
|
+
className: item.icon,
|
|
148
|
+
style: {
|
|
149
|
+
marginRight: '6px'
|
|
150
|
+
}
|
|
151
|
+
}) : null, item.text));
|
|
152
|
+
});
|
|
153
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: 'custom-dropdown-list'
|
|
155
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
id: 'list_toggle',
|
|
157
|
+
className: 'dropdown-list-toggle'
|
|
158
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
159
|
+
className: this.props.icon,
|
|
160
|
+
style: {
|
|
161
|
+
marginRight: '3px'
|
|
162
|
+
}
|
|
163
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
164
|
+
className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
|
|
165
|
+
})), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
role: 'menu',
|
|
167
|
+
className: 'custom-dropdown-menu dropdown-menu'
|
|
168
|
+
}, items));
|
|
169
|
+
}
|
|
170
|
+
}]);
|
|
171
|
+
|
|
172
|
+
return DropList;
|
|
173
|
+
}(React.PureComponent);
|
|
174
|
+
|
|
175
|
+
export default withTranslation('seafile-editor')(TableToolBar);
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip, Label, Input } from 'reactstrap';
|
|
7
|
+
import { withTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
var UploadImg = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(UploadImg, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(UploadImg);
|
|
13
|
+
|
|
14
|
+
function UploadImg() {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, UploadImg);
|
|
18
|
+
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
_this.state = {
|
|
25
|
+
dropdownOpen: false,
|
|
26
|
+
tooltipOpen: false
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
_this.imgtoggle = function () {
|
|
30
|
+
_this.setState({
|
|
31
|
+
dropdownOpen: !_this.state.dropdownOpen
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_this.toggle = function () {
|
|
36
|
+
if (_this.props.disabled) {
|
|
37
|
+
_this.setState({
|
|
38
|
+
tooltipOpen: false
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_this.setState({
|
|
45
|
+
tooltipOpen: !_this.state.tooltipOpen
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
_this.uploadLocalImage = function (event) {
|
|
50
|
+
if (window.editor.editorApi.uploadLocalImage) {
|
|
51
|
+
window.editor.editorApi.uploadLocalImage(event.target.files[0]).then(function (res) {
|
|
52
|
+
_this.props.onInsertImage({
|
|
53
|
+
url: res
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
_this.handleFileChange = function (event) {
|
|
60
|
+
_this.uploadLocalImage(event);
|
|
61
|
+
|
|
62
|
+
_this.setState({
|
|
63
|
+
dropdownOpen: false
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
_this.onInputFile = function (event) {
|
|
68
|
+
event.target.value = null;
|
|
69
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_createClass(UploadImg, [{
|
|
77
|
+
key: "render",
|
|
78
|
+
value: function render() {
|
|
79
|
+
var t = this.props.t;
|
|
80
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
81
|
+
isOpen: this.state.dropdownOpen,
|
|
82
|
+
toggle: this.imgtoggle,
|
|
83
|
+
className: this.props.disabled ? 'upload-localimg upload-localimg-disabled' : 'upload-localimg upload-localimg-hover'
|
|
84
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
85
|
+
id: this.props.id,
|
|
86
|
+
disabled: this.props.disabled
|
|
87
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
88
|
+
className: "iconfont icon-image"
|
|
89
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
90
|
+
toggle: this.toggle,
|
|
91
|
+
delay: {
|
|
92
|
+
show: 0,
|
|
93
|
+
hide: 0
|
|
94
|
+
},
|
|
95
|
+
target: this.props.id,
|
|
96
|
+
placement: "bottom",
|
|
97
|
+
isOpen: this.state.tooltipOpen
|
|
98
|
+
}, t('insert_image'))), /*#__PURE__*/React.createElement(DropdownMenu, null, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
99
|
+
onClick: this.props.onToggleImageDialog
|
|
100
|
+
}, t('insert_network_image')), !this.props.isSimpleEditor && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
101
|
+
onMouseDown: this.props.insertRepoFile
|
|
102
|
+
}, t('Insert_library_image')), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
103
|
+
className: "image-uploader-btn"
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
105
|
+
className: "image-uploader-label",
|
|
106
|
+
for: "image-uploader",
|
|
107
|
+
onClick: this.onInputFile
|
|
108
|
+
}, t('upload_local_image')), /*#__PURE__*/React.createElement(Input, {
|
|
109
|
+
type: "file",
|
|
110
|
+
accept: "image/*",
|
|
111
|
+
onChange: this.handleFileChange,
|
|
112
|
+
onClick: this.onInputFile,
|
|
113
|
+
className: "image-uploader",
|
|
114
|
+
id: "image-uploader"
|
|
115
|
+
})))));
|
|
116
|
+
}
|
|
117
|
+
}]);
|
|
118
|
+
|
|
119
|
+
return UploadImg;
|
|
120
|
+
}(React.Component);
|
|
121
|
+
|
|
122
|
+
export default withTranslation('seafile-editor')(UploadImg);
|