@seafile/seafile-editor 0.3.113 → 0.3.115
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/assets/css/topbar.css +6 -0
- package/dist/components/error-boundary.js +35 -0
- package/dist/components/menu/index.js +4 -0
- package/dist/components/menu/item.js +60 -0
- package/dist/components/menu/menu.js +49 -0
- package/dist/components/menu/style.css +42 -0
- package/dist/components/select/_option.js +56 -0
- package/dist/components/select/field-setting.js +132 -0
- package/dist/components/select/index.js +163 -0
- package/dist/components/select/style.css +149 -0
- package/dist/components/svg-icons/check-mark-icon.js +16 -0
- package/dist/components/svg-icons/column-icon.js +19 -0
- package/dist/components/svg-icons/text-icon.js +36 -0
- package/dist/components/toolbar/toolbar.js +38 -24
- package/dist/components/toolbar/widgets/button-item.js +6 -2
- package/dist/constants/cell-types.js +28 -0
- package/dist/constants/column.js +6 -0
- package/dist/editor/controller/inline-element-controller.js +20 -1
- package/dist/editor/controller/shortcut-controller.js +30 -9
- package/dist/editor/controller/void-element-controller.js +1 -1
- package/dist/editor/editor-builder.js +8 -0
- package/dist/editor/editor-component/column.js +124 -0
- package/dist/editor/editor-utils/common-editor-utils.js +19 -1
- package/dist/editor/editor-utils/inline-element-utils/index.js +19 -0
- package/dist/editor/element-model/column.js +22 -0
- package/dist/editor/index.js +2 -1
- package/dist/editor/seatable-editor.js +232 -0
- package/dist/index.js +4 -2
- package/dist/utils/render-slate.js +5 -0
- package/dist/utils/utils.js +32 -0
- package/dist/viewer/seatable-viewer.js +74 -0
- package/package.json +3 -2
- package/public/locales/en/seafile-editor.json +3 -1
- package/dist/components/table-button.js +0 -155
- package/dist/components/topbar-component/editor-toolbar.js +0 -545
- package/dist/components/topbar-component/file-info.js +0 -65
|
@@ -1,545 +0,0 @@
|
|
|
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 };
|
|
@@ -1,65 +0,0 @@
|
|
|
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 dayjs from 'dayjs';
|
|
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 = dayjs(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);
|