@seafile/sdoc-editor 0.2.27 → 0.2.29

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 (42) hide show
  1. package/dist/assets/images/content-replaced.png +0 -0
  2. package/dist/basic-sdk/extension/constants/element-type.js +3 -2
  3. package/dist/basic-sdk/extension/constants/index.js +2 -2
  4. package/dist/basic-sdk/extension/plugins/html/helper.js +17 -16
  5. package/dist/basic-sdk/extension/plugins/html/rules/blockquote.js +0 -1
  6. package/dist/basic-sdk/extension/plugins/html/rules/check-list.js +0 -2
  7. package/dist/basic-sdk/extension/plugins/html/rules/code-block.js +0 -10
  8. package/dist/basic-sdk/extension/plugins/html/rules/header.js +0 -1
  9. package/dist/basic-sdk/extension/plugins/html/rules/image.js +0 -1
  10. package/dist/basic-sdk/extension/plugins/html/rules/link.js +0 -2
  11. package/dist/basic-sdk/extension/plugins/html/rules/list.js +3 -9
  12. package/dist/basic-sdk/extension/plugins/html/rules/paragraph.js +0 -1
  13. package/dist/basic-sdk/extension/plugins/html/rules/table.js +0 -3
  14. package/dist/basic-sdk/extension/plugins/html/rules/text.js +0 -7
  15. package/dist/basic-sdk/extension/plugins/list/helpers.js +0 -1
  16. package/dist/basic-sdk/extension/plugins/list/model.js +3 -3
  17. package/dist/basic-sdk/extension/plugins/list/plugin/insert-fragment-list.js +4 -4
  18. package/dist/basic-sdk/extension/plugins/list/plugin/normalize-list.js +2 -13
  19. package/dist/basic-sdk/extension/plugins/list/transforms/insert-list-item.js +13 -11
  20. package/dist/basic-sdk/extension/plugins/list/transforms/move-list-items.js +2 -2
  21. package/dist/basic-sdk/extension/plugins/list/transforms/normalize-list-item.js +7 -7
  22. package/dist/basic-sdk/extension/plugins/list/transforms/toggle-list.js +16 -19
  23. package/dist/basic-sdk/extension/plugins/list/transforms/unwrap-list.js +5 -13
  24. package/dist/basic-sdk/extension/plugins/table/helpers.js +0 -1
  25. package/dist/basic-sdk/extension/render/custom-element.js +14 -14
  26. package/dist/components/doc-operations/revision-operations/more-revision-operations/index.js +1 -2
  27. package/dist/components/doc-operations/tag-operation/tag-popover/index.css +1 -0
  28. package/dist/components/tip-dialog/index.css +44 -0
  29. package/dist/components/tip-dialog/index.js +51 -18
  30. package/dist/constants/index.js +0 -2
  31. package/dist/pages/published-revision-viewer.js +2 -2
  32. package/dist/pages/simple-editor.js +3 -3
  33. package/dist/utils/index.js +1 -32
  34. package/package.json +1 -1
  35. package/public/locales/cs/sdoc-editor.json +1 -1
  36. package/public/locales/de/sdoc-editor.json +1 -1
  37. package/public/locales/en/sdoc-editor.json +1 -2
  38. package/public/locales/es/sdoc-editor.json +1 -1
  39. package/public/locales/fr/sdoc-editor.json +1 -1
  40. package/public/locales/it/sdoc-editor.json +1 -1
  41. package/public/locales/ru/sdoc-editor.json +1 -1
  42. package/public/locales/zh_CN/sdoc-editor.json +1 -1
@@ -11,7 +11,6 @@ export var HEADER6 = 'header6';
11
11
  export var ORDERED_LIST = 'ordered_list';
12
12
  export var UNORDERED_LIST = 'unordered_list';
13
13
  export var LIST_ITEM = 'list_item';
14
- export var LIST_LIC = 'list_lic'; // placeholder
15
14
  export var CHECK_LIST_ITEM = 'check_list_item';
16
15
  export var PARAGRAPH = 'paragraph';
17
16
  export var CODE_BLOCK = 'code_block';
@@ -27,4 +26,6 @@ export var IMAGE = 'image';
27
26
  // font
28
27
  export var FONT_SIZE = 'font-size';
29
28
  export var FONT_SIZE_INCREASE = 'font-size-increase';
30
- export var FONT_SIZE_REDUCE = 'font-size-reduce';
29
+ export var FONT_SIZE_REDUCE = 'font-size-reduce';
30
+ export var TOP_LEVEL_TYPES = [BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, PARAGRAPH, CODE_BLOCK, TABLE];
31
+ export var INLINE_LEVEL_TYPES = [IMAGE, LINK];
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  var _HEADER_TITLE_MAP, _FILE_TYPE;
3
3
  // extension plugin
4
4
  import * as ELEMENT_TYPE from './element-type';
5
- import { BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE } from './element-type';
5
+ import { BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES } from './element-type';
6
6
  export { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BACKGROUND_COLOR } from './color';
7
7
  export { FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE } from './font';
8
8
  export { DIFF_TYPE, ADDED_STYLE, DELETED_STYLE } from './diff-view';
@@ -25,4 +25,4 @@ export var LIST_ITEM_CORRELATION_TYPE = [UNORDERED_LIST, ORDERED_LIST, LIST_ITEM
25
25
  export var LIST_ITEM_SUPPORTED_TRANSFORMATION = [UNORDERED_LIST, ORDERED_LIST, 'left', 'center', 'right', BLOCKQUOTE];
26
26
  export var ADD_POSITION_OFFSET_TYPE = [PARAGRAPH, SUBTITLE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CHECK_LIST_ITEM];
27
27
  export var FILE_TYPE = (_FILE_TYPE = {}, _defineProperty(_FILE_TYPE, FILE_LINK, 'file'), _defineProperty(_FILE_TYPE, SDOC_LINK, 'sdoc'), _FILE_TYPE);
28
- export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE };
28
+ export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES };
@@ -1,6 +1,6 @@
1
1
  import slugid from 'slugid';
2
2
  import typeOf from 'type-of';
3
- import { LIST_ITEM, PARAGRAPH, UNORDERED_LIST } from '../../constants';
3
+ import { INLINE_LEVEL_TYPES, LIST_ITEM, PARAGRAPH, TOP_LEVEL_TYPES, UNORDERED_LIST } from '../../constants';
4
4
  import rules from './rules';
