@seafile/seafile-editor 0.3.99 → 0.3.100
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/_i18n/index.js +20 -0
- package/dist/assets/css/comment-dialog.css +50 -0
- package/dist/{css → assets/css}/diff-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/formula.css +0 -0
- package/dist/{css → assets/css}/history-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/image.css +0 -0
- package/dist/{index.css → assets/css/index.css} +0 -0
- package/dist/assets/css/issue-card.css +43 -0
- package/dist/{css → assets/css}/keyboard-shortcuts.css +0 -0
- package/dist/{css/richeditor → assets/css}/link.css +0 -0
- package/dist/{css/plaineditor → assets/css}/markdown-editor.css +0 -0
- package/dist/{css → assets/css}/markdown-viewer.css +0 -0
- package/dist/{css/richeditor → assets/css}/navbar-imgbutton.css +0 -0
- package/dist/assets/css/outline.css +29 -0
- package/dist/{css/richeditor → assets/css}/table.css +0 -0
- package/dist/{css/richeditor → assets/css}/textlink-hovermenu.css +0 -0
- package/dist/{css → assets/css}/topbar.css +19 -33
- package/dist/{css/richeditor → assets/css}/tree-view.css +0 -0
- package/dist/{css/richeditor/right-panel.css → assets/css/user-help.css} +9 -9
- package/dist/assets/editor/plain-editor.css +30 -0
- package/dist/assets/editor/rich-editor.css +104 -0
- package/dist/assets/editor/simple-editor.css +77 -0
- package/dist/{css/richeditor → assets/rich-editor}/document-info.css +0 -0
- package/dist/components/add-formula-dialog.js +6 -4
- package/dist/components/add-image-dialog.js +3 -1
- package/dist/components/add-link-dialog.js +4 -3
- package/dist/components/comment-dialog.js +12 -6
- package/dist/components/markdown-lint.js +1 -0
- package/dist/components/outline/index.js +97 -0
- package/dist/components/outline/outline-item.js +70 -0
- package/dist/components/shortcut-dialog.js +1 -1
- package/dist/components/{topbar-component → toolbar}/header-list.js +0 -0
- package/dist/components/toolbar/help-group.js +40 -0
- package/dist/components/toolbar/index.js +4 -0
- package/dist/components/{topbar-component/upload-img.js → toolbar/insert-image.js} +18 -15
- package/dist/components/toolbar/insert-table.js +155 -0
- package/dist/components/toolbar/table-group.js +82 -0
- package/dist/components/{toolbar.js → toolbar/toolbar.js} +102 -64
- package/dist/components/{topbar-component → toolbar/widgets}/button-group.js +0 -0
- package/dist/components/toolbar/widgets/button-item.js +144 -0
- package/dist/components/toolbar/widgets/drop-list.js +101 -0
- package/dist/components/user-help.js +16 -10
- package/dist/editor/controller/block-element-controller.js +6 -2
- package/dist/editor/controller/inline-element-controller.js +6 -2
- package/dist/editor/editor-builder.js +107 -0
- package/dist/editor/editor-component/formula.js +4 -2
- package/dist/editor/editor-component/image.js +10 -6
- package/dist/editor/editor-component/table.js +1 -1
- package/dist/editor/editor-plugin.js +3 -1
- package/dist/editor/editor.js +1 -32
- package/dist/editor/index.js +97 -0
- package/dist/editor/markdown-editor.js +323 -0
- package/dist/editor/plain-markdown-editor.js +5 -4
- package/dist/editor/rich-markdown-editor.js +70 -149
- package/dist/editor/simple-editor.js +44 -78
- package/dist/{css/richeditor → example/assets/css}/comments-list.css +0 -45
- package/dist/{css/richeditor → example/assets/css}/detail-list-view.css +0 -0
- package/dist/{css/richeditor → example/assets/css}/participants-list.css +0 -0
- package/dist/{css → example/assets/css}/react-mentions-default-style.js +0 -0
- package/dist/example/assets/css/seafile-editor-main.css +125 -0
- package/dist/example/assets/css/seafile-editor-side.css +89 -0
- package/dist/example/assets/css/side-panel.css +81 -0
- package/dist/{components → example/components}/comment-panel.js +12 -6
- package/dist/{components → example/components}/detail-list-view.js +1 -1
- package/dist/{components → example/components}/participants-list.js +1 -1
- package/dist/{components → example/components}/side-panel.js +5 -7
- package/dist/example/seafile-editor.js +137 -0
- package/dist/index.js +9 -0
- package/dist/index.local.js +58 -0
- package/dist/pages/seafile-editor/index.js +38 -0
- package/dist/{editor → pages/seafile-editor}/seafile-editor.js +19 -35
- package/dist/{seafile-editor-chooser.js → pages/seafile-editor-chooser.js} +0 -0
- package/dist/{seafile-markdown-editor.js → pages/seafile-markdown-editor.js} +5 -5
- package/dist/{seafile-markdown-viewer.js → pages/seafile-markdown-viewer.js} +3 -3
- package/dist/{seafile-simple-editor.js → pages/seafile-simple-editor.js} +5 -2
- package/dist/viewer/diff-viewer.js +1 -1
- package/dist/viewer/markdown-viewer.js +14 -15
- package/dist/viewer/slate-viewer.js +9 -24
- package/dist/viewer/viewer-formula.js +1 -1
- package/package.json +5 -13
- package/dist/components/generate-share-link.js +0 -412
- package/dist/components/internal-link-dialog.js +0 -96
- package/dist/components/outline.js +0 -130
- package/dist/components/topbar-component/icon-button.js +0 -99
- package/dist/components/topbar-component/insert-file.js +0 -67
- package/dist/components/topbar-component/table-toolbar.js +0 -175
- package/dist/css/layout.css +0 -111
- package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
- package/dist/css/richeditor/rich-editor-main.css +0 -32
- package/dist/css/richeditor/side-panel.css +0 -183
|
@@ -1,412 +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 { Button, Form, FormGroup, Label, Input, InputGroup, InputGroupAddon } from 'reactstrap';
|
|
8
|
-
|
|
9
|
-
var GenerateShareLink = /*#__PURE__*/function (_React$Component) {
|
|
10
|
-
_inherits(GenerateShareLink, _React$Component);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(GenerateShareLink);
|
|
13
|
-
|
|
14
|
-
function GenerateShareLink(props) {
|
|
15
|
-
var _this;
|
|
16
|
-
|
|
17
|
-
_classCallCheck(this, GenerateShareLink);
|
|
18
|
-
|
|
19
|
-
_this = _super.call(this, props);
|
|
20
|
-
|
|
21
|
-
_this.getShareLink = function () {
|
|
22
|
-
var path = _this.props.fileInfo.path;
|
|
23
|
-
var repoID = _this.props.fileInfo.repoID;
|
|
24
|
-
|
|
25
|
-
_this.props.editorUtilities.getShareLink(repoID, path).then(function (res) {
|
|
26
|
-
if (res.data.length !== 0) {
|
|
27
|
-
_this.setState({
|
|
28
|
-
link: res.data[0].link,
|
|
29
|
-
token: res.data[0].token
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
_this.onPasswordInputChecked = function () {
|
|
36
|
-
_this.setState({
|
|
37
|
-
isShowPasswordInput: !_this.state.isShowPasswordInput,
|
|
38
|
-
password: '',
|
|
39
|
-
passwdnew: '',
|
|
40
|
-
errorInfo: ''
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
_this.togglePasswordVisible = function () {
|
|
45
|
-
_this.setState({
|
|
46
|
-
isPasswordVisible: !_this.state.isPasswordVisible
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
_this.generatePassword = function () {
|
|
51
|
-
var val = Math.random().toString(36).substr(5);
|
|
52
|
-
|
|
53
|
-
_this.setState({
|
|
54
|
-
password: val,
|
|
55
|
-
passwdnew: val
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
_this.inputPassword = function (e) {
|
|
60
|
-
var passwd = e.target.value.trim();
|
|
61
|
-
|
|
62
|
-
_this.setState({
|
|
63
|
-
password: passwd
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
_this.inputPasswordNew = function (e) {
|
|
68
|
-
var passwd = e.target.value.trim();
|
|
69
|
-
|
|
70
|
-
_this.setState({
|
|
71
|
-
passwdnew: passwd
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
_this.setPermission = function (permission) {
|
|
76
|
-
if (permission == 'previewAndDownload') {
|
|
77
|
-
_this.permissions = {
|
|
78
|
-
'can_edit': false,
|
|
79
|
-
'can_download': true
|
|
80
|
-
};
|
|
81
|
-
} else {
|
|
82
|
-
_this.permissions = {
|
|
83
|
-
'can_edit': false,
|
|
84
|
-
'can_download': false
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
_this.generateShareLink = function () {
|
|
90
|
-
var isValid = _this.validateParamsInput();
|
|
91
|
-
|
|
92
|
-
if (isValid) {
|
|
93
|
-
_this.setState({
|
|
94
|
-
errorInfo: ''
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
var path = _this.props.fileInfo.path;
|
|
98
|
-
var repoID = _this.props.fileInfo.repoID;
|
|
99
|
-
var _this$state = _this.state,
|
|
100
|
-
password = _this$state.password,
|
|
101
|
-
expireDays = _this$state.expireDays;
|
|
102
|
-
var permissions = _this.permissions;
|
|
103
|
-
permissions = JSON.stringify(permissions);
|
|
104
|
-
|
|
105
|
-
_this.props.editorUtilities.createShareLink(repoID, path, password, expireDays, permissions).then(function (res) {
|
|
106
|
-
_this.setState({
|
|
107
|
-
link: res.data.link,
|
|
108
|
-
token: res.data.token
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
_this.deleteShareLink = function () {
|
|
115
|
-
_this.props.editorUtilities.deleteShareLink(_this.state.token).then(function () {
|
|
116
|
-
_this.setState({
|
|
117
|
-
link: '',
|
|
118
|
-
token: '',
|
|
119
|
-
password: '',
|
|
120
|
-
passwordnew: '',
|
|
121
|
-
isShowPasswordInput: false,
|
|
122
|
-
expireDays: '',
|
|
123
|
-
isExpireChecked: false,
|
|
124
|
-
errorInfo: ''
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
_this.permissions = {
|
|
128
|
-
'can_edit': false,
|
|
129
|
-
'can_download': true
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
_this.onExpireChecked = function (e) {
|
|
135
|
-
_this.setState({
|
|
136
|
-
isExpireChecked: e.target.checked
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
_this.onExpireDaysChanged = function (e) {
|
|
141
|
-
var day = e.target.value.trim();
|
|
142
|
-
|
|
143
|
-
_this.setState({
|
|
144
|
-
expireDays: day
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
_this.validateParamsInput = function () {
|
|
149
|
-
var _this$state2 = _this.state,
|
|
150
|
-
isShowPasswordInput = _this$state2.isShowPasswordInput,
|
|
151
|
-
password = _this$state2.password,
|
|
152
|
-
passwdnew = _this$state2.passwdnew,
|
|
153
|
-
isExpireChecked = _this$state2.isExpireChecked,
|
|
154
|
-
expireDays = _this$state2.expireDays; // validate password
|
|
155
|
-
|
|
156
|
-
if (isShowPasswordInput) {
|
|
157
|
-
if (password.length === 0) {
|
|
158
|
-
_this.setState({
|
|
159
|
-
errorInfo: _this.props.t('please_enter_password')
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (password.length < 8) {
|
|
166
|
-
_this.setState({
|
|
167
|
-
errorInfo: _this.props.t('password_is_too_short')
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (password !== passwdnew) {
|
|
174
|
-
_this.setState({
|
|
175
|
-
errorInfo: _this.props.t('passwords_do_not_match')
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
} // validate days
|
|
181
|
-
// no limit
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var reg = /^\d+$/;
|
|
185
|
-
|
|
186
|
-
if (_this.isExpireDaysNoLimit) {
|
|
187
|
-
if (isExpireChecked) {
|
|
188
|
-
if (!expireDays) {
|
|
189
|
-
_this.setState({
|
|
190
|
-
errorInfo: _this.props.t('please_enter_days')
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var flag = reg.test(expireDays);
|
|
197
|
-
|
|
198
|
-
if (!flag) {
|
|
199
|
-
_this.setState({
|
|
200
|
-
errorInfo: _this.props.t('please_enter_a_non-negative_integer')
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
_this.setState({
|
|
207
|
-
expireDays: parseInt(expireDays)
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
} else {
|
|
211
|
-
if (!expireDays) {
|
|
212
|
-
_this.setState({
|
|
213
|
-
errorInfo: _this.props.t('please_enter_days')
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
var _flag = reg.test(expireDays);
|
|
220
|
-
|
|
221
|
-
if (!_flag) {
|
|
222
|
-
_this.setState({
|
|
223
|
-
errorInfo: _this.props.t('please_enter_a_non-negative_integer')
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
expireDays = parseInt(expireDays);
|
|
230
|
-
var minDays = parseInt(_this.props.shareLinkExpireDaysMin);
|
|
231
|
-
var maxDays = parseInt(_this.props.shareLinkExpireDaysMax);
|
|
232
|
-
|
|
233
|
-
if (minDays !== 0 && maxDays !== maxDays) {
|
|
234
|
-
if (expireDays < minDays) {
|
|
235
|
-
_this.setState({
|
|
236
|
-
errorInfo: _this.props.t('please_enter_valid_days')
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (minDays === 0 && maxDays !== 0) {
|
|
244
|
-
if (expireDays > maxDays) {
|
|
245
|
-
_this.setState({
|
|
246
|
-
errorInfo: _this.props.t('please_enter_valid_days')
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (minDays !== 0 && maxDays !== 0) {
|
|
254
|
-
if (expireDays < minDays || expireDays < maxDays) {
|
|
255
|
-
_this.setState({
|
|
256
|
-
errorInfo: _this.props.t('please_enter_valid_days')
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
_this.setState({
|
|
264
|
-
expireDays: expireDays
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return true;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
_this.state = {
|
|
272
|
-
isValidate: false,
|
|
273
|
-
isShowPasswordInput: false,
|
|
274
|
-
isPasswordVisible: false,
|
|
275
|
-
isExpireChecked: false,
|
|
276
|
-
password: '',
|
|
277
|
-
passwdnew: '',
|
|
278
|
-
expireDays: '',
|
|
279
|
-
token: '',
|
|
280
|
-
link: '',
|
|
281
|
-
errorInfo: ''
|
|
282
|
-
};
|
|
283
|
-
_this.permissions = {
|
|
284
|
-
'can_edit': false,
|
|
285
|
-
'can_download': true
|
|
286
|
-
};
|
|
287
|
-
_this.isExpireDaysNoLimit = parseInt(_this.props.shareLinkExpireDaysMin) === 0 && parseInt(_this.props.shareLinkExpireDaysMax) === 0;
|
|
288
|
-
return _this;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
_createClass(GenerateShareLink, [{
|
|
292
|
-
key: "componentDidMount",
|
|
293
|
-
value: function componentDidMount() {
|
|
294
|
-
this.getShareLink();
|
|
295
|
-
}
|
|
296
|
-
}, {
|
|
297
|
-
key: "render",
|
|
298
|
-
value: function render() {
|
|
299
|
-
var _this2 = this;
|
|
300
|
-
|
|
301
|
-
if (this.state.link) {
|
|
302
|
-
return /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement("p", null, this.state.link), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
303
|
-
onClick: this.deleteShareLink
|
|
304
|
-
}, this.props.t('delete')));
|
|
305
|
-
} else {
|
|
306
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
307
|
-
className: "generate-share-link"
|
|
308
|
-
}, /*#__PURE__*/React.createElement(FormGroup, {
|
|
309
|
-
check: true
|
|
310
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
311
|
-
check: true
|
|
312
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
313
|
-
type: "checkbox",
|
|
314
|
-
onChange: this.onPasswordInputChecked
|
|
315
|
-
}), ' ', this.props.t('add_password_protection'))), this.state.isShowPasswordInput && /*#__PURE__*/React.createElement(FormGroup, {
|
|
316
|
-
className: "link-operation-content"
|
|
317
|
-
}, /*#__PURE__*/React.createElement(Label, null, this.props.t('password')), /*#__PURE__*/React.createElement("span", {
|
|
318
|
-
className: "tip"
|
|
319
|
-
}, " (", this.props.t('at_least_8_characters'), ") "), /*#__PURE__*/React.createElement(InputGroup, {
|
|
320
|
-
className: "passwd"
|
|
321
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
322
|
-
type: this.state.isPasswordVisible ? 'text' : 'password',
|
|
323
|
-
value: this.state.password || '',
|
|
324
|
-
onChange: this.inputPassword
|
|
325
|
-
}), /*#__PURE__*/React.createElement(InputGroupAddon, {
|
|
326
|
-
addonType: "append"
|
|
327
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
328
|
-
onClick: this.togglePasswordVisible
|
|
329
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
330
|
-
className: "link-operation-icon iconfont ".concat(this.state.isPasswordVisible ? 'icon-eye' : 'icon-eye-slash')
|
|
331
|
-
})), /*#__PURE__*/React.createElement(Button, {
|
|
332
|
-
onClick: this.generatePassword
|
|
333
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
334
|
-
className: "link-operation-icon iconfont icon-magic"
|
|
335
|
-
})))), /*#__PURE__*/React.createElement(Label, null, this.props.t('password_again')), /*#__PURE__*/React.createElement(Input, {
|
|
336
|
-
className: "passwd",
|
|
337
|
-
type: this.state.isPasswordVisible ? 'text' : 'password',
|
|
338
|
-
value: this.state.passwdnew || '',
|
|
339
|
-
onChange: this.inputPasswordNew
|
|
340
|
-
})), this.isExpireDaysNoLimit && /*#__PURE__*/React.createElement(FormGroup, {
|
|
341
|
-
check: true
|
|
342
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
343
|
-
check: true
|
|
344
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
345
|
-
className: "expire-checkbox",
|
|
346
|
-
type: "checkbox",
|
|
347
|
-
onChange: this.onExpireChecked
|
|
348
|
-
}), ' ', this.props.t('add_auto_expiration'), /*#__PURE__*/React.createElement(Input, {
|
|
349
|
-
className: "expire-input",
|
|
350
|
-
type: "text",
|
|
351
|
-
value: this.state.expireDays,
|
|
352
|
-
onChange: this.onExpireDaysChanged,
|
|
353
|
-
readOnly: !this.state.isExpireChecked
|
|
354
|
-
}), /*#__PURE__*/React.createElement("span", null, this.props.t('days')))), !this.isExpireDaysNoLimit && /*#__PURE__*/React.createElement(FormGroup, {
|
|
355
|
-
check: true
|
|
356
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
357
|
-
check: true
|
|
358
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
359
|
-
className: "expire-checkbox",
|
|
360
|
-
type: "checkbox",
|
|
361
|
-
onChange: this.onExpireChecked,
|
|
362
|
-
checked: true,
|
|
363
|
-
readOnly: true
|
|
364
|
-
}), ' ', this.props.t('add_auto_expiration'), /*#__PURE__*/React.createElement(Input, {
|
|
365
|
-
className: "expire-input",
|
|
366
|
-
type: "text",
|
|
367
|
-
value: this.state.expireDays,
|
|
368
|
-
onChange: this.onExpireDaysChanged
|
|
369
|
-
}), " ", /*#__PURE__*/React.createElement("span", null, this.props.t('days')), parseInt(this.props.shareLinkExpireDaysMin) !== 0 && parseInt(this.props.shareLinkExpireDaysMax) !== 0 && /*#__PURE__*/React.createElement("span", null, " (", this.props.shareLinkExpireDaysMin, " - ", this.props.shareLinkExpireDaysMax, ' ', this.props.t('days'), ")"), parseInt(this.props.shareLinkExpireDaysMin) !== 0 && parseInt(this.props.shareLinkExpireDaysMax) === 0 && /*#__PURE__*/React.createElement("span", null, " (", this.props.t('greater_than_or_equal_to'), " ", this.props.shareLinkExpireDaysMin, ' ', this.props.t('days'), ")"), parseInt(this.props.shareLinkExpireDaysMin) === 0 && parseInt(this.props.shareLinkExpireDaysMax) !== 0 && /*#__PURE__*/React.createElement("span", null, " (", this.props.t('less_than_or_equal_to'), " ", this.props.shareLinkExpireDaysMax, ' ', this.props.t('days'), ")"))), /*#__PURE__*/React.createElement(FormGroup, {
|
|
370
|
-
check: true
|
|
371
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
372
|
-
check: true
|
|
373
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
374
|
-
type: "checkbox",
|
|
375
|
-
checked: true,
|
|
376
|
-
readOnly: true
|
|
377
|
-
}), ' ', this.props.t('set_permission'))), /*#__PURE__*/React.createElement(FormGroup, {
|
|
378
|
-
check: true,
|
|
379
|
-
className: "permission"
|
|
380
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
381
|
-
check: true
|
|
382
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
383
|
-
type: "radio",
|
|
384
|
-
name: "radio1",
|
|
385
|
-
defaultChecked: true,
|
|
386
|
-
onChange: function onChange() {
|
|
387
|
-
return _this2.setPermission('previewAndDownload');
|
|
388
|
-
}
|
|
389
|
-
}), ' ', this.props.t('preview_and_download'))), /*#__PURE__*/React.createElement(FormGroup, {
|
|
390
|
-
check: true,
|
|
391
|
-
className: "permission"
|
|
392
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
393
|
-
check: true
|
|
394
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
395
|
-
type: "radio",
|
|
396
|
-
name: "radio1",
|
|
397
|
-
onChange: function onChange() {
|
|
398
|
-
return _this2.setPermission('preview');
|
|
399
|
-
}
|
|
400
|
-
}), ' ', this.props.t('preview_only'))), /*#__PURE__*/React.createElement(Label, {
|
|
401
|
-
className: "err-message"
|
|
402
|
-
}, this.props.t(this.state.errorInfo)), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
403
|
-
onClick: this.generateShareLink
|
|
404
|
-
}, this.props.t('generate')));
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}]);
|
|
408
|
-
|
|
409
|
-
return GenerateShareLink;
|
|
410
|
-
}(React.Component);
|
|
411
|
-
|
|
412
|
-
export default withTranslation('seafile-editor')(GenerateShareLink);
|
|
@@ -1,96 +0,0 @@
|
|
|
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 { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
|
8
|
-
import { withTranslation } from 'react-i18next';
|
|
9
|
-
import toaster from './toast';
|
|
10
|
-
import copy from '../utils/copy-to-clipboard';
|
|
11
|
-
|
|
12
|
-
var InternalLinkDialog = /*#__PURE__*/function (_React$Component) {
|
|
13
|
-
_inherits(InternalLinkDialog, _React$Component);
|
|
14
|
-
|
|
15
|
-
var _super = _createSuper(InternalLinkDialog);
|
|
16
|
-
|
|
17
|
-
function InternalLinkDialog(props) {
|
|
18
|
-
var _this;
|
|
19
|
-
|
|
20
|
-
_classCallCheck(this, InternalLinkDialog);
|
|
21
|
-
|
|
22
|
-
_this = _super.call(this, props);
|
|
23
|
-
_this.state = {
|
|
24
|
-
isOpen: false,
|
|
25
|
-
smartLink: ''
|
|
26
|
-
};
|
|
27
|
-
_this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
|
28
|
-
_this.getInternalLink = _this.getInternalLink.bind(_assertThisInitialized(_this));
|
|
29
|
-
_this.copyToClipBoard = _this.copyToClipBoard.bind(_assertThisInitialized(_this));
|
|
30
|
-
return _this;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_createClass(InternalLinkDialog, [{
|
|
34
|
-
key: "toggle",
|
|
35
|
-
value: function toggle() {
|
|
36
|
-
this.setState({
|
|
37
|
-
isOpen: !this.state.isOpen
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
key: "getInternalLink",
|
|
42
|
-
value: function getInternalLink() {
|
|
43
|
-
var _this2 = this;
|
|
44
|
-
|
|
45
|
-
this.props.editorUtilities.getInternalLink().then(function (res) {
|
|
46
|
-
_this2.setState({
|
|
47
|
-
isOpen: true,
|
|
48
|
-
smartLink: res.data.smart_link
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "copyToClipBoard",
|
|
54
|
-
value: function copyToClipBoard() {
|
|
55
|
-
copy(this.state.smartLink);
|
|
56
|
-
this.setState({
|
|
57
|
-
isOpen: false
|
|
58
|
-
});
|
|
59
|
-
toaster.success(this.props.t('copy_internal_link'), {
|
|
60
|
-
duration: 2
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "render",
|
|
65
|
-
value: function render() {
|
|
66
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
67
|
-
className: 'file-internal-link',
|
|
68
|
-
title: this.props.t('internal_link')
|
|
69
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
70
|
-
className: "iconfont icon-link",
|
|
71
|
-
onClick: this.getInternalLink
|
|
72
|
-
}), /*#__PURE__*/React.createElement(Modal, {
|
|
73
|
-
isOpen: this.state.isOpen,
|
|
74
|
-
toggle: this.toggle
|
|
75
|
-
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
76
|
-
toggle: this.toggle
|
|
77
|
-
}, this.props.t('internal_link')), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("p", {
|
|
78
|
-
className: "tip mb-1"
|
|
79
|
-
}, this.props.t('internal_link_desc')), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
|
|
80
|
-
target: "_blank",
|
|
81
|
-
rel: "noopener noreferrer",
|
|
82
|
-
href: this.state.smartLink
|
|
83
|
-
}, this.state.smartLink))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
84
|
-
color: "secondary",
|
|
85
|
-
onClick: this.toggle
|
|
86
|
-
}, this.props.t('cancel')), ' ', /*#__PURE__*/React.createElement(Button, {
|
|
87
|
-
color: "primary",
|
|
88
|
-
onClick: this.copyToClipBoard
|
|
89
|
-
}, this.props.t('copy')))));
|
|
90
|
-
}
|
|
91
|
-
}]);
|
|
92
|
-
|
|
93
|
-
return InternalLinkDialog;
|
|
94
|
-
}(React.Component);
|
|
95
|
-
|
|
96
|
-
export default withTranslation('seafile-editor')(InternalLinkDialog);
|
|
@@ -1,130 +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
|
-
|
|
8
|
-
var OutlineItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
9
|
-
_inherits(OutlineItem, _React$PureComponent);
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(OutlineItem);
|
|
12
|
-
|
|
13
|
-
function OutlineItem() {
|
|
14
|
-
var _this;
|
|
15
|
-
|
|
16
|
-
_classCallCheck(this, OutlineItem);
|
|
17
|
-
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
-
args[_key] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
-
|
|
24
|
-
_this.onClick = function (event) {
|
|
25
|
-
_this.props.editor.scrollToNode(_this.props.node);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return _this;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
_createClass(OutlineItem, [{
|
|
32
|
-
key: "componentDidMount",
|
|
33
|
-
value: function componentDidMount() {
|
|
34
|
-
var hash = decodeURI(window.location.hash);
|
|
35
|
-
hash = hash.substring(1, hash.length);
|
|
36
|
-
|
|
37
|
-
if (hash && this.props.node && hash === this.props.node.text) {
|
|
38
|
-
this.props.editor && this.props.editor.scrollToNode(this.props.node);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "render",
|
|
43
|
-
value: function render() {
|
|
44
|
-
var _this$props = this.props,
|
|
45
|
-
node = _this$props.node,
|
|
46
|
-
index = _this$props.index,
|
|
47
|
-
activeTitleIndex = _this$props.activeTitleIndex;
|
|
48
|
-
var className = "".concat(node.type === 'header_two' ? 'outline-h2' : '', "\n ").concat(node.type === 'header_three' ? 'outline-h3' : '', "\n ").concat(index === activeTitleIndex ? ' active' : '');
|
|
49
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
50
|
-
className: className,
|
|
51
|
-
key: index,
|
|
52
|
-
onClick: this.onClick
|
|
53
|
-
}, node.children[0].text);
|
|
54
|
-
}
|
|
55
|
-
}]);
|
|
56
|
-
|
|
57
|
-
return OutlineItem;
|
|
58
|
-
}(React.PureComponent);
|
|
59
|
-
|
|
60
|
-
var OutlineView = /*#__PURE__*/function (_React$PureComponent2) {
|
|
61
|
-
_inherits(OutlineView, _React$PureComponent2);
|
|
62
|
-
|
|
63
|
-
var _super2 = _createSuper(OutlineView);
|
|
64
|
-
|
|
65
|
-
function OutlineView(props) {
|
|
66
|
-
var _this2;
|
|
67
|
-
|
|
68
|
-
_classCallCheck(this, OutlineView);
|
|
69
|
-
|
|
70
|
-
_this2 = _super2.call(this, props);
|
|
71
|
-
|
|
72
|
-
_this2.getHeaderList = function (document) {
|
|
73
|
-
var headerList = [];
|
|
74
|
-
document.forEach(function (node, index) {
|
|
75
|
-
if (node.type === 'header_two' || node.type === 'header_three') {
|
|
76
|
-
headerList.push(Object.assign({}, node, {
|
|
77
|
-
path: [index]
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
_this2.setState({
|
|
83
|
-
headerList: headerList
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
_this2.state = {
|
|
88
|
-
headerList: null
|
|
89
|
-
};
|
|
90
|
-
return _this2;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
_createClass(OutlineView, [{
|
|
94
|
-
key: "componentDidMount",
|
|
95
|
-
value: function componentDidMount() {
|
|
96
|
-
this.getHeaderList(this.props.document);
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "componentWillReceiveProps",
|
|
100
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
101
|
-
if (this.props.document !== nextProps.document) {
|
|
102
|
-
this.getHeaderList(nextProps.document);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
key: "render",
|
|
107
|
-
value: function render() {
|
|
108
|
-
var _this3 = this;
|
|
109
|
-
|
|
110
|
-
var headerList = this.state.headerList;
|
|
111
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
-
className: "seafile-editor-outline py-2 pr-4"
|
|
113
|
-
}, headerList && headerList.length > 0 ? headerList.map(function (node, index) {
|
|
114
|
-
return /*#__PURE__*/React.createElement(OutlineItem, {
|
|
115
|
-
key: index,
|
|
116
|
-
editor: _this3.props.editor,
|
|
117
|
-
activeTitleIndex: _this3.props.activeTitleIndex,
|
|
118
|
-
node: node,
|
|
119
|
-
index: index
|
|
120
|
-
});
|
|
121
|
-
}) : this.props.isViewer ? null : /*#__PURE__*/React.createElement("div", {
|
|
122
|
-
className: "size-panel-no-content"
|
|
123
|
-
}, this.props.t('no_out_line')));
|
|
124
|
-
}
|
|
125
|
-
}]);
|
|
126
|
-
|
|
127
|
-
return OutlineView;
|
|
128
|
-
}(React.PureComponent);
|
|
129
|
-
|
|
130
|
-
export default withTranslation('seafile-editor')(OutlineView);
|