@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,545 @@
|
|
|
1
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
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 ReactDOM from 'react-dom';
|
|
8
|
+
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip } from 'reactstrap';
|
|
9
|
+
import { withTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
var MoreMenu = /*#__PURE__*/function (_React$PureComponent) {
|
|
12
|
+
_inherits(MoreMenu, _React$PureComponent);
|
|
13
|
+
|
|
14
|
+
var _super = _createSuper(MoreMenu);
|
|
15
|
+
|
|
16
|
+
function MoreMenu(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, MoreMenu);
|
|
20
|
+
|
|
21
|
+
_this = _super.call(this, props);
|
|
22
|
+
|
|
23
|
+
_this.tooltipToggle = function () {
|
|
24
|
+
_this.setState({
|
|
25
|
+
tooltipOpen: !_this.state.tooltipOpen
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
_this.dropdownToggle = function () {
|
|
30
|
+
_this.setState({
|
|
31
|
+
dropdownOpen: !_this.state.dropdownOpen
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_this.state = {
|
|
36
|
+
tooltipOpen: false,
|
|
37
|
+
dropdownOpen: false
|
|
38
|
+
};
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_createClass(MoreMenu, [{
|
|
43
|
+
key: "render",
|
|
44
|
+
value: function render() {
|
|
45
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
46
|
+
isOpen: this.state.dropdownOpen,
|
|
47
|
+
toggle: this.dropdownToggle
|
|
48
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
49
|
+
id: this.props.id
|
|
50
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
51
|
+
className: "iconfont icon-ellipsis-v"
|
|
52
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
53
|
+
toggle: this.tooltipToggle,
|
|
54
|
+
delay: {
|
|
55
|
+
show: 0,
|
|
56
|
+
hide: 0
|
|
57
|
+
},
|
|
58
|
+
target: this.props.id,
|
|
59
|
+
placement: "bottom",
|
|
60
|
+
isOpen: this.state.tooltipOpen
|
|
61
|
+
}, this.props.text)), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
62
|
+
className: 'drop-list'
|
|
63
|
+
}, this.props.switchEditorMode && !this.props.readOnly ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
64
|
+
onMouseDown: this.props.switchEditorMode
|
|
65
|
+
}, this.props.t(this.props.editText)) : null, this.props.mode === 'rich-editor' && !this.props.readOnly && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
66
|
+
onMouseDown: this.props.switchToMarkDownViewer
|
|
67
|
+
}, this.props.t('switch_to_viewer')), this.props.showHelpDialog ? /*#__PURE__*/React.createElement(DropdownItem, {
|
|
68
|
+
onMouseDown: this.props.showHelpDialog
|
|
69
|
+
}, this.props.t('help')) : ''));
|
|
70
|
+
}
|
|
71
|
+
}]);
|
|
72
|
+
|
|
73
|
+
return MoreMenu;
|
|
74
|
+
}(React.PureComponent);
|
|
75
|
+
|
|
76
|
+
var ButtonGroup = /*#__PURE__*/function (_React$PureComponent2) {
|
|
77
|
+
_inherits(ButtonGroup, _React$PureComponent2);
|
|
78
|
+
|
|
79
|
+
var _super2 = _createSuper(ButtonGroup);
|
|
80
|
+
|
|
81
|
+
function ButtonGroup() {
|
|
82
|
+
_classCallCheck(this, ButtonGroup);
|
|
83
|
+
|
|
84
|
+
return _super2.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_createClass(ButtonGroup, [{
|
|
88
|
+
key: "render",
|
|
89
|
+
value: function render() {
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: 'btn-group ' + this.props.className,
|
|
92
|
+
role: 'group'
|
|
93
|
+
}, this.props.children);
|
|
94
|
+
}
|
|
95
|
+
}]);
|
|
96
|
+
|
|
97
|
+
return ButtonGroup;
|
|
98
|
+
}(React.PureComponent);
|
|
99
|
+
|
|
100
|
+
var Button = /*#__PURE__*/function (_React$PureComponent3) {
|
|
101
|
+
_inherits(Button, _React$PureComponent3);
|
|
102
|
+
|
|
103
|
+
var _super3 = _createSuper(Button);
|
|
104
|
+
|
|
105
|
+
function Button() {
|
|
106
|
+
_classCallCheck(this, Button);
|
|
107
|
+
|
|
108
|
+
return _super3.apply(this, arguments);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_createClass(Button, [{
|
|
112
|
+
key: "render",
|
|
113
|
+
value: function render() {
|
|
114
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
115
|
+
type: 'button',
|
|
116
|
+
onMouseDown: this.props.onMouseDown,
|
|
117
|
+
className: 'btn btn-secondary btn-active ' + this.props.className
|
|
118
|
+
}, this.props.children);
|
|
119
|
+
}
|
|
120
|
+
}]);
|
|
121
|
+
|
|
122
|
+
return Button;
|
|
123
|
+
}(React.PureComponent);
|
|
124
|
+
|
|
125
|
+
var IconButton = /*#__PURE__*/function (_React$Component) {
|
|
126
|
+
_inherits(IconButton, _React$Component);
|
|
127
|
+
|
|
128
|
+
var _super4 = _createSuper(IconButton);
|
|
129
|
+
|
|
130
|
+
function IconButton(props) {
|
|
131
|
+
var _this2;
|
|
132
|
+
|
|
133
|
+
_classCallCheck(this, IconButton);
|
|
134
|
+
|
|
135
|
+
_this2 = _super4.call(this, props);
|
|
136
|
+
|
|
137
|
+
_this2.toggle = function () {
|
|
138
|
+
if (_this2.props.disabled || _this2.state.isFreezed && !_this2.state.tooltipOpen) return;
|
|
139
|
+
|
|
140
|
+
_this2.setState({
|
|
141
|
+
tooltipOpen: !_this2.state.tooltipOpen,
|
|
142
|
+
isFreezed: true
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
var that = _assertThisInitialized(_this2);
|
|
146
|
+
|
|
147
|
+
setTimeout(function () {
|
|
148
|
+
that.setState({
|
|
149
|
+
isFreezed: false
|
|
150
|
+
});
|
|
151
|
+
}, 100);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
_this2.state = {
|
|
155
|
+
tooltipOpen: false,
|
|
156
|
+
isFreezed: false
|
|
157
|
+
};
|
|
158
|
+
return _this2;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
_createClass(IconButton, [{
|
|
162
|
+
key: "shouldComponentUpdate",
|
|
163
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
164
|
+
if (this.props.disabled !== nextProps.disabled) {
|
|
165
|
+
this.setState({
|
|
166
|
+
tooltipOpen: false
|
|
167
|
+
});
|
|
168
|
+
return true;
|
|
169
|
+
} // only render iconButton when the button is active or show show tooltip
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if (nextState.tooltipOpen === this.state.tooltipOpen && nextProps.isActive === this.props.isActive) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "render",
|
|
180
|
+
value: function render() {
|
|
181
|
+
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';
|
|
182
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
183
|
+
id: this.props.id,
|
|
184
|
+
type: 'button',
|
|
185
|
+
onClick: this.props.disabled ? null : this.props.onClick,
|
|
186
|
+
onMouseDown: this.props.disabled ? null : this.props.onMouseDown,
|
|
187
|
+
className: className,
|
|
188
|
+
"data-active": this.props.isActive || false,
|
|
189
|
+
"aria-label": this.props.text,
|
|
190
|
+
disabled: this.props.disabled
|
|
191
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
192
|
+
className: this.props.icon
|
|
193
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
194
|
+
toggle: this.toggle,
|
|
195
|
+
delay: {
|
|
196
|
+
show: 0,
|
|
197
|
+
hide: 0
|
|
198
|
+
},
|
|
199
|
+
target: this.props.id,
|
|
200
|
+
placement: "bottom",
|
|
201
|
+
isOpen: this.state.tooltipOpen
|
|
202
|
+
}, this.props.text));
|
|
203
|
+
}
|
|
204
|
+
}]);
|
|
205
|
+
|
|
206
|
+
return IconButton;
|
|
207
|
+
}(React.Component);
|
|
208
|
+
|
|
209
|
+
var CollabUsersButton = /*#__PURE__*/function (_React$PureComponent4) {
|
|
210
|
+
_inherits(CollabUsersButton, _React$PureComponent4);
|
|
211
|
+
|
|
212
|
+
var _super5 = _createSuper(CollabUsersButton);
|
|
213
|
+
|
|
214
|
+
function CollabUsersButton(props) {
|
|
215
|
+
var _this3;
|
|
216
|
+
|
|
217
|
+
_classCallCheck(this, CollabUsersButton);
|
|
218
|
+
|
|
219
|
+
_this3 = _super5.call(this, props);
|
|
220
|
+
|
|
221
|
+
_this3.dropdownToggle = function () {
|
|
222
|
+
_this3.setState({
|
|
223
|
+
dropdownOpen: !_this3.state.dropdownOpen
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
_this3.state = {
|
|
228
|
+
dropdownOpen: false
|
|
229
|
+
};
|
|
230
|
+
return _this3;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_createClass(CollabUsersButton, [{
|
|
234
|
+
key: "render",
|
|
235
|
+
value: function render() {
|
|
236
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
237
|
+
className: this.props.className,
|
|
238
|
+
isOpen: this.state.dropdownOpen,
|
|
239
|
+
toggle: this.dropdownToggle
|
|
240
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
241
|
+
id: this.props.id
|
|
242
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
243
|
+
className: "iconfont icon-users"
|
|
244
|
+
}), " ", this.props.users.length), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
245
|
+
className: 'drop-list'
|
|
246
|
+
}, this.props.users.map(function (ele, idx) {
|
|
247
|
+
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
248
|
+
key: idx
|
|
249
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
250
|
+
className: ele.is_editing ? 'iconfont icon-edit' : 'iconfont icon-user'
|
|
251
|
+
}), " ", ele.user.name, " ", ele.myself ? '(you)' : '');
|
|
252
|
+
})));
|
|
253
|
+
}
|
|
254
|
+
}]);
|
|
255
|
+
|
|
256
|
+
return CollabUsersButton;
|
|
257
|
+
}(React.PureComponent);
|
|
258
|
+
|
|
259
|
+
var TableToolBar = /*#__PURE__*/function (_React$PureComponent5) {
|
|
260
|
+
_inherits(TableToolBar, _React$PureComponent5);
|
|
261
|
+
|
|
262
|
+
var _super6 = _createSuper(TableToolBar);
|
|
263
|
+
|
|
264
|
+
function TableToolBar() {
|
|
265
|
+
_classCallCheck(this, TableToolBar);
|
|
266
|
+
|
|
267
|
+
return _super6.apply(this, arguments);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
_createClass(TableToolBar, [{
|
|
271
|
+
key: "render",
|
|
272
|
+
value: function render() {
|
|
273
|
+
var _this4 = this;
|
|
274
|
+
|
|
275
|
+
return /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
276
|
+
className: 'editor-btn-group'
|
|
277
|
+
}, /*#__PURE__*/React.createElement(DropList, {
|
|
278
|
+
icon: 'ico ico-left-align',
|
|
279
|
+
items: [{
|
|
280
|
+
handle: function handle(e) {
|
|
281
|
+
_this4.props.onSetAlign(e, 'left');
|
|
282
|
+
},
|
|
283
|
+
icon: 'ico ico-left-align',
|
|
284
|
+
text: this.props.t('left')
|
|
285
|
+
}, {
|
|
286
|
+
handle: function handle(e) {
|
|
287
|
+
_this4.props.onSetAlign(e, 'center');
|
|
288
|
+
},
|
|
289
|
+
icon: 'ico ico-center-horizontally',
|
|
290
|
+
text: this.props.t('center')
|
|
291
|
+
}, {
|
|
292
|
+
handle: function handle(e) {
|
|
293
|
+
_this4.props.onSetAlign(e, 'right');
|
|
294
|
+
},
|
|
295
|
+
icon: 'ico ico-right-align',
|
|
296
|
+
text: this.props.t('right')
|
|
297
|
+
}]
|
|
298
|
+
}), /*#__PURE__*/React.createElement(DropList, {
|
|
299
|
+
icon: 'ico ico-column',
|
|
300
|
+
items: [{
|
|
301
|
+
handle: this.props.onInsertColumn,
|
|
302
|
+
text: this.props.t('Insert_Column')
|
|
303
|
+
}, {
|
|
304
|
+
handle: this.props.onRemoveColumn,
|
|
305
|
+
text: this.props.t('Remove_Column')
|
|
306
|
+
}]
|
|
307
|
+
}), /*#__PURE__*/React.createElement(DropList, {
|
|
308
|
+
icon: 'ico ico-row',
|
|
309
|
+
items: [{
|
|
310
|
+
handle: this.props.onInsertRow,
|
|
311
|
+
text: this.props.t('Insert_Row')
|
|
312
|
+
}, {
|
|
313
|
+
handle: this.props.onRemoveRow,
|
|
314
|
+
text: this.props.t('Remove_Row')
|
|
315
|
+
}]
|
|
316
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
317
|
+
disabled: false,
|
|
318
|
+
isRichEditor: true,
|
|
319
|
+
text: this.props.t('remove_table'),
|
|
320
|
+
id: 'removeTable',
|
|
321
|
+
icon: 'ico ico-delete-table',
|
|
322
|
+
onMouseDown: this.props.onRemoveTable
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
}]);
|
|
326
|
+
|
|
327
|
+
return TableToolBar;
|
|
328
|
+
}(React.PureComponent);
|
|
329
|
+
|
|
330
|
+
var DropList = /*#__PURE__*/function (_React$PureComponent6) {
|
|
331
|
+
_inherits(DropList, _React$PureComponent6);
|
|
332
|
+
|
|
333
|
+
var _super7 = _createSuper(DropList);
|
|
334
|
+
|
|
335
|
+
function DropList(props) {
|
|
336
|
+
var _this5;
|
|
337
|
+
|
|
338
|
+
_classCallCheck(this, DropList);
|
|
339
|
+
|
|
340
|
+
_this5 = _super7.call(this, props);
|
|
341
|
+
|
|
342
|
+
_this5.handleClick = function (event) {
|
|
343
|
+
if (_this5.props.disabled) return;
|
|
344
|
+
|
|
345
|
+
var container = _this5.getContainer();
|
|
346
|
+
|
|
347
|
+
if (container.contains(event.target)) {
|
|
348
|
+
_this5.toggle();
|
|
349
|
+
} else {
|
|
350
|
+
if (_this5.state.dropdownOpen) {
|
|
351
|
+
_this5.setState({
|
|
352
|
+
dropdownOpen: !_this5.state.dropdownOpen
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
_this5.toggle = function () {
|
|
359
|
+
_this5.setState({
|
|
360
|
+
dropdownOpen: !_this5.state.dropdownOpen
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
_this5.state = {
|
|
365
|
+
dropdownOpen: false
|
|
366
|
+
};
|
|
367
|
+
return _this5;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
_createClass(DropList, [{
|
|
371
|
+
key: "getContainer",
|
|
372
|
+
value: function getContainer() {
|
|
373
|
+
return ReactDOM.findDOMNode(this);
|
|
374
|
+
}
|
|
375
|
+
}, {
|
|
376
|
+
key: "componentDidMount",
|
|
377
|
+
value: function componentDidMount() {
|
|
378
|
+
document.addEventListener('click', this.handleClick);
|
|
379
|
+
}
|
|
380
|
+
}, {
|
|
381
|
+
key: "componentWillUnmount",
|
|
382
|
+
value: function componentWillUnmount() {
|
|
383
|
+
document.removeEventListener('click', this.handleClick);
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
key: "render",
|
|
387
|
+
value: function render() {
|
|
388
|
+
var items = [];
|
|
389
|
+
this.props.items.forEach(function (item, index) {
|
|
390
|
+
items.push( /*#__PURE__*/React.createElement("button", {
|
|
391
|
+
key: 'dropdown-item' + index,
|
|
392
|
+
onMouseDown: item.handle,
|
|
393
|
+
className: 'dropdown-item'
|
|
394
|
+
}, item.icon ? /*#__PURE__*/React.createElement("i", {
|
|
395
|
+
className: item.icon,
|
|
396
|
+
style: {
|
|
397
|
+
marginRight: '6px'
|
|
398
|
+
}
|
|
399
|
+
}) : null, item.text));
|
|
400
|
+
});
|
|
401
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
402
|
+
className: 'custom-dropdown-list'
|
|
403
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
404
|
+
id: 'list_toggle',
|
|
405
|
+
className: 'dropdown-list-toggle'
|
|
406
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
407
|
+
className: this.props.icon,
|
|
408
|
+
style: {
|
|
409
|
+
marginRight: '3px'
|
|
410
|
+
}
|
|
411
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
412
|
+
className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
|
|
413
|
+
})), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
414
|
+
role: 'menu',
|
|
415
|
+
className: 'custom-dropdown-menu dropdown-menu'
|
|
416
|
+
}, items));
|
|
417
|
+
}
|
|
418
|
+
}]);
|
|
419
|
+
|
|
420
|
+
return DropList;
|
|
421
|
+
}(React.PureComponent);
|
|
422
|
+
|
|
423
|
+
var HeaderList = /*#__PURE__*/function (_React$PureComponent7) {
|
|
424
|
+
_inherits(HeaderList, _React$PureComponent7);
|
|
425
|
+
|
|
426
|
+
var _super8 = _createSuper(HeaderList);
|
|
427
|
+
|
|
428
|
+
function HeaderList(props) {
|
|
429
|
+
var _this6;
|
|
430
|
+
|
|
431
|
+
_classCallCheck(this, HeaderList);
|
|
432
|
+
|
|
433
|
+
_this6 = _super8.call(this, props);
|
|
434
|
+
|
|
435
|
+
_this6.handleClick = function (event) {
|
|
436
|
+
if (_this6.props.disabled) return;
|
|
437
|
+
|
|
438
|
+
var container = _this6.getContainer();
|
|
439
|
+
|
|
440
|
+
if (container.contains(event.target)) {
|
|
441
|
+
_this6.toggle();
|
|
442
|
+
} else {
|
|
443
|
+
if (_this6.state.dropdownOpen) {
|
|
444
|
+
_this6.setState({
|
|
445
|
+
dropdownOpen: !_this6.state.dropdownOpen
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
_this6.toggle = function () {
|
|
452
|
+
_this6.setState({
|
|
453
|
+
dropdownOpen: !_this6.state.dropdownOpen
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
_this6.state = {
|
|
458
|
+
dropdownOpen: false
|
|
459
|
+
};
|
|
460
|
+
return _this6;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
_createClass(HeaderList, [{
|
|
464
|
+
key: "getContainer",
|
|
465
|
+
value: function getContainer() {
|
|
466
|
+
return ReactDOM.findDOMNode(this);
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "componentDidMount",
|
|
470
|
+
value: function componentDidMount() {
|
|
471
|
+
document.addEventListener('click', this.handleClick);
|
|
472
|
+
}
|
|
473
|
+
}, {
|
|
474
|
+
key: "componentWillUnmount",
|
|
475
|
+
value: function componentWillUnmount() {
|
|
476
|
+
document.removeEventListener('click', this.handleClick);
|
|
477
|
+
}
|
|
478
|
+
}, {
|
|
479
|
+
key: "render",
|
|
480
|
+
value: function render() {
|
|
481
|
+
var _this7 = this;
|
|
482
|
+
|
|
483
|
+
/*
|
|
484
|
+
* here need to use click event in DropdownItem instead of onMouseDown, reactStrap listen click, keyUp, to trigger toggle function,
|
|
485
|
+
* if we listen mouseDown event the tool bar will render,the position of the component will change
|
|
486
|
+
* and then the click event of this component will not be triggered
|
|
487
|
+
* */
|
|
488
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
489
|
+
className: 'header-list'
|
|
490
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
491
|
+
className: 'list-body ' + (this.props.disabled ? '' : 'header-list-body-hover') + (this.state.dropdownOpen ? ' header-list-body-highlight' : '')
|
|
492
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
493
|
+
className: 'list-title'
|
|
494
|
+
}, this.props.t(this.props.headerType)), /*#__PURE__*/React.createElement("div", {
|
|
495
|
+
className: 'list-caret'
|
|
496
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
497
|
+
className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
|
|
498
|
+
}))), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
499
|
+
className: 'list-dropdown'
|
|
500
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
501
|
+
className: 'list-dropdown-item',
|
|
502
|
+
onClick: function onClick(event) {
|
|
503
|
+
_this7.props.onClickBlock(event, 'paragraph');
|
|
504
|
+
}
|
|
505
|
+
}, this.props.t('paragraph')), /*#__PURE__*/React.createElement("div", {
|
|
506
|
+
className: 'list-dropdown-item',
|
|
507
|
+
onClick: function onClick(event) {
|
|
508
|
+
_this7.props.onClickBlock(event, 'header_one');
|
|
509
|
+
}
|
|
510
|
+
}, this.props.t('header_one')), /*#__PURE__*/React.createElement("div", {
|
|
511
|
+
className: 'list-dropdown-item',
|
|
512
|
+
onClick: function onClick(event) {
|
|
513
|
+
_this7.props.onClickBlock(event, 'header_two');
|
|
514
|
+
}
|
|
515
|
+
}, this.props.t('header_two')), /*#__PURE__*/React.createElement("div", {
|
|
516
|
+
className: 'list-dropdown-item',
|
|
517
|
+
onClick: function onClick(event) {
|
|
518
|
+
_this7.props.onClickBlock(event, 'header_three');
|
|
519
|
+
}
|
|
520
|
+
}, this.props.t('header_three')), /*#__PURE__*/React.createElement("div", {
|
|
521
|
+
className: 'list-dropdown-item',
|
|
522
|
+
onClick: function onClick(event) {
|
|
523
|
+
_this7.props.onClickBlock(event, 'header_four');
|
|
524
|
+
}
|
|
525
|
+
}, this.props.t('header_four')), /*#__PURE__*/React.createElement("div", {
|
|
526
|
+
className: 'list-dropdown-item',
|
|
527
|
+
onClick: function onClick(event) {
|
|
528
|
+
_this7.props.onClickBlock(event, 'header_five');
|
|
529
|
+
}
|
|
530
|
+
}, this.props.t('header_five')), /*#__PURE__*/React.createElement("div", {
|
|
531
|
+
className: 'list-dropdown-item',
|
|
532
|
+
onClick: function onClick(event) {
|
|
533
|
+
_this7.props.onClickBlock(event, 'header_six');
|
|
534
|
+
}
|
|
535
|
+
}, this.props.t('header_six'))));
|
|
536
|
+
}
|
|
537
|
+
}]);
|
|
538
|
+
|
|
539
|
+
return HeaderList;
|
|
540
|
+
}(React.PureComponent);
|
|
541
|
+
|
|
542
|
+
var translatedTableToolBar = withTranslation('seafile-editor')(TableToolBar);
|
|
543
|
+
var translatedMoreMenu = withTranslation('seafile-editor')(MoreMenu);
|
|
544
|
+
var translateHeaderList = withTranslation('seafile-editor')(HeaderList);
|
|
545
|
+
export { IconButton, CollabUsersButton, translatedTableToolBar as TableToolBar, Button, ButtonGroup, translatedMoreMenu as MoreMenu, translateHeaderList as HeaderList };
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { withTranslation } from 'react-i18next';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import InternalLinkDialog from '../internal-link-dialog';
|
|
9
|
+
|
|
10
|
+
var FileInfo = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
|
+
_inherits(FileInfo, _React$PureComponent);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(FileInfo);
|
|
14
|
+
|
|
15
|
+
function FileInfo() {
|
|
16
|
+
_classCallCheck(this, FileInfo);
|
|
17
|
+
|
|
18
|
+
return _super.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_createClass(FileInfo, [{
|
|
22
|
+
key: "render",
|
|
23
|
+
value: function render() {
|
|
24
|
+
var lockedText = this.props.t('locked');
|
|
25
|
+
var fileInfo = this.props.fileInfo;
|
|
26
|
+
var modifyTime = moment(fileInfo.mtime * 1000).format('YYYY-MM-DD HH:mm');
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: 'file-info-wrapper'
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "topbar-file-info"
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "file-title"
|
|
33
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: "file-name"
|
|
35
|
+
}, fileInfo.name), /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: 'file-star',
|
|
37
|
+
title: fileInfo.starred ? this.props.t('unstar') : this.props.t('star')
|
|
38
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
39
|
+
onClick: this.props.toggleStar,
|
|
40
|
+
className: fileInfo.starred ? 'iconfont icon-star1 star' : 'iconfont icon-star2'
|
|
41
|
+
})), /*#__PURE__*/React.createElement(InternalLinkDialog, {
|
|
42
|
+
editorUtilities: this.props.editorApi
|
|
43
|
+
}), this.props.isPro && this.props.isLocked && /*#__PURE__*/React.createElement("img", {
|
|
44
|
+
className: "file-locked-icon mx-2",
|
|
45
|
+
width: "16",
|
|
46
|
+
src: "".concat(this.props.mediaUrl, "img/file-locked-32.png"),
|
|
47
|
+
alt: lockedText,
|
|
48
|
+
title: lockedText,
|
|
49
|
+
"aria-label": lockedText
|
|
50
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "file-state"
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
className: 'file-modifier-name'
|
|
54
|
+
}, fileInfo.lastModifier), /*#__PURE__*/React.createElement("span", {
|
|
55
|
+
className: 'file-modifier-time'
|
|
56
|
+
}, modifyTime), this.props.showDraftSaved && /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
className: 'file-modifier-savedraft'
|
|
58
|
+
}, this.props.t('local_draft_saved')))));
|
|
59
|
+
}
|
|
60
|
+
}]);
|
|
61
|
+
|
|
62
|
+
return FileInfo;
|
|
63
|
+
}(React.PureComponent);
|
|
64
|
+
|
|
65
|
+
export default withTranslation('seafile-editor')(FileInfo);
|