@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.
Files changed (156) hide show
  1. package/README.md +119 -0
  2. package/TODO.md +55 -0
  3. package/dist/components/add-formula-dialog.js +135 -0
  4. package/dist/components/add-image-dialog.js +78 -0
  5. package/dist/components/add-link-dialog.js +148 -0
  6. package/dist/components/comment-dialog.js +107 -0
  7. package/dist/components/comment-panel.js +452 -0
  8. package/dist/components/context-menu.js +112 -0
  9. package/dist/components/detail-list-view.js +119 -0
  10. package/dist/components/generate-share-link.js +412 -0
  11. package/dist/components/internal-link-dialog.js +96 -0
  12. package/dist/components/loading.js +32 -0
  13. package/dist/components/markdown-lint.js +87 -0
  14. package/dist/components/modal-portal.js +46 -0
  15. package/dist/components/outline.js +130 -0
  16. package/dist/components/participants-list.js +126 -0
  17. package/dist/components/related-files-list.js +75 -0
  18. package/dist/components/shortcut-dialog.js +167 -0
  19. package/dist/components/side-panel.js +175 -0
  20. package/dist/components/toast/alert.js +150 -0
  21. package/dist/components/toast/index.js +3 -0
  22. package/dist/components/toast/toast.js +179 -0
  23. package/dist/components/toast/toastManager.js +158 -0
  24. package/dist/components/toast/toaster.js +76 -0
  25. package/dist/components/toolbar.js +235 -0
  26. package/dist/components/topbar-component/button-group.js +31 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +545 -0
  28. package/dist/components/topbar-component/file-info.js +65 -0
  29. package/dist/components/topbar-component/header-list.js +128 -0
  30. package/dist/components/topbar-component/icon-button.js +99 -0
  31. package/dist/components/topbar-component/insert-file.js +67 -0
  32. package/dist/components/topbar-component/table-toolbar.js +175 -0
  33. package/dist/components/topbar-component/upload-img.js +122 -0
  34. package/dist/components/user-help.js +205 -0
  35. package/dist/css/diff-viewer.css +105 -0
  36. package/dist/css/history-viewer.css +104 -0
  37. package/dist/css/keyboard-shortcuts.css +59 -0
  38. package/dist/css/layout.css +110 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
  40. package/dist/css/markdown-viewer.css +69 -0
  41. package/dist/css/plaineditor/markdown-editor.css +12 -0
  42. package/dist/css/react-mentions-default-style.js +72 -0
  43. package/dist/css/related-files-list.css +56 -0
  44. package/dist/css/richeditor/comments-list.css +184 -0
  45. package/dist/css/richeditor/detail-list-view.css +114 -0
  46. package/dist/css/richeditor/document-info.css +57 -0
  47. package/dist/css/richeditor/formula.css +19 -0
  48. package/dist/css/richeditor/image.css +141 -0
  49. package/dist/css/richeditor/link.css +7 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +79 -0
  51. package/dist/css/richeditor/participants-list.css +22 -0
  52. package/dist/css/richeditor/rich-editor-main.css +42 -0
  53. package/dist/css/richeditor/right-panel.css +84 -0
  54. package/dist/css/richeditor/side-panel.css +190 -0
  55. package/dist/css/richeditor/table.css +57 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +47 -0
  57. package/dist/css/richeditor/tree-view.css +67 -0
  58. package/dist/css/topbar.css +400 -0
  59. package/dist/editor/code-highlight-package.js +27 -0
  60. package/dist/editor/controller/block-element-controller.js +376 -0
  61. package/dist/editor/controller/inline-element-controller.js +129 -0
  62. package/dist/editor/controller/normalize-controller.js +107 -0
  63. package/dist/editor/controller/shortcut-controller.js +394 -0
  64. package/dist/editor/controller/void-element-controller.js +12 -0
  65. package/dist/editor/custom/custom.js +17 -0
  66. package/dist/editor/custom/get-event-transfer.js +34 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
  68. package/dist/editor/custom/insertNodes.js +140 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +13 -0
  70. package/dist/editor/custom/set-event-transfer.js +31 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +162 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
  73. package/dist/editor/editor-component/check-list-item.js +64 -0
  74. package/dist/editor/editor-component/code-block.js +150 -0
  75. package/dist/editor/editor-component/formula.js +79 -0
  76. package/dist/editor/editor-component/image.js +215 -0
  77. package/dist/editor/editor-component/link.js +11 -0
  78. package/dist/editor/editor-component/table.js +172 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
  80. package/dist/editor/editor-plugin.js +249 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
  87. package/dist/editor/editor-utils/common-editor-utils.js +587 -0
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
  89. package/dist/editor/editor-utils/mark-utils.js +25 -0
  90. package/dist/editor/editor-utils/range-utils.js +9 -0
  91. package/dist/editor/editor-utils/selection-utils.js +33 -0
  92. package/dist/editor/editor-utils/text-utils.js +130 -0
  93. package/dist/editor/editor.js +66 -0
  94. package/dist/editor/element-model/blockquote.js +16 -0
  95. package/dist/editor/element-model/image.js +19 -0
  96. package/dist/editor/element-model/link.js +19 -0
  97. package/dist/editor/element-model/table.js +50 -0
  98. package/dist/editor/element-model/text.js +13 -0
  99. package/dist/editor/load-script.js +83 -0
  100. package/dist/editor/plain-markdown-editor.js +324 -0
  101. package/dist/editor/rich-markdown-editor.js +580 -0
  102. package/dist/editor/seafile-editor.js +326 -0
  103. package/dist/editor/simple-editor.js +245 -0
  104. package/dist/editor-api.js +261 -0
  105. package/dist/index.css +97 -0
  106. package/dist/lib/slate-hyperscript/creators.js +263 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
  108. package/dist/lib/slate-hyperscript/index.js +3 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +102 -0
  110. package/dist/lib/unified/index.js +470 -0
  111. package/dist/lib/vfile/core.js +172 -0
  112. package/dist/lib/vfile/index.js +48 -0
  113. package/dist/seafile-editor-chooser.js +45 -0
  114. package/dist/seafile-markdown-editor.js +301 -0
  115. package/dist/seafile-markdown-viewer.js +79 -0
  116. package/dist/seafile-simple-editor.js +56 -0
  117. package/dist/utils/copy-to-clipboard.js +47 -0
  118. package/dist/utils/deserialize-html.js +282 -0
  119. package/dist/utils/diff/compare-strings.js +46 -0
  120. package/dist/utils/diff/diff.js +855 -0
  121. package/dist/utils/diff/index.js +2 -0
  122. package/dist/utils/render-slate.js +219 -0
  123. package/dist/utils/seafile-markdown2html.js +62 -0
  124. package/dist/utils/slate2markdown/deserialize.js +689 -0
  125. package/dist/utils/slate2markdown/index.js +3 -0
  126. package/dist/utils/slate2markdown/serialize.js +407 -0
  127. package/dist/utils/utils.js +28 -0
  128. package/dist/viewer/diff-viewer.js +98 -0
  129. package/dist/viewer/markdown-viewer.js +139 -0
  130. package/dist/viewer/slate-viewer.js +73 -0
  131. package/dist/viewer/viewer-formula.js +67 -0
  132. package/dist/viewer/viewer-image.js +93 -0
  133. package/dist/viewer/viewer-outline.js +118 -0
  134. package/package.json +215 -0
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +45 -0
  137. package/public/locales/cs/seafile-editor.json +169 -0
  138. package/public/locales/de/seafile-editor.json +169 -0
  139. package/public/locales/en/seafile-editor.json +222 -0
  140. package/public/locales/es/seafile-editor.json +169 -0
  141. package/public/locales/es-AR/seafile-editor.json +169 -0
  142. package/public/locales/es-MX/seafile-editor.json +169 -0
  143. package/public/locales/fr/seafile-editor.json +169 -0
  144. package/public/locales/it/seafile-editor.json +169 -0
  145. package/public/locales/ru/seafile-editor.json +169 -0
  146. package/public/locales/zh-CN/seafile-editor.json +219 -0
  147. package/public/manifest.json +15 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +1 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +164 -0
  151. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  153. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  154. package/public/media/seafile-editor-font.css +201 -0
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +11169 -0
@@ -0,0 +1,412 @@
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);
@@ -0,0 +1,96 @@
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);
@@ -0,0 +1,32 @@
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
+
7
+ var Loading = /*#__PURE__*/function (_React$Component) {
8
+ _inherits(Loading, _React$Component);
9
+
10
+ var _super = _createSuper(Loading);
11
+
12
+ function Loading() {
13
+ _classCallCheck(this, Loading);
14
+
15
+ return _super.apply(this, arguments);
16
+ }
17
+
18
+ _createClass(Loading, [{
19
+ key: "render",
20
+ value: function render() {
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: "empty-loading-page"
23
+ }, /*#__PURE__*/React.createElement("div", {
24
+ className: "lds-ripple page-centered"
25
+ }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null)));
26
+ }
27
+ }]);
28
+
29
+ return Loading;
30
+ }(React.Component);
31
+
32
+ export default Loading;
@@ -0,0 +1,87 @@
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
+
7
+ var MarkdownLint = /*#__PURE__*/function (_React$PureComponent) {
8
+ _inherits(MarkdownLint, _React$PureComponent);
9
+
10
+ var _super = _createSuper(MarkdownLint);
11
+
12
+ function MarkdownLint() {
13
+ var _this;
14
+
15
+ _classCallCheck(this, MarkdownLint);
16
+
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+
21
+ _this = _super.call.apply(_super, [this].concat(args));
22
+
23
+ _this.onClickCard = function (event, key) {
24
+ if (_this.props.document[key]) {
25
+ var node = _this.props.document[key];
26
+ node.key = key;
27
+
28
+ _this.props.scrollToNode(node);
29
+ }
30
+ };
31
+
32
+ return _this;
33
+ }
34
+
35
+ _createClass(MarkdownLint, [{
36
+ key: "render",
37
+ value: function render() {
38
+ var _this2 = this;
39
+
40
+ var issueCards = [];
41
+
42
+ if (this.props.issues.issue_list.length > 0) {
43
+ this.props.issues.issue_list.map(function (issue, index) {
44
+ if (issue.detail) {
45
+ issue.detail.map(function (detail, detailIndex) {
46
+ var card = /*#__PURE__*/React.createElement("div", {
47
+ key: 'issue-' + index + '-' + detailIndex,
48
+ onClick: function onClick(event) {
49
+ _this2.onClickCard(event, detail.position);
50
+ },
51
+ className: 'issue-card'
52
+ }, /*#__PURE__*/React.createElement("div", {
53
+ className: 'issue-card-title'
54
+ }, _this2.props.markdownLint[issue.issue_code].issue), /*#__PURE__*/React.createElement("div", {
55
+ className: 'issue-card-description'
56
+ }, _this2.props.markdownLint[issue.issue_code].description));
57
+ issueCards.push(card);
58
+ return true;
59
+ });
60
+ } else {
61
+ var card = /*#__PURE__*/React.createElement("div", {
62
+ key: 'issue-' + index,
63
+ className: 'issue-card'
64
+ }, /*#__PURE__*/React.createElement("div", {
65
+ className: 'issue-card-title'
66
+ }, _this2.props.markdownLint[issue.issue_code].issue), /*#__PURE__*/React.createElement("div", {
67
+ className: 'issue-card-description'
68
+ }, _this2.props.markdownLint[issue.issue_code].description));
69
+ issueCards.push(card);
70
+ }
71
+
72
+ return true;
73
+ });
74
+ }
75
+
76
+ return /*#__PURE__*/React.createElement("div", {
77
+ className: 'issue-container'
78
+ }, issueCards.length > 0 ? issueCards : /*#__PURE__*/React.createElement("div", {
79
+ className: 'size-panel-no-content'
80
+ }, this.props.t('no_document_improvement_suggestion')));
81
+ }
82
+ }]);
83
+
84
+ return MarkdownLint;
85
+ }(React.PureComponent);
86
+
87
+ export default MarkdownLint;
@@ -0,0 +1,46 @@
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
+
8
+ var ModalPortal = /*#__PURE__*/function (_React$Component) {
9
+ _inherits(ModalPortal, _React$Component);
10
+
11
+ var _super = _createSuper(ModalPortal);
12
+
13
+ function ModalPortal(props) {
14
+ var _this;
15
+
16
+ _classCallCheck(this, ModalPortal);
17
+
18
+ _this = _super.call(this, props);
19
+ _this.state = {
20
+ isMounted: false
21
+ };
22
+ _this.el = document.createElement('div');
23
+ return _this;
24
+ }
25
+
26
+ _createClass(ModalPortal, [{
27
+ key: "componentDidMount",
28
+ value: function componentDidMount() {
29
+ document.body.appendChild(this.el);
30
+ }
31
+ }, {
32
+ key: "componentWillUnmount",
33
+ value: function componentWillUnmount() {
34
+ document.body.removeChild(this.el);
35
+ }
36
+ }, {
37
+ key: "render",
38
+ value: function render() {
39
+ return ReactDOM.createPortal(this.props.children, this.el);
40
+ }
41
+ }]);
42
+
43
+ return ModalPortal;
44
+ }(React.Component);
45
+
46
+ export { ModalPortal as default };