@seafile/seafile-editor 0.3.82 → 0.3.86

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 (155) hide show
  1. package/dist/components/add-formula-dialog.js +0 -0
  2. package/dist/components/add-image-dialog.js +0 -0
  3. package/dist/components/add-link-dialog.js +0 -0
  4. package/dist/components/click-outside.js +0 -0
  5. package/dist/components/comment-dialog.js +0 -0
  6. package/dist/components/comment-panel.js +0 -0
  7. package/dist/components/context-menu.js +0 -0
  8. package/dist/components/detail-list-view.js +0 -0
  9. package/dist/components/generate-share-link.js +0 -0
  10. package/dist/components/internal-link-dialog.js +0 -0
  11. package/dist/components/loading.js +0 -0
  12. package/dist/components/markdown-lint.js +0 -0
  13. package/dist/components/modal-portal.js +0 -0
  14. package/dist/components/outline.js +0 -0
  15. package/dist/components/participants-list.js +0 -0
  16. package/dist/components/related-files-list.js +0 -0
  17. package/dist/components/shortcut-dialog.js +0 -0
  18. package/dist/components/side-panel.js +0 -0
  19. package/dist/components/table-button.js +0 -0
  20. package/dist/components/toast/alert.js +0 -0
  21. package/dist/components/toast/index.js +0 -0
  22. package/dist/components/toast/toast.js +0 -0
  23. package/dist/components/toast/toastManager.js +0 -0
  24. package/dist/components/toast/toaster.js +0 -0
  25. package/dist/components/toolbar.js +0 -0
  26. package/dist/components/topbar-component/button-group.js +0 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +0 -0
  28. package/dist/components/topbar-component/file-info.js +0 -0
  29. package/dist/components/topbar-component/header-list.js +0 -0
  30. package/dist/components/topbar-component/icon-button.js +0 -0
  31. package/dist/components/topbar-component/insert-file.js +0 -0
  32. package/dist/components/topbar-component/table-toolbar.js +0 -0
  33. package/dist/components/topbar-component/upload-img.js +0 -0
  34. package/dist/components/user-help.js +0 -0
  35. package/dist/css/diff-viewer.css +0 -0
  36. package/dist/css/history-viewer.css +0 -0
  37. package/dist/css/keyboard-shortcuts.css +0 -0
  38. package/dist/css/layout.css +0 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -0
  40. package/dist/css/markdown-viewer.css +0 -0
  41. package/dist/css/plaineditor/markdown-editor.css +0 -0
  42. package/dist/css/react-mentions-default-style.js +0 -0
  43. package/dist/css/related-files-list.css +0 -0
  44. package/dist/css/richeditor/comments-list.css +0 -0
  45. package/dist/css/richeditor/detail-list-view.css +0 -0
  46. package/dist/css/richeditor/document-info.css +0 -0
  47. package/dist/css/richeditor/formula.css +0 -0
  48. package/dist/css/richeditor/image.css +29 -32
  49. package/dist/css/richeditor/link.css +0 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +0 -0
  51. package/dist/css/richeditor/participants-list.css +0 -0
  52. package/dist/css/richeditor/rich-editor-main.css +0 -0
  53. package/dist/css/richeditor/right-panel.css +0 -0
  54. package/dist/css/richeditor/side-panel.css +0 -0
  55. package/dist/css/richeditor/table.css +0 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +0 -0
  57. package/dist/css/richeditor/tree-view.css +0 -0
  58. package/dist/css/topbar.css +0 -0
  59. package/dist/editor/code-highlight-package.js +0 -0
  60. package/dist/editor/controller/block-element-controller.js +0 -0
  61. package/dist/editor/controller/inline-element-controller.js +0 -0
  62. package/dist/editor/controller/normalize-controller.js +0 -0
  63. package/dist/editor/controller/void-element-controller.js +0 -0
  64. package/dist/editor/custom/custom.js +0 -0
  65. package/dist/editor/custom/get-event-transfer.js +0 -0
  66. package/dist/editor/custom/getNodesByTypeAtRange.js +0 -0
  67. package/dist/editor/custom/insertNodes.js +0 -0
  68. package/dist/editor/custom/is-empty-paragraph.js +0 -0
  69. package/dist/editor/custom/set-event-transfer.js +0 -0
  70. package/dist/editor/custom/split-nodes-at-point.js +0 -0
  71. package/dist/editor/custom/unwrap-node-by-type-at-range.js +0 -0
  72. package/dist/editor/editor-component/check-list-item.js +0 -0
  73. package/dist/editor/editor-component/code-block.js +0 -0
  74. package/dist/editor/editor-component/formula.js +0 -0
  75. package/dist/editor/editor-component/image.js +96 -32
  76. package/dist/editor/editor-component/link.js +0 -0
  77. package/dist/editor/editor-component/table.js +0 -0
  78. package/dist/editor/editor-component/textlink-hovermenu.js +0 -0
  79. package/dist/editor/editor-plugin.js +35 -31
  80. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +0 -0
  81. package/dist/editor/editor-utils/block-element-utils/code-utils.js +0 -0
  82. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +0 -0
  83. package/dist/editor/editor-utils/block-element-utils/index.js +0 -0
  84. package/dist/editor/editor-utils/block-element-utils/list-utils.js +0 -0
  85. package/dist/editor/editor-utils/block-element-utils/table-utils.js +0 -0
  86. package/dist/editor/editor-utils/common-editor-utils.js +0 -0
  87. package/dist/editor/editor-utils/inline-element-utils/index.js +0 -0
  88. package/dist/editor/editor-utils/mark-utils.js +0 -0
  89. package/dist/editor/editor-utils/range-utils.js +0 -0
  90. package/dist/editor/editor-utils/selection-utils.js +0 -0
  91. package/dist/editor/editor-utils/text-utils.js +0 -0
  92. package/dist/editor/editor.js +0 -0
  93. package/dist/editor/element-model/blockquote.js +0 -0
  94. package/dist/editor/element-model/image.js +0 -0
  95. package/dist/editor/element-model/link.js +0 -0
  96. package/dist/editor/element-model/table.js +0 -0
  97. package/dist/editor/element-model/text.js +0 -0
  98. package/dist/editor/load-script.js +0 -0
  99. package/dist/editor/plain-markdown-editor.js +0 -0
  100. package/dist/editor/rich-markdown-editor.js +0 -0
  101. package/dist/editor/seafile-editor.js +0 -0
  102. package/dist/editor/simple-editor.js +0 -0
  103. package/dist/editor-api.js +0 -0
  104. package/dist/index.css +0 -0
  105. package/dist/lib/slate-hyperscript/creators.js +0 -0
  106. package/dist/lib/slate-hyperscript/hyperscript.js +0 -0
  107. package/dist/lib/slate-hyperscript/index.js +0 -0
  108. package/dist/lib/slate-hyperscript/tokens.js +0 -0
  109. package/dist/lib/unified/index.js +0 -0
  110. package/dist/lib/vfile/core.js +0 -0
  111. package/dist/lib/vfile/index.js +0 -0
  112. package/dist/seafile-editor-chooser.js +0 -0
  113. package/dist/seafile-markdown-editor.js +0 -0
  114. package/dist/seafile-markdown-viewer.js +0 -0
  115. package/dist/seafile-simple-editor.js +0 -0
  116. package/dist/utils/copy-to-clipboard.js +0 -0
  117. package/dist/utils/deserialize-html.js +0 -0
  118. package/dist/utils/diff/compare-strings.js +0 -0
  119. package/dist/utils/diff/diff.js +0 -0
  120. package/dist/utils/diff/index.js +0 -0
  121. package/dist/utils/render-slate.js +0 -0
  122. package/dist/utils/seafile-markdown2html.js +0 -0
  123. package/dist/utils/slate2markdown/deserialize.js +1 -1
  124. package/dist/utils/slate2markdown/index.js +0 -0
  125. package/dist/utils/slate2markdown/serialize.js +0 -0
  126. package/dist/utils/utils.js +0 -0
  127. package/dist/viewer/diff-viewer.js +0 -0
  128. package/dist/viewer/markdown-viewer.js +0 -0
  129. package/dist/viewer/slate-viewer.js +0 -0
  130. package/dist/viewer/viewer-formula.js +0 -0
  131. package/dist/viewer/viewer-image.js +0 -0
  132. package/dist/viewer/viewer-outline.js +0 -0
  133. package/package.json +2 -1
  134. package/public/favicon.ico +0 -0
  135. package/public/index.html +0 -0
  136. package/public/locales/cs/seafile-editor.json +0 -0
  137. package/public/locales/de/seafile-editor.json +0 -0
  138. package/public/locales/en/seafile-editor.json +0 -0
  139. package/public/locales/es/seafile-editor.json +0 -0
  140. package/public/locales/es-AR/seafile-editor.json +0 -0
  141. package/public/locales/es-MX/seafile-editor.json +0 -0
  142. package/public/locales/fr/seafile-editor.json +0 -0
  143. package/public/locales/it/seafile-editor.json +0 -0
  144. package/public/locales/ru/seafile-editor.json +0 -0
  145. package/public/locales/zh-CN/seafile-editor.json +0 -0
  146. package/public/manifest.json +0 -0
  147. package/public/media/scripts/mathjax/tex-svg.js +0 -0
  148. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  149. package/public/media/seafile-editor-font/iconfont.svg +117 -162
  150. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  151. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  153. package/public/media/seafile-editor-font.css +24 -7
  154. package/public/media/seafile-logo.png +0 -0
  155. package/public/media/seafile-ui.css +0 -0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -98,44 +98,41 @@