5
5
  var cruftNewline = function cruftNewline(element) {
6
6
  return !(element.nodeName === '#text' && element.nodeValue === '\n');
@@ -74,29 +74,31 @@ var deserializeElements = function deserializeElements() {
74
74
  var formatElementNodes = function formatElementNodes(nodes) {
75
75
  if (nodes.length === 0) return nodes;
76
76
  nodes = nodes.reduce(function (memo, node) {
77
- if (node.level === 'level1') {
77
+ if (TOP_LEVEL_TYPES.includes(node.type)) {
78
78
  memo.push(node);
79
79
  }
80
- if (node.level === 'level2') {
81
- if (node.type === LIST_ITEM) {
82
- var newNode = {
83
- level: 'level1',
84
- id: slugid.nice(),
85
- type: UNORDERED_LIST,
86
- children: [node]
87
- };
88
- memo.push(newNode);
89
- return memo;
90
- }
80
+ if (node.type === LIST_ITEM) {
81
+ var newNode = {
82
+ id: slugid.nice(),
83
+ type: UNORDERED_LIST,
84
+ children: [node]
85
+ };
86
+ memo.push(newNode);
87
+ return memo;
91
88
  }
92
- if (node.level === 'level3') {
89
+
90
+ // The following types will not appear individually during the pasting process
91
+ // code_line
92
+ // table_row | table_cell
93
+
94
+ // text | image | link
95
+ if (!node.type || INLINE_LEVEL_TYPES.includes(node.type)) {
93
96
  var prevNode = memo[memo.length - 1];
94
97
  if (prevNode && prevNode.type === PARAGRAPH) {
95
98
  prevNode.children.push(node);
96
99
  return memo;
97
100
  }
98
101
  var _newNode = {
99
- level: 'level1',
100
102
  id: slugid.nice(),
101
103
  type: PARAGRAPH,
102
104
  children: [node]
@@ -121,7 +123,6 @@ export var deserializeHtml = function deserializeHtml(html) {
121
123
  nodes = formatElementNodes(nodes);
122
124
  if (nodes.length === 0) {
123
125
  nodes = [{
124
- level: 'level1',
125
126
  id: slugid.nice(),
126
127
  type: PARAGRAPH,
127
128
  children: [{
@@ -5,7 +5,6 @@ var blockquoteRule = function blockquoteRule(element, parseChild) {
5
5
  childNodes = element.childNodes;
6
6
  if (nodeName === 'BLOCKQUOTE') {
7
7
  return {
8
- level: 'level1',
9
8
  id: slugid.nice(),
10
9
  type: BLOCKQUOTE,
11
10
  children: parseChild(childNodes)
@@ -4,12 +4,10 @@ var checkListRule = function checkListRule(element, parseChild) {
4
4
  var nodeName = element.nodeName;
5
5
  if (nodeName === 'INPUT' && element.getAttribute('type') === 'checkbox') {
6
6
  return {
7
- level: 'level1',
8
7
  id: slugid.nice(),
9
8
  type: CHECK_LIST_ITEM,
10
9
  checked: element.getAttribute('checked') !== null,
11
10
  children: [{
12
- level: 'level3',
13
11
  id: slugid.nice(),
14
12
  text: ''
15
13
  }]
@@ -15,7 +15,6 @@ var codeBlockRule = function codeBlockRule(element, parseChild) {
15
15
  return item.value === lang;
16
16
  }) || 'plaintext';
17
17
  return {
18
- level: 'level1',
19
18
  id: slugid.nice(),
20
19
  language: lang,
21
20
  type: CODE_BLOCK,
@@ -26,18 +25,15 @@ var codeBlockRule = function codeBlockRule(element, parseChild) {
26
25
  var content = childNodes[0].textContent;
27
26
  var _children = content.split('\n').map(function (text) {
28
27
  return {
29
- level: 'level2',
30
28
  id: slugid.nice(),
31
29
  type: CODE_LINE,
32
30
  children: [{
33
- level: 'level3',
34
31
  id: slugid.nice(),
35
32
  text: text
36
33
  }]
37
34
  };
38
35
  });
39
36
  return {
40
- level: 'level1',
41
37
  id: slugid.nice(),
42
38
  language: _lang,
43
39
  type: CODE_BLOCK,
@@ -52,11 +48,9 @@ var codeBlockRule = function codeBlockRule(element, parseChild) {
52
48
  if (childIsP) {
53
49
  return Array.from(childNodes).map(function (n) {
54
50
  return {
55
- level: 'level2',
56
51
  id: slugid.nice(),
57
52
  type: CODE_LINE,
58
53
  children: [{
59
- level: 'level3',
60
54
  id: slugid.nice(),
61
55
  text: n.textContent
62
56
  }]
@@ -67,11 +61,9 @@ var codeBlockRule = function codeBlockRule(element, parseChild) {
67
61
  var hasNewLine = _content.indexOf('\n') > -1;
68
62
  if (!hasNewLine) {
69
63
  return {
70
- level: 'level2',
71
64
  id: slugid.nice(),
72
65
  type: CODE_LINE,
73
66
  children: [{
74
- level: 'level3',
75
67
  id: slugid.nice(),
76
68
  text: element.textContent
77
69
  }]
@@ -80,11 +72,9 @@ var codeBlockRule = function codeBlockRule(element, parseChild) {
80
72
  var codes = _content.split('\n');
81
73
  return codes.map(function (item) {
82
74
  return {
83
- level: 'level2',
84
75
  id: slugid.nice(),
85
76
  type: CODE_LINE,
86
77
  children: [{
87
- level: 'level3',
88
78
  id: slugid.nice(),
89
79
  text: item
90
80
  }]
@@ -13,7 +13,6 @@ var headerRule = function headerRule(element, parseChild) {
13
13
  childNodes = element.childNodes;
14
14
  if (nodeName && HEADER_LIST.includes(nodeName)) {
15
15
  return {
16
- level: 'level1',
17
16
  id: slugid.nice(),
18
17
  type: HEADER_TYPE_MAP[nodeName],
19
18
  children: parseChild(childNodes)
@@ -4,7 +4,6 @@ var imageRule = function imageRule(element, parseChild) {
4
4
  var nodeName = element.nodeName;
5
5
  if (nodeName === 'IMG') {
6
6
  return {
7
- level: 'level3',
8
7
  id: slugid.nice(),
9
8
  type: IMAGE,
10
9
  data: {
@@ -5,13 +5,11 @@ var linkRule = function linkRule(element, parseChild) {
5
5
  var content = element.textContent || element.getAttribute('title') || element.getAttribute('href');
6
6
  if (nodeName === 'A') {
7
7
  return {
8
- level: 'level3',
9
8
  id: slugid.nice(),
10
9
  type: LINK,
11
10
  href: element.getAttribute('href'),
12
11
  title: element.getAttribute('title'),
13
12
  children: [{
14
- level: 'level3',
15
13
  id: slugid.nice(),
16
14
  text: content
17
15
  }]
@@ -1,12 +1,11 @@
1
1
  import slugid from 'slugid';
2
- import { LIST_ITEM, LIST_LIC, ORDERED_LIST, UNORDERED_LIST } from '../../../constants';
2
+ import { LIST_ITEM, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST } from '../../../constants';
3
3
  var PARAGRAPH_TAGS = ['DIV', 'P'];
4
4
  var listRule = function listRule(element, parseChild) {
5
5
  var nodeName = element.nodeName,
6
6
  childNodes = element.childNodes;
7
7
  if (nodeName === 'UL') {
8
8
  return {
9
- level: 'level1',
10
9
  id: slugid.nice(),
11
10
  type: UNORDERED_LIST,
12
11
  children: parseChild(childNodes)
@@ -14,7 +13,6 @@ var listRule = function listRule(element, parseChild) {
14
13
  }
15
14
  if (nodeName === 'OL') {
16
15
  return {
17
- level: 'level1',
18
16
  id: slugid.nice(),
19
17
  type: ORDERED_LIST,
20
18
  children: parseChild(childNodes)
@@ -22,7 +20,6 @@ var listRule = function listRule(element, parseChild) {
22
20
  }
23
21
  if (nodeName === 'LI' && PARAGRAPH_TAGS.includes(element.firstChild.nodeName)) {
24
22
  return {
25
- level: 'level2',
26
23
  id: slugid.nice(),
27
24
  type: LIST_ITEM,
28
25
  children: parseChild(childNodes)
@@ -30,22 +27,19 @@ var listRule = function listRule(element, parseChild) {
30
27
  }
31
28
  if (nodeName === 'LI' && !PARAGRAPH_TAGS.includes(element.firstChild.nodeName)) {
32
29
  return {
33
- level: 'level2',
34
30
  id: slugid.nice(),
35
31
  type: LIST_ITEM,
36
32
  children: [{
37
33
  id: slugid.nice(),
38
- level: 'level3',
39
- type: LIST_LIC,
34
+ type: PARAGRAPH,
40
35
  children: parseChild(childNodes)
41
36
  }]
42
37
  };
43
38
  }
44
39
  if (PARAGRAPH_TAGS.includes(nodeName) && element.parentElement.nodeName === 'LI') {
45
40
  return {
46
- level: 'level3',
47
41
  id: slugid.nice(),
48
- type: LIST_LIC,
42
+ type: PARAGRAPH,
49
43
  children: parseChild(childNodes)
50
44
  };
51
45
  }
@@ -5,7 +5,6 @@ var paragraphRule = function paragraphRule(element, parseChild) {
5
5
  childNodes = element.childNodes;
6
6
  if (nodeName === 'P' && element.parentElement.nodeName !== 'LI') {
7
7
  return {
8
- level: 'level1',
9
8
  id: slugid.nice(),
10
9
  type: PARAGRAPH,
11
10
  children: parseChild(childNodes)
@@ -5,7 +5,6 @@ var tableRule = function tableRule(element, parseChild) {
5
5
  childNodes = element.childNodes;
6
6
  if (nodeName === 'TABLE') {
7
7
  return {
8
- level: 'level1',
9
8
  id: slugid.nice(),
10
9
  type: TABLE,
11
10
  children: parseChild(childNodes)
@@ -16,7 +15,6 @@ var tableRule = function tableRule(element, parseChild) {
16
15
  }
17
16
  if (nodeName === 'TR') {
18
17
  return {
19
- level: 'level2',
20
18
  id: slugid.nice(),
21
19
  type: TABLE_ROW,
22
20
  children: parseChild(childNodes)
@@ -24,7 +22,6 @@ var tableRule = function tableRule(element, parseChild) {
24
22
  }
25
23
  if (nodeName === 'TH' || nodeName === 'TD') {
26
24
  return {
27
- level: 'level3',
28
25
  id: slugid.nice(),
29
26
  type: TABLE_CELL,
30
27
  children: parseChild(childNodes)
@@ -4,14 +4,12 @@ var textRule = function textRule(element, parseChild) {
4
4
  nodeType = element.nodeType;
5
5
  if (nodeName === 'SPAN') {
6
6
  return {
7
- level: 'level3',
8
7
  id: slugid.nice(),
9
8
  text: element.textContent
10
9
  };
11
10
  }
12
11
  if (nodeName === 'STRONG' || nodeName === 'B') {
13
12
  return {
14
- level: 'level3',
15
13
  id: slugid.nice(),
16
14
  bold: true,
17
15
  text: element.textContent
@@ -19,7 +17,6 @@ var textRule = function textRule(element, parseChild) {
19
17
  }
20
18
  if (nodeName === 'CODE' && element.parentElement.nodeName !== 'PRE') {
21
19
  return {
22
- level: 'level3',
23
20
  id: slugid.nice(),
24
21
  code: true,
25
22
  text: element.textContent
@@ -27,7 +24,6 @@ var textRule = function textRule(element, parseChild) {
27
24
  }
28
25
  if (nodeName === 'DEL') {
29
26
  return {
30
- level: 'level3',
31
27
  id: slugid.nice(),
32
28
  delete: true,
33
29
  text: element.textContent
@@ -35,7 +31,6 @@ var textRule = function textRule(element, parseChild) {
35
31
  }
36
32
  if (nodeName === 'I') {
37
33
  return {
38
- level: 'level3',
39
34
  id: slugid.nice(),
40
35
  italic: true,
41
36
  text: element.textContent
@@ -43,7 +38,6 @@ var textRule = function textRule(element, parseChild) {
43
38
  }
44
39
  if (nodeName === 'INS') {
45
40
  return {
46
- level: 'level3',
47
41
  id: slugid.nice(),
48
42
  add: true,
49
43
  text: element.textContent
@@ -51,7 +45,6 @@ var textRule = function textRule(element, parseChild) {
51
45
  }
52
46
  if (nodeType === 3) {
53
47
  return {
54
- level: 'level3',
55
48
  id: slugid.nice(),
56
49
  text: element.textContent
57
50
  };
@@ -2,7 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
3
  import { Editor, Element, Node, Range, Text } from '@seafile/slate';
4
4
  import { CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, LIST_ITEM, PARAGRAPH, TABLE } from '../../constants';
5
- import { isRangeAcrossBlocks } from '../../core';
6
5
  import { toggleList } from './transforms';
7
6
  import { getListTypes } from './queries';
8
7
  export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
@@ -1,7 +1,7 @@
1
1
  import _createClass from "@babel/runtime/helpers/esm/createClass";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import slugid from 'slugid';
4
- import { LIST_ITEM, LIST_LIC, UNORDERED_LIST } from '../../constants';
4
+ import { LIST_ITEM, PARAGRAPH, UNORDERED_LIST } from '../../constants';
5
5
  import { generateEmptyElement } from '../../core';
6
6
  var List = /*#__PURE__*/_createClass(function List(options) {
7
7
  _classCallCheck(this, List);
@@ -18,8 +18,8 @@ export var generateEmptyListItem = function generateEmptyListItem() {
18
18
  children: []
19
19
  };
20
20
  };
21
- export var generateEmptyListLic = function generateEmptyListLic() {
22
- return generateEmptyElement(LIST_LIC);
21
+ export var generateEmptyListContent = function generateEmptyListContent() {
22
+ return generateEmptyElement(PARAGRAPH);
23
23
  };
24
24
  export var generateEmptyList = function generateEmptyList(type) {
25
25
  return {
@@ -3,7 +3,7 @@ import _toArray from "@babel/runtime/helpers/esm/toArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import { Element, Path, Transforms, Node, Editor } from '@seafile/slate';
5
5
  import slugid from 'slugid';
6
- import { LIST_ITEM, LIST_LIC } from '../../../constants';
6
+ import { LIST_ITEM, PARAGRAPH } from '../../../constants';
7
7
  import { findNode, generateDefaultText, getCommonNode, getNode, getNodes } from '../../../core';
8
8
  import { getListTypes } from '../queries';
9
9
  var isListRoot = function isListRoot(node) {
@@ -20,7 +20,7 @@ var getFirstAncestorOfType = function getFirstAncestorOfType(root, entry, _ref)
20
20
  var findListItemsWithContent = function findListItemsWithContent(first) {
21
21
  var prev = null;
22
22
  var node = first;
23
- while (isListRoot(node) || node.type === LIST_ITEM && node.children[0].type !== LIST_LIC) {
23
+ while (isListRoot(node) || node.type === LIST_ITEM && node.children[0].type !== PARAGRAPH) {
24
24
  prev = node;
25
25
  var _node$children = _slicedToArray(node.children, 1);
26
26
  node = _node$children[0];
@@ -63,7 +63,7 @@ var isSingleLic = function isSingleLic(fragment) {
63
63
  }).filter(function (_ref4) {
64
64
  var _ref5 = _slicedToArray(_ref4, 1),
65
65
  node = _ref5[0];
66
- return node.type === LIST_LIC;
66
+ return node.type === PARAGRAPH;
67
67
  }).length === 1;
68
68
  };
69
69
  export var getTextAndListItemNodes = function getTextAndListItemNodes(editor, fragment, liEntry, licEntry) {
@@ -159,7 +159,7 @@ export var insertFragmentList = function insertFragmentList(editor) {
159
159
  });
160
160
  var licEntry = findNode(editor, {
161
161
  match: {
162
- type: LIST_LIC
162
+ type: PARAGRAPH
163
163
  },
164
164
  mode: 'lowest'
165
165
  });
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { Node, Element, Transforms, Path } from '@seafile/slate';
3
- import { LIST_ITEM, LIST_LIC, PARAGRAPH } from '../../../constants';
2
+ import { Element, Transforms, Path } from '@seafile/slate';
3
+ import { LIST_ITEM } from '../../../constants';
4
4
  import { getChildren, getNode, getPreviousPath, match } from '../../../core';
5
5
  import { getListTypes } from '../queries';
6
6
  import { moveListItemsToList, normalizeListItem, normalizeNestedList } from '../transforms';
@@ -71,17 +71,6 @@ export var normalizeList = function normalizeList(editor) {
71
71
  return;
72
72
  }
73
73
  }
74
- if (node.type === LIST_LIC && LIST_LIC !== PARAGRAPH) {
75
- var _node = Node.parent(editor, path);
76
- if ((_node === null || _node === void 0 ? void 0 : _node.type) !== LIST_ITEM) {
77
- Transforms.setNodes(editor, {
78
- type: PARAGRAPH
79
- }, {
80
- at: path
81
- });
82
- return;
83
- }
84
- }
85
74
  normalizeNode([node, path]);
86
75
  };
87
76
  };
@@ -1,18 +1,20 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import { Transforms, Editor, Path, Range } from '@seafile/slate';
4
- import { LIST_ITEM, LIST_LIC } from '../../../constants';
4
+ import { LIST_ITEM, PARAGRAPH } from '../../../constants';
5
5
  import { getAboveNode, isBlockTextEmptyAfterSelection, isStartPoint } from '../../../core';
6
- import { generateEmptyListItem, generateEmptyListLic } from '../model';
6
+ import { generateEmptyListContent, generateEmptyListItem } from '../model';
7
+
8
+ // list > list_item > paragraph
7
9
  export var insertListItem = function insertListItem(editor) {
8
- var licEntry = getAboveNode(editor, {
10
+ var paragraphEntry = getAboveNode(editor, {
9
11
  match: {
10
- type: LIST_LIC
12
+ type: PARAGRAPH
11
13
  }
12
14
  });
13
- if (!licEntry) return false;
14
- var _licEntry = _slicedToArray(licEntry, 2),
15
- paragraphPath = _licEntry[1];
15
+ if (!paragraphEntry) return false;
16
+ var _paragraphEntry = _slicedToArray(paragraphEntry, 2),
17
+ paragraphPath = _paragraphEntry[1];
16
18
  var listItemEntry = Editor.parent(editor, paragraphPath);
17
19
  if (!listItemEntry) return false;
18
20
  var _listItemEntry = _slicedToArray(listItemEntry, 2),
@@ -34,8 +36,8 @@ export var insertListItem = function insertListItem(editor) {
34
36
  var nextListItemPath = Path.next(listItemPath);
35
37
  if (_isStartPoint) {
36
38
  // listItem 有内容,光标在开始
37
- var licItem = generateEmptyListLic();
38
- Transforms.insertNodes(editor, licItem, {
39
+ var itemContent = generateEmptyListContent();
40
+ Transforms.insertNodes(editor, itemContent, {
39
41
  at: listItemPath
40
42
  });
41
43
  var listItem = generateEmptyListItem();
@@ -65,8 +67,8 @@ export var insertListItem = function insertListItem(editor) {
65
67
  var _Editor$marks;
66
68
  // listItem 有内容,光标在结尾
67
69
  var marks = (_Editor$marks = Editor.marks(editor)) === null || _Editor$marks === void 0 ? void 0 : _Editor$marks.key;
68
- var _licItem = generateEmptyListLic();
69
- Transforms.insertNodes(editor, _objectSpread(_objectSpread({}, _licItem), marks), {
70
+ var _itemContent = generateEmptyListContent();
71
+ Transforms.insertNodes(editor, _objectSpread(_objectSpread({}, _itemContent), marks), {
70
72
  at: nextListItemPath
71
73
  });
72
74
  var _listItem2 = generateEmptyListItem();
@@ -1,5 +1,5 @@
1
1
  import { Editor, Path } from '@seafile/slate';
2
- import { LIST_LIC } from '../../../constants';
2
+ import { PARAGRAPH } from '../../../constants';
3
3
  import { getNodeEntries } from '../../../core';
4
4
  import { isListNested } from '../queries';
5
5
  import { movedListItemDown } from './move-list-item-down';
@@ -15,7 +15,7 @@ export var moveListItems = function moveListItems(editor) {
15
15
  var _nodes = getNodeEntries(editor, {
16
16
  at: at,
17
17
  match: {
18
- type: [LIST_LIC]
18
+ type: [PARAGRAPH]
19
19
  }
20
20
  });
21
21
  var lics = Array.from(_nodes);
@@ -2,15 +2,15 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
4
  import { Transforms, Editor, Path, Element } from '@seafile/slate';
5
- import { LIST_LIC } from '../../../constants';
5
+ import { PARAGRAPH } from '../../../constants';
6
6
  import { getChildren, getDeepInlineChildren, match } from '../../../core';
7
7
  import { getListTypes } from '../queries';
8
8
  import { movedListItemUp } from './move-list-item-up';
9
- import { generateEmptyListLic } from '../model';
9
+ import { generateEmptyListContent } from '../model';
10
10
  export var normalizeListItem = function normalizeListItem(editor, _ref) {
11
11
  var listItem = _ref.listItem;
12
12
  var changed = false;
13
- var validLiChildrenTypes = [].concat(_toConsumableArray(getListTypes()), [LIST_LIC]);
13
+ var validLiChildrenTypes = [].concat(_toConsumableArray(getListTypes()), [PARAGRAPH]);
14
14
  var _listItem = _slicedToArray(listItem, 2),
15
15
  liPath = _listItem[1];
16
16
  var liChildren = getChildren(listItem);
@@ -29,14 +29,14 @@ export var normalizeListItem = function normalizeListItem(editor, _ref) {
29
29
  firstLiChildNode = _ref7[0],
30
30
  firstLiChildPath = _ref7[1];
31
31
  if (!firstLiChild || !Editor.isBlock(editor, firstLiChildNode)) {
32
- var emptyLic = generateEmptyListLic();
33
- Transforms.insertNodes(editor, emptyLic, {
32
+ var itemContent = generateEmptyListContent();
33
+ Transforms.insertNodes(editor, itemContent, {
34
34
  at: liPath.concat([0])
35
35
  });
36
36
  return true;
37
37
  }
38
38
  if (Editor.isBlock(editor, firstLiChildNode) && !match(firstLiChildNode, [], {
39
- type: [LIST_LIC]
39
+ type: [PARAGRAPH]
40
40
  })) {
41
41
  if (match(firstLiChildNode, [], {
42
42
  type: getListTypes()
@@ -59,7 +59,7 @@ export var normalizeListItem = function normalizeListItem(editor, _ref) {
59
59
  return true;
60
60
  }
61
61
  Transforms.setNodes(editor, {
62
- type: LIST_LIC
62
+ type: PARAGRAPH
63
63
  }, {
64
64
  at: firstLiChildPath
65
65
  });
@@ -1,25 +1,23 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import { Node, Range, Transforms, Element, Editor } from '@seafile/slate';
4
- import { LIST_ITEM, LIST_LIC, PARAGRAPH, INSERT_POSITION } from '../../../constants';
5
- import { findNode, getNodeEntries, getNodeType, getSelectedNodeEntryByType, isRangeAcrossBlocks, generateEmptyElement } from '../../../core';
4
+ import { LIST_ITEM, PARAGRAPH, INSERT_POSITION } from '../../../constants';
5
+ import { findNode, getNodeEntries, getNodeType, getSelectedNodeEntryByType, isRangeAcrossBlocks } from '../../../core';
6
6
  import { getListItemEntry, getListTypes } from '../queries';
7
7
  import { unwrapList } from './unwrap-list';
8
- import { generateEmptyList, generateEmptyListItem } from '../model';
8
+ import { generateEmptyList, generateEmptyListContent, generateEmptyListItem } from '../model';
9
9
  var wrapLineList = function wrapLineList(editor, type) {
10
10
  var list = generateEmptyList(type);
11
11
  Transforms.wrapNodes(editor, list);
12
12
  var nodeEntry = getSelectedNodeEntryByType(editor, PARAGRAPH);
13
13
  if (!nodeEntry) return;
14
+
15
+ // select is paragraph
16
+ // 1 handle paragraph
17
+
18
+ // 2 wrap list_item
14
19
  var _nodeEntry = _slicedToArray(nodeEntry, 2),
15
- node = _nodeEntry[0],
16
20
  path = _nodeEntry[1];
17
- if (node.type !== LIST_LIC) {
18
- // paragraph to list-lic
19
- Transforms.setNodes(editor, {
20
- type: LIST_LIC
21
- });
22
- }
23
21
  var listItem = generateEmptyListItem();
24
22
  Transforms.wrapNodes(editor, listItem, {
25
23
  at: path
@@ -91,17 +89,16 @@ var wrapRangeList = function wrapRangeList(editor, type) {
91
89
  mode: 'all'
92
90
  });
93
91
  } else {
94
- if (![LIST_LIC].includes(n[0].type)) {
95
- Transforms.setNodes(editor, {
96
- type: LIST_LIC
97
- }, {
98
- at: n[1]
99
- });
100
- }
92
+ // select content is paragraph
93
+ // 1 handle content
94
+
95
+ // 2. wrap list_item
101
96
  var listItem = generateEmptyListItem();
102
97
  Transforms.wrapNodes(editor, listItem, {
103
98
  at: n[1]
104
99
  });
100
+
101
+ // 3. wrap list
105
102
  var list = generateEmptyList(type);
106
103
  Transforms.wrapNodes(editor, list, {
107
104
  at: n[1]
@@ -113,9 +110,9 @@ var wrapRangeList = function wrapRangeList(editor, type) {
113
110
  var toggleList = function toggleList(editor, type, insertPosition) {
114
111
  if (insertPosition === INSERT_POSITION.AFTER) {
115
112
  var list = generateEmptyList(type);
116
- var p = generateEmptyElement(PARAGRAPH);
113
+ var listContent = generateEmptyListContent();
117
114
  var path = Editor.path(editor, editor.selection);
118
- Transforms.insertNodes(editor, p, {
115
+ Transforms.insertNodes(editor, listContent, {
119
116
  at: [path[0] + 1]
120
117
  });
121
118
  Transforms.select(editor, [path[0] + 1]);
@@ -1,6 +1,6 @@
1
1
  import { Editor, Transforms, Element, Node } from '@seafile/slate';
2
- import { LIST_ITEM, LIST_LIC, PARAGRAPH } from '../../../constants';
3
- import { getAboveBlockNode, getAboveNode, getNodeType } from '../../../core';
2
+ import { LIST_ITEM } from '../../../constants';
3
+ import { getAboveNode, getNodeType } from '../../../core';
4
4
  import { getListTypes } from '../queries';
5
5
  export var unwrapList = function unwrapList(editor) {
6
6
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
@@ -25,17 +25,7 @@ export var unwrapList = function unwrapList(editor) {
25
25
  };
26
26
  Editor.withoutNormalizing(editor, function () {
27
27
  do {
28
- var licEntry = getAboveBlockNode(editor, {
29
- at: at,
30
- match: {
31
- type: LIST_LIC
32
- }
33
- });
34
- if (licEntry) {
35
- Transforms.setNodes(editor, {
36
- type: PARAGRAPH
37
- });
38
- }
28
+ // unwrap list_item
39
29
  Transforms.unwrapNodes(editor, {
40
30
  at: at,
41
31
  match: function match(n) {
@@ -43,6 +33,8 @@ export var unwrapList = function unwrapList(editor) {
43
33
  },
44
34
  split: true
45
35
  });
36
+
37
+ // unwrap list
46
38
  Transforms.unwrapNodes(editor, {
47
39
  at: at,
48
40
  match: function match(n) {
@@ -31,7 +31,6 @@ export var isTableMenuDisabled = function isTableMenuDisabled(editor, readonly)
31
31
  if (type === ELEMENT_TYPE.UNORDERED_LIST) return true;
32
32
  if (type === ELEMENT_TYPE.BLOCKQUOTE) return true;
33
33
  if (type === ELEMENT_TYPE.LIST_ITEM) return true;
34
- if (type === ELEMENT_TYPE.LIST_LIC) return true;
35
34
  if (type === ELEMENT_TYPE.TABLE) return true;
36
35
  if (type === ELEMENT_TYPE.TABLE_CELL) return true;
37
36
  if (type === ELEMENT_TYPE.TABLE_ROW) return true;
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import { useCallback } from 'react';
4
4
  import { useSlateStatic } from '@seafile/slate-react';
5
- import { BLOCKQUOTE, LINK, CHECK_LIST_ITEM, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, LIST_ITEM, LIST_LIC, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, CODE_LINE, IMAGE, ELEMENT_TYPE, SDOC_LINK, FILE_LINK, TITLE, SUBTITLE } from '../constants';
5
+ import { BLOCKQUOTE, LINK, CHECK_LIST_ITEM, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, LIST_ITEM, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, CODE_LINE, IMAGE, ELEMENT_TYPE, SDOC_LINK, FILE_LINK, TITLE, SUBTITLE } from '../constants';
6
6
  import { BlockquotePlugin, LinkPlugin, CheckListPlugin, HeaderPlugin, ListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin } from '../plugins';
7
7
  import EventBus from '../../utils/event-bus';
8
8
  import { INTERNAL_EVENT } from '../../constants';
@@ -19,9 +19,15 @@ var CustomRenderElement = function CustomRenderElement(props) {
19
19
  switch (element.type) {
20
20
  case PARAGRAPH:
21
21
  {
22
+ var parentNode = getParentNode(editor.children, element.id);
23
+ if (parentNode && parentNode.type === LIST_ITEM) {
24
+ var _ParagraphPlugin$rend = _slicedToArray(ParagraphPlugin.renderElements, 1),
25
+ _renderParagraph = _ParagraphPlugin$rend[0];
26
+ return _renderParagraph(props);
27
+ }
22
28
  attributes['onMouseEnter'] = onMouseEnter;
23
- var _ParagraphPlugin$rend = _slicedToArray(ParagraphPlugin.renderElements, 1),
24
- renderParagraph = _ParagraphPlugin$rend[0];
29
+ var _ParagraphPlugin$rend2 = _slicedToArray(ParagraphPlugin.renderElements, 1),
30
+ renderParagraph = _ParagraphPlugin$rend2[0];
25
31
  return renderParagraph(props);
26
32
  }
27
33
  case TITLE:
@@ -76,12 +82,6 @@ var CustomRenderElement = function CustomRenderElement(props) {
76
82
  renderListItem = _ListPlugin$renderEle2[1];
77
83
  return renderListItem(props, editor);
78
84
  }
79
- case LIST_LIC:
80
- {
81
- var _ListPlugin$renderEle3 = _slicedToArray(ListPlugin.renderElements, 3),
82
- renderListLic = _ListPlugin$renderEle3[2];
83
- return renderListLic(props, editor);
84
- }
85
85
  case CHECK_LIST_ITEM:
86
86
  {
87
87
  attributes['onMouseEnter'] = onMouseEnter;
@@ -105,8 +105,8 @@ var CustomRenderElement = function CustomRenderElement(props) {
105
105
  case IMAGE:
106
106
  {
107
107
  var _editor$element_comme;
108
- var parentNode = getParentNode(editor.children, element.id);
109
- var comments = ((_editor$element_comme = editor.element_comments_map) === null || _editor$element_comme === void 0 ? void 0 : _editor$element_comme[parentNode.id]) || [];
108
+ var _parentNode = getParentNode(editor.children, element.id);
109
+ var comments = ((_editor$element_comme = editor.element_comments_map) === null || _editor$element_comme === void 0 ? void 0 : _editor$element_comme[_parentNode.id]) || [];
110
110
  var unresolvedComments = comments && comments.filter(function (item) {
111
111
  return !item.resolved;
112
112
  });
@@ -153,9 +153,9 @@ var CustomRenderElement = function CustomRenderElement(props) {
153
153
  }
154
154
  default:
155
155
  {
156
- var _ParagraphPlugin$rend2 = _slicedToArray(ParagraphPlugin.renderElements, 1),
157
- _renderParagraph = _ParagraphPlugin$rend2[0];
158
- return _renderParagraph(props);
156
+ var _ParagraphPlugin$rend3 = _slicedToArray(ParagraphPlugin.renderElements, 1),
157
+ _renderParagraph2 = _ParagraphPlugin$rend3[0];
158
+ return _renderParagraph2(props);
159
159
  }
160
160
  }
161
161
  };
@@ -4,7 +4,6 @@ import { withTranslation } from 'react-i18next';
4
4
  import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
5
5
  import context from '../../../../context';
6
6
  import toaster from '../../../toast';
7
- import { REVISION_FIRST_LOAD_KEY, REVISION_FIRST_LOAD_VALUE } from '../../../../constants';
8
7
  import './index.css';
9
8
  var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
10
9
  var t = _ref.t;
@@ -19,7 +18,7 @@ var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
19
18
  context.startRevise().then(function (res) {
20
19
  var repoID = context.getSetting('repoID');
21
20
  var siteRoot = context.getSetting('siteRoot');
22
- var revisionURL = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(res.data.revision_id, "/?").concat(REVISION_FIRST_LOAD_KEY, "=").concat(REVISION_FIRST_LOAD_VALUE);
21
+ var revisionURL = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(res.data.revision_id, "/");
23
22
  window.open(revisionURL, '_blank');
24
23
  }).catch(function (error) {
25
24
  toaster.danger(t('Error'));
@@ -41,6 +41,7 @@
41
41
  text-overflow: ellipsis;
42
42
  overflow: hidden;
43
43
  font-size: 13px;
44
+ font-weight: normal;
44
45
  }
45
46
 
46
47
  .sdoc-tag-item .sdoc-tag-added-mark {
@@ -2,3 +2,47 @@
2
2
  background-color: #FF8000;
3
3
  border-color: #FF8000;
4
4
  }
5
+
6
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ padding-top: 46px;
11
+ padding-bottom: 40px;
12
+ }
13
+
14
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container .sdoc-tip-img-container {
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ width: 140px;
19
+ height: 140px;
20
+ overflow: hidden;
21
+ }
22
+
23
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container .sdoc-tip-content {
24
+ width: 100%;
25
+ padding: 10px 16px 64px 16px;
26
+ text-align: center;
27
+ }
28
+
29
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container .sdoc-tip-operation-btn {
30
+ min-width: 140px;
31
+ }
32
+
33
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container.publishing {
34
+ padding: 2rem;
35
+ height: 180px;
36
+ justify-content: center;
37
+ }
38
+
39
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container.publishing .common-loading-tip {
40
+ width: 30px;
41
+ height: 30px;
42
+ border-width: 4px;
43
+ }
44
+
45
+ .sdoc-tip-dialog .sdoc-tip-dialog-custom-container.publishing .sdoc-tip-content {
46
+ margin-top: 8px;
47
+ padding: 0;
48
+ }
@@ -5,6 +5,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
5
5
  import classnames from 'classnames';
6
6
  import { TIP_TYPE, TIP_TITLE, TIP_CONTENT } from '../../constants';
7
7
  import CommonLoading from '../common-loading';
8
+ import ContentReplaced from '../../assets/images/content-replaced.png';
8
9
  import './index.css';
9
10
  var NOT_CLOSE_DIALOG_TIP_TYPE = [TIP_TYPE.HAS_BEEN_REPLACED, TIP_TYPE.HAS_BEEN_PUBLISHED, TIP_TYPE.CHECKING, TIP_TYPE.PUBLISHING];
10
11
  var TipDialog = function TipDialog(_ref) {
@@ -45,6 +46,55 @@ var TipDialog = function TipDialog(_ref) {
45
46
  };
46
47
  }
47
48
  }, [isSubmitting]);
49
+ var refreshPage = useCallback(function () {
50
+ window.location.reload();
51
+ }, []);
52
+ var renderTip = useCallback(function () {
53
+ if (tipType === TIP_TYPE.HAS_BEEN_REPLACED) {
54
+ return /*#__PURE__*/React.createElement("div", {
55
+ className: "sdoc-tip-dialog-custom-container"
56
+ }, /*#__PURE__*/React.createElement("div", {
57
+ className: "sdoc-tip-img-container"
58
+ }, /*#__PURE__*/React.createElement("img", {
59
+ src: ContentReplaced,
60
+ alt: "",
61
+ height: "140"
62
+ })), /*#__PURE__*/React.createElement("div", {
63
+ className: "sdoc-tip-content"
64
+ }, t(TIP_CONTENT[tipType])), /*#__PURE__*/React.createElement("div", {
65
+ className: "sdoc-tip-operations-container"
66
+ }, /*#__PURE__*/React.createElement(Button, {
67
+ color: "primary",
68
+ className: "highlight-bg-color sdoc-tip-operation-btn",
69
+ onClick: refreshPage
70
+ }, t('Refresh'))));
71
+ }
72
+ if (tipType === TIP_TYPE.PUBLISHING) {
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ className: "sdoc-tip-dialog-custom-container publishing"
75
+ }, /*#__PURE__*/React.createElement(CommonLoading, null), /*#__PURE__*/React.createElement("div", {
76
+ className: "sdoc-tip-content"
77
+ }, t(TIP_CONTENT[tipType])));
78
+ }
79
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalHeader, {
80
+ toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
81
+ }, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
82
+ className: "sdoc-tip-body"
83
+ }, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]))), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
84
+ color: "secondary",
85
+ className: "mr-2",
86
+ onClick: closeDialog
87
+ }, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
88
+ color: "primary",
89
+ className: classnames('highlight-bg-color', {
90
+ 'd-flex align-items-center': isSubmitting
91
+ }),
92
+ disabled: isSubmitting,
93
+ onClick: onSubmit
94
+ }, isSubmitting && /*#__PURE__*/React.createElement("span", {
95
+ className: "submit-loading-container mr-2"
96
+ }, /*#__PURE__*/React.createElement(CommonLoading, null)), t('Confirm'))));
97
+ }, [children, closeDialog, isSubmitting, onSubmit, t, tipType, refreshPage]);
48
98
  return /*#__PURE__*/React.createElement(Modal, {
49
99
  isOpen: true,
50
100
  autoFocus: false,
@@ -53,23 +103,6 @@ var TipDialog = function TipDialog(_ref) {
53
103
  toggle: closeDialog,
54
104
  className: classnames('sdoc-tip-dialog', className),
55
105
  contentClassName: "sdoc-tip-modal"
56
- }, /*#__PURE__*/React.createElement(ModalHeader, {
57
- toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
58
- }, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
59
- className: "sdoc-tip-body"
60
- }, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]))), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
61
- color: "secondary",
62
- className: "mr-2",
63
- onClick: closeDialog
64
- }, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
65
- color: "primary",
66
- className: classnames('highlight-bg-color', {
67
- 'd-flex align-items-center': isSubmitting
68
- }),
69
- disabled: isSubmitting,
70
- onClick: onSubmit
71
- }, isSubmitting && /*#__PURE__*/React.createElement("span", {
72
- className: "submit-loading-container mr-2"
73
- }, /*#__PURE__*/React.createElement(CommonLoading, null)), t('Confirm'))));
106
+ }, renderTip());
74
107
  };
75
108
  export default TipDialog;
@@ -2,8 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  var _TIP_TITLE, _TIP_CONTENT;
3
3
  import KeyCodes from './key-codes';
4
4
  import * as TransferTypes from './transfer-types';
5
- export var REVISION_FIRST_LOAD_KEY = 'first-load';
6
- export var REVISION_FIRST_LOAD_VALUE = '1';
7
5
  export var EXTERNAL_EVENT = {
8
6
  INTERNAL_LINK_CLICK: 'internal_link_click',
9
7
  TOGGLE_STAR: 'toggle_star',
@@ -8,7 +8,7 @@ import Layout, { Header, Content } from '../layout';
8
8
  import context from '../context';
9
9
  import ErrorBoundary from './error-boundary';
10
10
  import { PublishedRevisionDiffViewer } from '../basic-sdk';
11
- import { resetWebTitleAndURL } from '../utils';
11
+ import { resetWebTitle } from '../utils';
12
12
  import '../assets/css/simple-editor.css';
13
13
  var PublishedRevisionViewer = function PublishedRevisionViewer() {
14
14
  context.initApi();
@@ -37,7 +37,7 @@ var PublishedRevisionViewer = function PublishedRevisionViewer() {
37
37
 
38
38
  // useMount: reset title
39
39
  useEffect(function () {
40
- resetWebTitleAndURL(t);
40
+ resetWebTitle(t);
41
41
  // eslint-disable-next-line react-hooks/exhaustive-deps
42
42
  }, []);
43
43
  useEffect(function () {
@@ -10,7 +10,7 @@ import ErrorBoundary from './error-boundary';
10
10
  import { SDocEditor } from '../basic-sdk';
11
11
  import { PublishedRevisionDiffViewer, RevisionDiffViewer } from '../basic-sdk/views';
12
12
  import { useDocument } from '../hooks';
13
- import { resetWebTitleAndURL } from '../utils';
13
+ import { resetWebTitle } from '../utils';
14
14
  import '../assets/css/simple-editor.css';
15
15
  var SimpleEditor = function SimpleEditor(_ref) {
16
16
  var isStarred = _ref.isStarred,
@@ -37,7 +37,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
37
37
  _useState6 = _slicedToArray(_useState5, 2),
38
38
  changes = _useState6[0],
39
39
  setChanges = _useState6[1];
40
- var initIsPublished = context.getSetting('isPublished');
40
+ var initIsPublished = context.getSetting('isPublished') || false;
41
41
  var _useState7 = useState(initIsPublished),
42
42
  _useState8 = _slicedToArray(_useState7, 2),
43
43
  isPublished = _useState8[0],
@@ -45,7 +45,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
45
45
 
46
46
  // useMount: reset title
47
47
  useEffect(function () {
48
- resetWebTitleAndURL(t);
48
+ resetWebTitle(t);
49
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
50
  }, []);
51
51
  var setDiffChanges = useCallback(function (diff) {
@@ -1,9 +1,6 @@
1
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
1
  import DateUtils from './date-utils';
3
2
  import LocalStorage from './local-storage-utils';
4
3
  import context from '../context';
5
- import { REVISION_FIRST_LOAD_KEY, REVISION_FIRST_LOAD_VALUE } from '../constants';
6
- import toaster from '../components/toast';
7
4
  import getEventTransfer from './get-event-transfer';
8
5
  import * as Hotkey from './hotkey';
9
6
  export var getDirPath = function getDirPath(path) {
@@ -51,39 +48,11 @@ export var isMac = function isMac() {
51
48
  return platform === 'Mac68K' || platform === 'MacPPC' || platform === 'Macintosh' || platform === 'MacIntel';
52
49
  };
53
50
  export var isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);
54
- export var resetWebTitleAndURL = function resetWebTitleAndURL(t) {
51
+ export var resetWebTitle = function resetWebTitle(t) {
55
52
  var isSdocRevision = context.getSetting('isSdocRevision');
56
53
  var originFilename = context.getSetting('originFilename');
57
54
  if (!isSdocRevision) return;
58
55
  window.document.getElementsByTagName('title')[0].innerText = "".concat(t('Revision'), " - ").concat(originFilename);
59
-
60
- // show revision created success info
61
- var url = new URL(window.location.href);
62
- var searchParams = new URLSearchParams(url.search);
63
- if (!searchParams.has(REVISION_FIRST_LOAD_KEY)) return;
64
- var firstLoadValue = searchParams.get(REVISION_FIRST_LOAD_KEY);
65
- if (firstLoadValue === REVISION_FIRST_LOAD_VALUE) {
66
- var revisionId = context.getSetting('revisionId');
67
- toaster.success(t('Revision_created', {
68
- id: revisionId
69
- }));
70
- searchParams.delete(REVISION_FIRST_LOAD_KEY);
71
- }
72
- var newParamsString = '';
73
- var _iterator = _createForOfIteratorHelper(searchParams.entries()),
74
- _step;
75
- try {
76
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
77
- var item = _step.value;
78
- newParamsString = newParamsString + "&".concat(item[0], "=").concat(item[1]);
79
- }
80
- } catch (err) {
81
- _iterator.e(err);
82
- } finally {
83
- _iterator.f();
84
- }
85
- var newURL = "".concat(url.origin).concat(url.pathname).concat(newParamsString ? '/?' + newParamsString : '');
86
- window.history.replaceState(null, null, newURL);
87
56
  };
88
57
  export var getSelectionCoords = function getSelectionCoords() {
89
58
  var doc = window.document;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
@@ -378,13 +378,12 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
385
385
  "Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
386
386
  "Has_been_removed_tip": "Document has been removed, please view other documents.",
387
- "Revision_created": "Revision {{id}} created",
388
387
  "Checking": "Checking...",
389
388
  "Publishing": "Publishing...",
390
389
  "Inline": "Inline",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Keep both modification",
379
379
  "Tip": "Tip",
380
380
  "Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
381
- "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
384
384
  "Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "Сохранить обе модификации",
379
379
  "Tip": "Совет",
380
380
  "Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
381
- "Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу.",
381
+ "Has_been_replaced_tip": "Document content has been replaced. Please refresh the page",
382
382
  "Has_been_published_tip": "Revision published",
383
383
  "Has_conflict_before_publish_tip": "В документе есть конфликты, разрешите их перед публикацией!",
384
384
  "Merge_tip": "В документах есть конфликты. Вы хотите объединить их?",
@@ -378,7 +378,7 @@
378
378
  "Keep_both_modification": "保留两者更改",
379
379
  "Tip": "提示",
380
380
  "Rebase_delete_no_change_revision_tip": "修订改没有更改,是否删除修订稿?",
381
- "Has_been_replaced_tip": "文档内容已经被替换,请刷新页面。",
381
+ "Has_been_replaced_tip": "文档内容已经被替换,请刷新页面",
382
382
  "Has_been_published_tip": "修订稿已发布",
383
383
  "Has_conflict_before_publish_tip": "文档有冲突,请解决冲突后再发布!",
384
384
  "Merge_tip": "文档有冲突,是否合并?",