@seafile/seafile-editor 0.3.91 → 0.3.92

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.
@@ -199,17 +199,7 @@ var ToolBar = /*#__PURE__*/function (_React$Component) {
199
199
  onInsertRow: this.editorUtils.onInsertRow,
200
200
  onRemoveRow: this.editorUtils.onRemoveRow,
201
201
  onSetAlign: this.editorUtils.onSetAlign
202
- }), /*#__PURE__*/React.createElement(ButtonGroup, {
203
- className: 'editor-btn-group'
204
- }, /*#__PURE__*/React.createElement(IconButton, {
205
- className: 'editor-clear-format',
206
- isRichEditor: true,
207
- text: t('Clear_format'),
208
- id: 'clearButton',
209
- icon: 'iconfont icon-clear-format',
210
- onMouseDown: this.editorUtils.clearFormat,
211
- isActive: readOnly
212
- }))), this.props.hasSidePanel && /*#__PURE__*/React.createElement("div", {
202
+ })), this.props.hasSidePanel && /*#__PURE__*/React.createElement("div", {
213
203
  className: "button-container"
214
204
  }, !this.props.isShowSidePanel && /*#__PURE__*/React.createElement(ButtonGroup, {
215
205
  className: "editor-btn-group position-absolute dropdown-menu-right"
@@ -36,10 +36,6 @@
36
36
  padding: 0;
37
37
  }
38
38
 
39
- .editor-btn-group .editor-clear-format {
40
- margin-right: 5px;
41
- }
42
-
43
39
  .insert-file {
44
40
  position: relative;
45
41
  display: inline-block;
@@ -8,7 +8,6 @@ import CodeUtils from '../editor-utils/block-element-utils/code-utils';
8
8
  import TextUtils from '../editor-utils/text-utils';
9
9
  import TableUtils from '../editor-utils/block-element-utils/table-utils';
10
10
  import BlockquoteUtils from '../editor-utils/block-element-utils/blockquote-utils';
11
- import { clearBlockFormat, clearMarkerFormat } from '../editor-utils/clear-format-utils';
12
11
  var SHORTCUTS = {
13
12
  '1.': 'ordered_list',
14
13
  '*': 'unordered_list',
@@ -334,19 +333,12 @@ var withMarkdownShortcut = function withMarkdownShortcut(editor) {
334
333
  _Editor$nodes10 = _slicedToArray(_Editor$nodes9, 1),
335
334
  _node3 = _Editor$nodes10[0];
336
335
 
337
- var listItemPath = _node3[1];
338
- var listNode = Node.parent(editor, listItemPath); // Unwrap the list item when the selection is at the first list item of the first node of document
336
+ var listItemPath = _node3[1]; // Unwrap the list item when the selection is at the first list item
339
337
 
340
- if (anchor.path[0] === 0 && anchor.path[1] === 0 && anchor.path[listItemPath.length] === 0) {
338
+ if (listItemPath.at(-1) === 0 && anchor.path[listItemPath.length] === 0) {
341
339
  listUtils.unwrapList();
342
340
  return;
343
- } // unwrap an empty list
344
-
345
-
346
- if (listNode.children.length === 1 && Node.text(listNode).length === 0) {
347
- listUtils.unwrapList();
348
- return;
349
- } // list items with mutiple chidren
341
+ } // List items with mutiple chidren
350
342
 
351
343
 
352
344
  var currentChildBlockIndex = anchor.path[anchor.path.length - 2];
@@ -417,11 +409,6 @@ var withMarkdownShortcut = function withMarkdownShortcut(editor) {
417
409
  });
418
410
  return;
419
411
 
420
- case 'clear_format':
421
- clearBlockFormat(editor);
422
- clearMarkerFormat(editor);
423
- return;
424
-
425
412
  default:
426
413
  exec(command);
427
414
  }
@@ -366,14 +366,6 @@ var EditorUtils = /*#__PURE__*/function () {
366
366
  }
367
367
  };
368
368
 
369
- this.clearFormat = function (event) {
370
- event.preventDefault();
371
-
372
- _this.editor.exec({
373
- type: 'clear_format'
374
- });
375
- };
376
-
377
369
  this.unwrapLink = function () {
378
370
  _this.inlineElementUtils.unwrapLink();
379
371
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "0.3.91",
3
+ "version": "0.3.92",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^0.0.9",
@@ -135,7 +135,6 @@
135
135
  "Tags": "Tags",
136
136
  "Related_Files": "Related Files",
137
137
  "Add_participants": "Add participants",
138
- "Clear_format": "Clear format",
139
138
  "markdownLint": {
140
139
  "missing_h1": {
141
140
  "description": "There is no h1 in the document",
@@ -132,7 +132,6 @@
132
132
  "Tags": "标签",
133
133
  "Related_Files": "相关文档",
134
134
  "Add_participants": "增加文件参与人",
135
- "Clear_format": "清除格式",
136
135
  "markdownLint": {
137
136
  "missing_h1": {
138
137
  "description": "文档缺少一级标题",
@@ -14,15 +14,13 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
- <glyph glyph-name="-clear-format" unicode="&#59232;" d="M918.4 579.2L640 816c-25.6 22.4-64 22.4-83.2-6.4L112 310.4c-9.6-9.6-16-25.6-16-41.6s9.6-32 22.4-41.6L256 112h326.4l342.4 384c19.2 25.6 19.2 60.8-6.4 83.2z m-384-380.8H300.8L224 268.79999999999995c-6.4 6.4-9.6 9.6-9.6 16s0 16 6.4 22.4l185.6 211.2 233.6-201.6-105.6-118.4zM147.2 41.60000000000002h739.2c32 0 51.2-22.4 51.2-51.2 0-32-22.4-51.2-51.2-51.2H147.2c-32 0-51.2 22.4-51.2 51.2 0 28.8 22.4 51.2 51.2 51.2z" horiz-adv-x="1024" />
17
+ <glyph glyph-name="enlarge" unicode="&#59223;" d="M432 860.8C211.2 860.8 32 681.6 32 460.8s179.2-400 400-400c99.2 0 188.8 35.2 256 92.8l217.6-217.6c19.2-19.2 48-19.2 67.2 0s19.2 48 0 67.2L755.2 224c48 67.2 76.8 147.2 76.8 236.8 0 220.8-179.2 400-400 400z m0-99.2c166.4 0 300.8-134.4 300.8-300.8S598.4 160 432 160s-300.8 134.4-300.8 300.8 134.4 300.8 300.8 300.8z m-3.2-124.8c-25.6 0-48-22.4-48-48v-80H300.8c-25.6 0-48-22.4-48-48s22.4-48 48-48h80v-80c0-25.6 22.4-48 48-48s48 22.4 48 48v80h80c25.6 0 48 22.4 48 48s-22.4 48-48 48h-80V588.8c0 25.6-22.4 48-48 48z" horiz-adv-x="1024" />
18
18
 
19
- <glyph glyph-name="-enlarge" unicode="&#59223;" d="M432 860.8C211.2 860.8 32 681.6 32 460.8s179.2-400 400-400c99.2 0 188.8 35.2 256 92.8l217.6-217.6c19.2-19.2 48-19.2 67.2 0s19.2 48 0 67.2L755.2 224c48 67.2 76.8 147.2 76.8 236.8 0 220.8-179.2 400-400 400z m0-99.2c166.4 0 300.8-134.4 300.8-300.8S598.4 160 432 160s-300.8 134.4-300.8 300.8 134.4 300.8 300.8 300.8z m-3.2-124.8c-25.6 0-48-22.4-48-48v-80H300.8c-25.6 0-48-22.4-48-48s22.4-48 48-48h80v-80c0-25.6 22.4-48 48-48s48 22.4 48 48v80h80c25.6 0 48 22.4 48 48s-22.4 48-48 48h-80V588.8c0 25.6-22.4 48-48 48z" horiz-adv-x="1024" />
19
+ <glyph glyph-name="shrink" unicode="&#59224;" d="M432 860.8C211.2 860.8 32 681.6 32 460.8s179.2-400 400-400c99.2 0 188.8 35.2 256 92.8l217.6-217.6c19.2-19.2 48-19.2 67.2 0s19.2 48 0 67.2L755.2 224c48 67.2 76.8 147.2 76.8 236.8 0 220.8-179.2 400-400 400z m0-99.2c166.4 0 300.8-134.4 300.8-300.8S598.4 160 432 160s-300.8 134.4-300.8 300.8 134.4 300.8 300.8 300.8z m-131.2-252.8c-25.6 0-48-22.4-48-48s22.4-48 48-48h256c25.6 0 48 22.4 48 48s-22.4 48-48 48h-256z" horiz-adv-x="1024" />
20
20
 
21
- <glyph glyph-name="-shrink" unicode="&#59224;" d="M432 860.8C211.2 860.8 32 681.6 32 460.8s179.2-400 400-400c99.2 0 188.8 35.2 256 92.8l217.6-217.6c19.2-19.2 48-19.2 67.2 0s19.2 48 0 67.2L755.2 224c48 67.2 76.8 147.2 76.8 236.8 0 220.8-179.2 400-400 400z m0-99.2c166.4 0 300.8-134.4 300.8-300.8S598.4 160 432 160s-300.8 134.4-300.8 300.8 134.4 300.8 300.8 300.8z m-131.2-252.8c-25.6 0-48-22.4-48-48s22.4-48 48-48h256c25.6 0 48 22.4 48 48s-22.4 48-48 48h-256z" horiz-adv-x="1024" />
21
+ <glyph glyph-name="right" unicode="&#59221;" d="M640 380.8L278.4 742.4c-22.4 19.2-22.4 54.4 0 76.8s57.6 22.4 76.8 0l406.4-400c22.4-22.4 22.4-57.6 0-76.8L355.2-60.8c-22.4-22.4-57.6-22.4-76.8 0s-22.4 57.6 0 76.8L640 380.8z" horiz-adv-x="1024" />
22
22
 
23
- <glyph glyph-name="-right" unicode="&#59221;" d="M640 380.79999999999995L278.4 742.4c-22.4 19.2-22.4 54.4 0 76.8s57.6 22.4 76.8 0l406.4-400c22.4-22.4 22.4-57.6 0-76.8L355.2-60.799999999999955c-22.4-22.4-57.6-22.4-76.8 0s-22.4 57.6 0 76.8L640 380.79999999999995z" horiz-adv-x="1024" />
24
-
25
- <glyph glyph-name="-left" unicode="&#59222;" d="M412.8 380.79999999999995L774.4 742.4c22.4 19.2 22.4 54.4 0 76.8s-57.6 22.4-76.8 0L291.2 419.2c-22.4-22.4-22.4-57.6 0-76.8l406.4-403.2c22.4-22.4 57.6-22.4 76.8 0s22.4 57.6 0 76.8L412.8 380.79999999999995z" horiz-adv-x="1024" />
23
+ <glyph glyph-name="left" unicode="&#59222;" d="M412.8 380.8L774.4 742.4c22.4 19.2 22.4 54.4 0 76.8s-57.6 22.4-76.8 0L291.2 419.2c-22.4-22.4-22.4-57.6 0-76.8l406.4-403.2c22.4-22.4 57.6-22.4 76.8 0s22.4 57.6 0 76.8L412.8 380.8z" horiz-adv-x="1024" />
26
24
 
27
25
  <glyph glyph-name="-formula" unicode="&#59152;" d="M393.6 576.384h89.6v-128h-118.4l-12.8-54.4c-38.4-166.4-54.4-243.2-73.6-307.2-25.6-105.6-105.6-179.2-217.6-179.2h-16c-6.4 0-12.8 6.4-12.8 12.8v92.8c0 9.6 3.2 12.8 12.8 12.8h16c41.6 9.6 67.2 35.2 80 92.8 19.2 64 35.2 140.8 70.4 304l6.4 25.6-172.8-3.2c-6.4 0-12.8 6.4-12.8 12.8v102.4c0 6.4 6.4 12.8 12.8 12.8l198.4 3.2c16 60.8 22.4 89.6 32 128 35.2 137.6 153.6 182.4 326.4 150.4 3.2 0 9.6 0 12.8-3.2 6.4 0 12.8-9.6 9.6-16l-19.2-115.2c0-6.4-9.6-12.8-16-9.6-6.4 0-12.8 3.2-16 3.2-115.2 22.4-137.6 22.4-153.6-41.6-6.4-35.2-16-54.4-25.6-96zM758.4 448.384l140.8 128h83.2c6.4 0 12.8-6.4 12.8-12.8v-105.6c0-6.4-6.4-12.8-12.8-12.8h-25.6l-128-115.2 86.4-124.8h12.8c6.4 0 12.8-6.4 12.8-12.8v-96c0-6.4-6.4-12.8-12.8-12.8h-96l-99.2 144-131.2-144h-92.8c-6.4 0-12.8 6.4-12.8 12.8v96c0 6.4 6.4 12.8 12.8 12.8h19.2l140.8 137.6-70.4 105.6h-124.8v128h204.8l80-128z" horiz-adv-x="1024" />
28
26
 
@@ -1,11 +1,11 @@
1
1
  @font-face {
2
2
  font-family: "iconfont"; /* Project id 1206766 */
3
- src: url('./seafile-editor-font/iconfont.eot?t=1645422890587'); /* IE9 */
4
- src: url('./seafile-editor-font/iconfont.eot?t=1645422890587#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url('./seafile-editor-font/iconfont.woff2?t=1645422890587') format('woff2'),
6
- url('./seafile-editor-font/iconfont.woff?t=1645422890587') format('woff'),
7
- url('./seafile-editor-font/iconfont.ttf?t=1645422890587') format('truetype'),
8
- url('./seafile-editor-font/iconfont.svg?t=1645422890587#iconfont') format('svg');
3
+ src: url('./seafile-editor-font/iconfont.eot?t=1640940881453'); /* IE9 */
4
+ src: url('./seafile-editor-font/iconfont.eot?t=1640940881453#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url('./seafile-editor-font/iconfont.woff2?t=1640940881453') format('woff2'),
6
+ url('./seafile-editor-font/iconfont.woff?t=1640940881453') format('woff'),
7
+ url('./seafile-editor-font/iconfont.ttf?t=1640940881453') format('truetype'),
8
+ url('./seafile-editor-font/iconfont.svg?t=1640940881453#iconfont') format('svg');
9
9
  }
10
10
 
11
11
  .iconfont {
@@ -16,10 +16,6 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
- .icon-clear-format:before {
20
- content: "\e760";
21
- }
22
-
23
19
  .iconenlarge:before {
24
20
  content: "\e757";
25
21
  }
@@ -1,94 +0,0 @@
1
- import { Editor, Path, Node } from 'slate';
2
-
3
- var removeEmptyParentNode = function removeEmptyParentNode(editor, pathRef) {
4
- var path = pathRef.current;
5
- var currentNode = Node.get(editor, path);
6
- var children = currentNode.children;
7
-
8
- while ((children.length === 0 || children.length === 1 && children[0].text === '') && currentNode.type) {
9
- Editor.removeNodes(editor, {
10
- at: path
11
- });
12
- path = Path.parent(path);
13
- currentNode = Node.get(editor, path);
14
- children = currentNode.children;
15
- }
16
-
17
- pathRef.unref();
18
- };
19
-
20
- var clearBlockFormat = function clearBlockFormat(editor) {
21
- // get selected block node, like the paragraphs in the blockquote;
22
- var nodes = Editor.nodes(editor, {
23
- match: 'block',
24
- voids: false
25
- });
26
- var nodesList = [];
27
- var pathRefs = Array.from(nodes, function (item) {
28
- nodesList.push(item);
29
- return Editor.pathRef(editor, item[1]);
30
- });
31
- var firstNode = nodesList[0],
32
- firstNodeRef = pathRefs[0];
33
- nodesList.shift();
34
- pathRefs.shift(); // move first block to outest and set the block to paragraph
35
-
36
- while (firstNodeRef.current.length > 1) {
37
- Editor.liftNodes(editor, {
38
- at: firstNodeRef.current
39
- });
40
- }
41
-
42
- if (firstNode[0].type !== 'paragraph') {
43
- Editor.setNodes(editor, {
44
- type: 'paragraph',
45
- at: firstNodeRef.current,
46
- split: true
47
- });
48
- }
49
-
50
- nodesList.forEach(function (item, index) {
51
- var toPath = index === 0 ? Path.next(firstNodeRef.current) : Path.next(pathRefs[index - 1].current);
52
- var currentPath = pathRefs[index].current;
53
-
54
- if (currentPath.length > 1) {
55
- var parentPath = Path.parent(currentPath);
56
- var parentRef = Editor.pathRef(editor, parentPath); // move current node to outest
57
-
58
- Editor.moveNodes(editor, {
59
- at: currentPath,
60
- to: toPath
61
- }); // remove empty parent node
62
-
63
- removeEmptyParentNode(editor, parentRef);
64
- } // set current block node to paragraph
65
-
66
-
67
- if (item[0].type !== 'paragraph') {
68
- Editor.setNodes(editor, {
69
- type: 'paragraph',
70
- at: currentPath,
71
- split: true
72
- });
73
- }
74
- });
75
- firstNodeRef.unref();
76
- pathRefs.forEach(function (ref) {
77
- return ref.unref();
78
- });
79
- };
80
-
81
- var clearMarkerFormat = function clearMarkerFormat(editor) {
82
- // clear all markers of selected texts;
83
- var textProperties = {
84
- BOLD: false,
85
- ITALIC: false,
86
- CODE: false
87
- };
88
- editor.exec({
89
- type: 'format_text',
90
- properties: textProperties
91
- });
92
- };
93
-
94
- export { clearBlockFormat, clearMarkerFormat };