98
98
  display: inline;
99
99
  }
100
100
 
101
- .big-image-cover {
102
- position: fixed;
103
- top: 0;
104
- bottom: 0;
105
- right: 0;
106
- left: 0;
107
- background-color: rgba(0, 0, 0, 0.5);
108
- z-index: 1049;
109
- text-align: center;
101
+ /* set button font style in image previewer */
102
+ .sf-editor-image-previewer .dtable-icon-left {
103
+ font-family: "iconfont" !important;
104
+ font-size: 16px;
105
+ font-style: normal;
106
+ -webkit-font-smoothing: antialiased;
107
+ -moz-osx-font-smoothing: grayscale;
110
108
  }
111
109
 
112
- .big-image-container {
113
- position: absolute;
114
- width: 100%;
115
- top: 50px;
116
- bottom: 0;
117
- overflow-y: auto;
118
- padding: 0 30px 10px 30px;
110
+ .sf-editor-image-previewer .dtable-icon-left:before {
111
+ content: "\e756";
119
112
  }
120
113
 
121
- .big-image-cover .image-container-close {
122
- position: absolute;
123
- top: 20px;
124
- right: 20px;
125
- border-radius: 50%;
126
- height: 20px;
127
- width: 20px;
128
- z-index: 10000;
129
- font-size: 20px;
130
- color: hsla(0,0%,100%,.6);
131
- line-height: 26px;
132
- text-align: center;
114
+ .sf-editor-image-previewer .dtable-icon-right {
115
+ font-family: "iconfont" !important;
116
+ font-size: 16px;
117
+ font-style: normal;
118
+ -webkit-font-smoothing: antialiased;
119
+ -moz-osx-font-smoothing: grayscale;
120
+ line-height: normal;
133
121
  }
134
122
 
135
- .image-container-close:hover {
136
- color: #fff;
123
+ .sf-editor-image-previewer .dtable-icon-right:before {
124
+ content: "\e755";
137
125
  }
138
126
 
139
- .big-image-cover img{
140
- max-width: 100%;
127
+ .sf-editor-image-previewer button.dtable-icon-fork-number {
128
+ font-family: "iconfont" !important;
129
+ font-size: 16px;
130
+ font-style: normal;
131
+ -webkit-font-smoothing: antialiased;
132
+ -moz-osx-font-smoothing: grayscale;
133
+ line-height: normal;
134
+ }
135
+
136
+ .sf-editor-image-previewer .dtable-icon-fork-number:before {
137
+ content: "\e6ce";
141
138
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,12 +1,14 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
1
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
5
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
6
  import React from 'react';
6
7
  import { withTranslation } from 'react-i18next';
8
+ import Lightbox from '@seafile/react-image-lightbox';
7
9
  import { Utils } from '../../utils/utils';
8
10
  import InlineElementUtils from '../editor-utils/inline-element-utils';
9
- import Modal from '../../components/modal-portal';
11
+ import '@seafile/react-image-lightbox/style.css';
10
12
 
11
13
  var Image = /*#__PURE__*/function (_React$Component) {
12
14
  _inherits(Image, _React$Component);
@@ -86,10 +88,10 @@ var Image = /*#__PURE__*/function (_React$Component) {
86
88
  _this.imgSrc = src;
87
89
  };
88
90
 
89
- _this.renderBigImage = function () {
90
- return /*#__PURE__*/React.createElement(BigImage, {
91
- bigImageSrc: _this.imgSrc,
92
- toggleBigImage: _this.toggleBigImage
91
+ _this.renderImagePreviewer = function () {
92
+ return /*#__PURE__*/React.createElement(ImagePreviewer, {
93
+ imageUrl: _this.imgSrc,
94
+ toggleImagePreviewer: _this.toggleBigImage
93
95
  });
94
96
  };
95
97
 
@@ -164,7 +166,7 @@ var Image = /*#__PURE__*/function (_React$Component) {
164
166
  src: src,
165
167
  alt: ' ',
166
168
  ref: "image"
167
- }), children, this.state.isShowBigImage && this.renderBigImage());
169
+ }), children, this.state.isShowBigImage && this.renderImagePreviewer());
168
170
  return src ? dom : /*#__PURE__*/React.createElement("span", attributes, "Loading...");
169
171
  }
170
172
  }]);
@@ -172,44 +174,106 @@ var Image = /*#__PURE__*/function (_React$Component) {
172
174
  return Image;
173
175
  }(React.Component);
174
176
 
175
- var BigImage = /*#__PURE__*/function (_React$Component2) {
176
- _inherits(BigImage, _React$Component2);
177
+ var ImagePreviewer = /*#__PURE__*/function (_React$Component2) {
178
+ _inherits(ImagePreviewer, _React$Component2);
177
179
 
178
- var _super2 = _createSuper(BigImage);
180
+ var _super2 = _createSuper(ImagePreviewer);
179
181
 
180
- function BigImage() {
181
- _classCallCheck(this, BigImage);
182
+ function ImagePreviewer(props) {
183
+ var _this2;
182
184
 
183
- return _super2.apply(this, arguments);
185
+ _classCallCheck(this, ImagePreviewer);
186
+
187
+ _this2 = _super2.call(this, props);
188
+
189
+ _this2.getImageNodes = function (nodes) {
190
+ var nodeIndex = 0;
191
+ var list = [];
192
+
193
+ while (nodes && nodeIndex <= nodes.length - 1) {
194
+ var currentNode = nodes[nodeIndex];
195
+
196
+ if (currentNode.type === 'image') {
197
+ currentNode.data.src && list.push(currentNode.data.src);
198
+ } else {
199
+ list.push.apply(list, _toConsumableArray(_this2.getImageNodes(currentNode.children)));
200
+ }
201
+
202
+ nodeIndex++;
203
+ }
204
+
205
+ return list;
206
+ };
207
+
208
+ _this2.moveToPrevImage = function () {
209
+ _this2.setState(function (prevState) {
210
+ return {
211
+ imageIndex: (prevState.imageIndex + _this2.images.length - 1) % _this2.images.length
212
+ };
213
+ });
214
+ };
215
+
216
+ _this2.moveToNextImage = function () {
217
+ _this2.setState(function (prevState) {
218
+ return {
219
+ imageIndex: (prevState.imageIndex + 1) % _this2.images.length
220
+ };
221
+ });
222
+ };
223
+
224
+ _this2.images = _this2.getImageNodes(window.editor.children);
225
+ _this2.state = {
226
+ imageIndex: _this2.images.findIndex(function (item) {
227
+ return item === props.imageUrl;
228
+ })
229
+ };
230
+ return _this2;
184
231
  }
185
232
 
186
- _createClass(BigImage, [{
233
+ _createClass(ImagePreviewer, [{
187
234
  key: "render",
188
235
  value: function render() {
189
- var _this2 = this;
236
+ var imageUrl = this.props.imageUrl;
237
+ var imageIndex = this.state.imageIndex;
238
+ var imageItemsLength = this.images.length;
239
+ var imageTitle = '';
240
+
241
+ try {
242
+ imageTitle = imageUrl ? decodeURI(imageUrl.slice(imageUrl.lastIndexOf('/') + 1)) : '';
243
+ } catch (error) {
244
+ // eslint-disable-next-line no-console
245
+ console.log(error);
246
+ }
190
247
 
191
- return /*#__PURE__*/React.createElement(Modal, null, /*#__PURE__*/React.createElement("div", {
192
- className: 'big-image-cover',
193
- onClick: function onClick(event) {
194
- return _this2.props.toggleBigImage(event);
248
+ var imageTitleEl = /*#__PURE__*/React.createElement("span", {
249
+ className: "d-flex"
250
+ }, /*#__PURE__*/React.createElement("span", {
251
+ className: "text-truncate"
252
+ }, imageTitle), /*#__PURE__*/React.createElement("span", {
253
+ className: "flex-shrink-0"
254
+ }, "(", imageIndex + 1, "/", this.images.length, ")"));
255
+ var mainSrc = this.images[imageIndex];
256
+ return /*#__PURE__*/React.createElement(Lightbox, {
257
+ wrapperClassName: "sf-editor-image-previewer",
258
+ imageTitle: imageTitleEl,
259
+ mainSrc: mainSrc,
260
+ toolbarButtons: [],
261
+ nextSrc: this.images[(imageIndex + 1) % imageItemsLength],
262
+ prevSrc: this.images[(imageIndex + imageItemsLength - 1) % imageItemsLength],
263
+ onCloseRequest: this.props.toggleImagePreviewer,
264
+ onMovePrevRequest: this.moveToPrevImage,
265
+ onMoveNextRequest: this.moveToNextImage,
266
+ imagePadding: 70,
267
+ reactModalStyle: {
268
+ overlay: {
269
+ zIndex: 1051
270
+ }
195
271
  }
196
- }, /*#__PURE__*/React.createElement("div", {
197
- className: 'big-image-container'
198
- }, /*#__PURE__*/React.createElement("img", {
199
- src: this.props.bigImageSrc,
200
- alt: ""
201
- })), /*#__PURE__*/React.createElement("div", {
202
- onClick: function onClick(event) {
203
- return _this2.props.toggleBigImage(event);
204
- },
205
- className: 'image-container-close'
206
- }, /*#__PURE__*/React.createElement("i", {
207
- className: 'iconfont icon-close'
208
- }))));
272
+ });
209
273
  }
210
274
  }]);
211
275
 
212
- return BigImage;
276
+ return ImagePreviewer;
213
277
  }(React.Component);
214
278
 
215
279
  export default withTranslation('seafile-editor')(Image);
File without changes
File without changes
@@ -210,43 +210,47 @@ var Plugin = function Plugin(_editor) {
210
210
 
211
211
  var table = _this.tableUtils.getSelectedTableCells();
212
212
 
213
- if (!table) {
214
- setEventTransfer(event, 'text', SfEditor.text(editor, editor.selection));
213
+ if (table) {
214
+ setEventTransfer(event, 'fragment', table);
215
215
  return;
216
216
  }
217
-
218
- setEventTransfer(event, 'fragment', table);
219
- return;
220
217
  }
221
218
 
222
- if (_this.codeUtils.isInCodeBlock() && !Range.isCollapsed(editor.selection)) {
223
- var anchorPoint = editor.selection.anchor;
224
- var focusPoint = editor.selection.focus;
225
- var anchorCodeBlock = Editor.match(_this.editor, anchorPoint, {
226
- type: 'code_block'
219
+ if (editor.selection && !Range.isCollapsed(editor.selection)) {
220
+ // get block deepest block node.
221
+ // for example: code line in a code block, paragraph in a list
222
+ var blockList = Editor.nodes(editor, {
223
+ at: editor.selection,
224
+ match: 'block'
227
225
  });
228
- var focusCodeBlock = Editor.match(_this.editor, focusPoint, {
229
- type: 'code_block'
230
- });
231
- /*
232
- If the selection is within the range of the selected code block
233
- copy the selected code line as paragraph
234
- */
235
226
 
236
- if (anchorCodeBlock && focusCodeBlock && Path.equals(focusCodeBlock[1], anchorCodeBlock[1])) {
237
- event.preventDefault();
238
- var fragment = Node.fragment(editor, editor.selection);
239
- fragment = fragment[0].children.map(function (codeLine) {
240
- var text = Node.text(codeLine);
241
- return {
242
- type: 'paragraph',
243
- children: [{
244
- text: text
245
- }]
246
- };
247
- });
248
- setEventTransfer(event, 'fragment', fragment);
249
- return;
227
+ if (blockList) {
228
+ var nodeList = Array.from(blockList);
229
+ /**
230
+ * if only one block element selected, write the selected content as paragraph or text to clipboard
231
+ * instead of use slate default behavior which write the outest element to clipboard
232
+ */
233
+
234
+ if (nodeList.length === 1) {
235
+ event.preventDefault();
236
+
237
+ var _nodeList$ = _slicedToArray(nodeList[0], 2),
238
+ node = _nodeList$[0],
239
+ path = _nodeList$[1];
240
+
241
+ path = path.slice(1);
242
+
243
+ if (node && node.type === 'paragraph') {
244
+ // get selected paragraph node in selection and write to clipboard
245
+ var fragment = Node.fragment(editor, editor.selection);
246
+ var selectedNode = Node.get(fragment[0], Array(path.length).fill(0));
247
+ setEventTransfer(event, 'fragment', [selectedNode]);
248
+ } else {
249
+ setEventTransfer(event, 'text', SfEditor.text(editor, editor.selection));
250
+ }
251
+
252
+ return;
253
+ }
250
254
  }
251
255
  }
252
256
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.css CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes