@seafile/seafile-editor 0.3.79 → 0.3.83

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/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 +58 -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 +155 -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 +3 -2
  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 +52 -0
  59. package/dist/editor/code-highlight-package.js +0 -0
  60. package/dist/editor/controller/block-element-controller.js +34 -4
  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/shortcut-controller.js +29 -9
  64. package/dist/editor/controller/void-element-controller.js +0 -0
  65. package/dist/editor/custom/custom.js +0 -0
  66. package/dist/editor/custom/get-event-transfer.js +0 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +0 -0
  68. package/dist/editor/custom/insertNodes.js +0 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +0 -0
  70. package/dist/editor/custom/set-event-transfer.js +0 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +0 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +0 -0
  73. package/dist/editor/editor-component/check-list-item.js +0 -0
  74. package/dist/editor/editor-component/code-block.js +0 -0
  75. package/dist/editor/editor-component/formula.js +0 -0
  76. package/dist/editor/editor-component/image.js +96 -32
  77. package/dist/editor/editor-component/link.js +0 -0
  78. package/dist/editor/editor-component/table.js +0 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +0 -0
  80. package/dist/editor/editor-plugin.js +12 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +0 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +0 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +0 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +0 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +147 -136
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +62 -3
  87. package/dist/editor/editor-utils/common-editor-utils.js +6 -2
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +0 -0
  89. package/dist/editor/editor-utils/mark-utils.js +0 -0
  90. package/dist/editor/editor-utils/range-utils.js +0 -0
  91. package/dist/editor/editor-utils/selection-utils.js +0 -0
  92. package/dist/editor/editor-utils/text-utils.js +0 -0
  93. package/dist/editor/editor.js +0 -0
  94. package/dist/editor/element-model/blockquote.js +0 -0
  95. package/dist/editor/element-model/image.js +0 -0
  96. package/dist/editor/element-model/link.js +0 -0
  97. package/dist/editor/element-model/table.js +25 -2
  98. package/dist/editor/element-model/text.js +0 -0
  99. package/dist/editor/load-script.js +0 -0
  100. package/dist/editor/plain-markdown-editor.js +0 -0
  101. package/dist/editor/rich-markdown-editor.js +0 -0
  102. package/dist/editor/seafile-editor.js +0 -0
  103. package/dist/editor/simple-editor.js +0 -0
  104. package/dist/editor-api.js +0 -0
  105. package/dist/index.css +0 -0
  106. package/dist/lib/slate-hyperscript/creators.js +0 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +0 -0
  108. package/dist/lib/slate-hyperscript/index.js +0 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +0 -0
  110. package/dist/lib/unified/index.js +0 -0
  111. package/dist/lib/vfile/core.js +0 -0
  112. package/dist/lib/vfile/index.js +0 -0
  113. package/dist/seafile-editor-chooser.js +0 -0
  114. package/dist/seafile-markdown-editor.js +0 -0
  115. package/dist/seafile-markdown-viewer.js +0 -0
  116. package/dist/seafile-simple-editor.js +0 -0
  117. package/dist/utils/copy-to-clipboard.js +0 -0
  118. package/dist/utils/deserialize-html.js +0 -0
  119. package/dist/utils/diff/compare-strings.js +0 -0
  120. package/dist/utils/diff/diff.js +0 -0
  121. package/dist/utils/diff/index.js +0 -0
  122. package/dist/utils/render-slate.js +0 -0
  123. package/dist/utils/seafile-markdown2html.js +0 -0
  124. package/dist/utils/slate2markdown/deserialize.js +0 -0
  125. package/dist/utils/slate2markdown/index.js +0 -0
  126. package/dist/utils/slate2markdown/serialize.js +0 -0
  127. package/dist/utils/utils.js +0 -0
  128. package/dist/viewer/diff-viewer.js +0 -0
  129. package/dist/viewer/markdown-viewer.js +0 -0
  130. package/dist/viewer/slate-viewer.js +0 -0
  131. package/dist/viewer/viewer-formula.js +0 -0
  132. package/dist/viewer/viewer-image.js +0 -0
  133. package/dist/viewer/viewer-outline.js +0 -0
  134. package/package.json +2 -1
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +0 -0
  137. package/public/locales/cs/seafile-editor.json +0 -0
  138. package/public/locales/de/seafile-editor.json +0 -0
  139. package/public/locales/en/seafile-editor.json +0 -0
  140. package/public/locales/es/seafile-editor.json +0 -0
  141. package/public/locales/es-AR/seafile-editor.json +0 -0
  142. package/public/locales/es-MX/seafile-editor.json +0 -0
  143. package/public/locales/fr/seafile-editor.json +0 -0
  144. package/public/locales/it/seafile-editor.json +0 -0
  145. package/public/locales/ru/seafile-editor.json +0 -0
  146. package/public/locales/zh-CN/seafile-editor.json +0 -0
  147. package/public/manifest.json +0 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +0 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +117 -162
  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 +24 -7
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +0 -0
File without changes
File without changes
File without changes
@@ -0,0 +1,58 @@
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 ClickOutside = /*#__PURE__*/function (_React$Component) {
8
+ _inherits(ClickOutside, _React$Component);
9
+
10
+ var _super = _createSuper(ClickOutside);
11
+
12
+ function ClickOutside(props) {
13
+ var _this;
14
+
15
+ _classCallCheck(this, ClickOutside);
16
+
17
+ _this = _super.call(this, props);
18
+
19
+ _this.handleDocumentMouseDown = function () {
20
+ if (_this.isClickedInside) {
21
+ _this.isClickedInside = false;
22
+ return;
23
+ }
24
+
25
+ _this.props.clickOutside();
26
+ };
27
+
28
+ _this.handleMouseDown = function (e) {
29
+ _this.isClickedInside = true;
30
+ };
31
+
32
+ _this.isClickedInside = false;
33
+ return _this;
34
+ }
35
+
36
+ _createClass(ClickOutside, [{
37
+ key: "componentDidMount",
38
+ value: function componentDidMount() {
39
+ document.addEventListener('mousedown', this.handleDocumentMouseDown);
40
+ }
41
+ }, {
42
+ key: "componentWillUnmount",
43
+ value: function componentWillUnmount() {
44
+ document.removeEventListener('mousedown', this.handleDocumentMouseDown);
45
+ }
46
+ }, {
47
+ key: "render",
48
+ value: function render() {
49
+ return React.cloneElement(React.Children.only(this.props.children), {
50
+ onMouseDownCapture: this.handleMouseDown
51
+ });
52
+ }
53
+ }]);
54
+
55
+ return ClickOutside;
56
+ }(React.Component);
57
+
58
+ export default ClickOutside;
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
@@ -0,0 +1,155 @@
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, { Component } from 'react';
6
+ import ClickOutside from './click-outside';
7
+ import IconButton from './topbar-component/icon-button';
8
+
9
+ var TableButton = /*#__PURE__*/function (_Component) {
10
+ _inherits(TableButton, _Component);
11
+
12
+ var _super = _createSuper(TableButton);
13
+
14
+ function TableButton(props) {
15
+ var _this;
16
+
17
+ _classCallCheck(this, TableButton);
18
+
19
+ _this = _super.call(this, props);
20
+
21
+ _this.toggleCard = function () {
22
+ _this.setState({
23
+ showCard: !_this.state.showCard,
24
+ columnCount: -1,
25
+ rowCount: -1
26
+ });
27
+ };
28
+
29
+ _this.createTableCells = function () {
30
+ var rows = [];
31
+ var _this$state = _this.state,
32
+ columnCount = _this$state.columnCount,
33
+ rowCount = _this$state.rowCount,
34
+ currentMaxColumnCount = _this$state.currentMaxColumnCount,
35
+ currentMaxRowCount = _this$state.currentMaxRowCount;
36
+
37
+ var _loop = function _loop(rowIndex) {
38
+ var cells = [];
39
+
40
+ var _loop2 = function _loop2(columnIndex) {
41
+ var isActive = columnIndex <= columnCount - 1 && rowIndex <= rowCount - 1;
42
+ var vDom = /*#__PURE__*/React.createElement("div", {
43
+ onMouseEnter: function onMouseEnter() {
44
+ return _this.onTableCellMouseEnter(rowIndex, columnIndex);
45
+ },
46
+ key: "table-row-".concat(rowIndex, "-").concat(columnIndex),
47
+ className: "sf-editor-table-card-cell ".concat(isActive ? 'sf-editor-table-card-active-cell' : '')
48
+ });
49
+ cells.push(vDom);
50
+ };
51
+
52
+ for (var columnIndex = 0; columnIndex < currentMaxColumnCount; columnIndex++) {
53
+ _loop2(columnIndex);
54
+ }
55
+
56
+ var row = /*#__PURE__*/React.createElement("div", {
57
+ key: "table-row-".concat(rowIndex),
58
+ className: "sf-editor-table-card-row"
59
+ }, cells);
60
+ rows.push(row);
61
+ };
62
+
63
+ for (var rowIndex = 0; rowIndex < currentMaxRowCount; rowIndex++) {
64
+ _loop(rowIndex);
65
+ }
66
+
67
+ return /*#__PURE__*/React.createElement("div", {
68
+ onClick: function onClick(event) {
69
+ return _this.onAddTable(event, rowCount, columnCount);
70
+ },
71
+ className: "sf-editor-table-card"
72
+ }, rows);
73
+ };
74
+
75
+ _this.onAddTable = function (event, rowCount, columnCount) {
76
+ _this.props.onAddTable(event, rowCount, columnCount);
77
+
78
+ _this.toggleCard();
79
+ };
80
+
81
+ _this.onTableCellMouseEnter = function (rowIndex, columnIndex) {
82
+ var columnCount = columnIndex + 1,
83
+ rowCount = rowIndex + 1;
84
+ var currentMaxRowCount = rowCount + 1,
85
+ currentMaxColumnCount = columnCount + 1;
86
+
87
+ if (currentMaxColumnCount > 10) {
88
+ currentMaxColumnCount = 10;
89
+ } else if (currentMaxColumnCount < 4) {
90
+ currentMaxColumnCount = 4;
91
+ }
92
+
93
+ if (currentMaxRowCount > 10) {
94
+ currentMaxRowCount = 10;
95
+ } else if (currentMaxRowCount < 4) {
96
+ currentMaxRowCount = 4;
97
+ }
98
+
99
+ _this.setState({
100
+ columnCount: columnCount,
101
+ rowCount: rowCount,
102
+ currentMaxColumnCount: currentMaxColumnCount,
103
+ currentMaxRowCount: currentMaxRowCount
104
+ });
105
+ };
106
+
107
+ _this.state = {
108
+ showCard: false,
109
+ currentMaxColumnCount: 4,
110
+ currentMaxRowCount: 4,
111
+ columnCount: -1,
112
+ rowCount: -1
113
+ };
114
+ return _this;
115
+ }
116
+
117
+ _createClass(TableButton, [{
118
+ key: "createTableScaleCard",
119
+ value: function createTableScaleCard(props) {
120
+ var _this$state2 = this.state,
121
+ columnCount = _this$state2.columnCount,
122
+ rowCount = _this$state2.rowCount;
123
+ return /*#__PURE__*/React.createElement("div", {
124
+ className: "sf-editor-table-count-card"
125
+ }, /*#__PURE__*/React.createElement("div", {
126
+ className: "sf-editor-table-cells-header"
127
+ }, "".concat(columnCount < 0 ? 0 : columnCount, " x ").concat(rowCount < 0 ? 0 : rowCount)), this.createTableCells());
128
+ }
129
+ }, {
130
+ key: "render",
131
+ value: function render() {
132
+ var _this$props = this.props,
133
+ disabled = _this$props.disabled,
134
+ isRichEditor = _this$props.isRichEditor,
135
+ text = _this$props.text;
136
+ var showCard = this.state.showCard;
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ className: "sf-editor-table-btn-wrapper"
139
+ }, /*#__PURE__*/React.createElement(IconButton, {
140
+ disabled: disabled,
141
+ isRichEditor: isRichEditor,
142
+ text: text,
143
+ id: 'tableButton',
144
+ icon: 'iconfont icon-table',
145
+ onMouseDown: this.toggleCard
146
+ }), showCard && /*#__PURE__*/React.createElement(ClickOutside, {
147
+ clickOutside: this.toggleCard
148
+ }, this.createTableScaleCard()));
149
+ }
150
+ }]);
151
+
152
+ return TableButton;
153
+ }(Component);
154
+
155
+ export default TableButton;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import HeaderList from '../components/topbar-component/header-list';
7
7
  import ButtonGroup from '../components/topbar-component/button-group';
8
8
  import IconButton from '../components/topbar-component/icon-button';
9
+ import TableButton from '../components/table-button';
9
10
  import { withTranslation } from 'react-i18next';
10
11
  import AddLinkDialog from './add-link-dialog';
11
12
  import AddImageDialog from './add-image-dialog';
@@ -168,13 +169,13 @@ var ToolBar = /*#__PURE__*/function (_React$Component) {
168
169
  return _this2.editorUtils.onClickBlock(event, 'code_block');
169
170
  },
170
171
  isActive: isCodeActive && !readOnly
171
- }), /*#__PURE__*/React.createElement(IconButton, {
172
+ }), /*#__PURE__*/React.createElement(TableButton, {
172
173
  disabled: isFormulaActive || isCodeActive || isTableActive || isHeadActive,
173
174
  isRichEditor: true,
174
175
  text: t('insert_table'),
175
176
  id: 'tableButton',
176
177
  icon: 'iconfont icon-table',
177
- onMouseDown: this.editorUtils.onAddTable
178
+ onAddTable: this.editorUtils.onAddTable
178
179
  }), window.canInsertFormula && /*#__PURE__*/React.createElement(IconButton, {
179
180
  disabled: isFormulaActive || isCodeActive || isTableActive || isHeadActive || isListActive,
180
181
  isRichEditor: true,
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 .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
@@ -102,6 +102,58 @@
102
102
  margin-left:10px;
103
103
  }
104
104
 
105
+ .sf-editor-table-btn-wrapper {
106
+ position: relative;
107
+ }
108
+
109
+ .sf-editor-table-count-card {
110
+ background-color: #ffffff;
111
+ min-width: 100px;
112
+ min-height: 100px;
113
+ position: absolute;
114
+ top: 101%;
115
+ left: 0;
116
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
117
+ border: 1px solid rgba(0, 40, 100, 0.12);
118
+ z-index: 100;
119
+ padding: 5px 10px 10px 10px;
120
+ border-radius: 2px;
121
+ }
122
+
123
+ .sf-editor-table-cells-header {
124
+ text-align: center;
125
+ height: 20px;
126
+ font-size: 14px;
127
+ }
128
+
129
+ .sf-editor-table-card {
130
+ margin-top: 5px;
131
+ }
132
+
133
+ .sf-editor-table-card-row {
134
+ display: flex;
135
+ flex-direction: row;
136
+ border-bottom: 1px solid #cccccc;
137
+ }
138
+
139
+ .sf-editor-table-card-row:first-child {
140
+ border-top: 1px solid #cccccc;
141
+ }
142
+
143
+ .sf-editor-table-card-cell {
144
+ border-right: 1px solid #cccccc;
145
+ width: 20px;
146
+ height: 15px;
147
+ }
148
+
149
+ .sf-editor-table-card-row .sf-editor-table-card-cell:first-child {
150
+ border-left: 1px solid #cccccc;
151
+ }
152
+
153
+ .sf-editor-table-card-active-cell {
154
+ background-color: #ffa94d;
155
+ }
156
+
105
157
  /*topbar style*/
106
158
 
107
159
  .menu {
File without changes
@@ -1,5 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
1
  import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import { Editor } from 'slate';
5
5
  import ListUtils from '../editor-utils/block-element-utils/list-utils';
@@ -146,6 +146,27 @@ var withBlock = function withBlock(editor) {
146
146
 
147
147
  if (firstFragmentNode.type === 'paragraph') {
148
148
  Editor.insertFragment(editor, fragment);
149
+ return;
150
+ }
151
+ /**
152
+ * if the first fragment element is a list, get normalized list items with function getNormalizedListItems and insert
153
+ */
154
+
155
+
156
+ if (firstFragmentNode.type.includes('_list')) {
157
+ var listItems = listUtils.getNormalizedListItems(firstFragmentNode);
158
+ var newFragment = fragment.slice(1);
159
+ Editor.insertNodes(editor, [{
160
+ type: firstFragmentNode.type,
161
+ children: listItems
162
+ }].concat(_toConsumableArray(newFragment)));
163
+
164
+ if (SfEditor.isEmptyParagraph(currentBlock)) {
165
+ Editor.delete(editor, {
166
+ at: path
167
+ });
168
+ }
169
+
149
170
  return;
150
171
  } // if current node is an empty paragraph, insert the fragment and
151
172
  // delete the empty paragraph
@@ -247,15 +268,16 @@ var withBlock = function withBlock(editor) {
247
268
  }
248
269
  });
249
270
  } else {
250
- var listItems = Editor.nodes(editor, {
271
+ var _listItems = Editor.nodes(editor, {
251
272
  at: editor.selection,
252
273
  match: {
253
274
  type: 'list_item'
254
275
  }
255
276
  });
277
+
256
278
  var nearestItem;
257
279
 
258
- var _iterator = _createForOfIteratorHelper(listItems),
280
+ var _iterator = _createForOfIteratorHelper(_listItems),
259
281
  _step;
260
282
 
261
283
  try {
@@ -325,7 +347,7 @@ var withBlock = function withBlock(editor) {
325
347
  break;
326
348
 
327
349
  case 'insert_table':
328
- tableUtils.insertTable();
350
+ tableUtils.insertTable(data);
329
351
  break;
330
352
 
331
353
  case 'remove_table':
@@ -356,6 +378,14 @@ var withBlock = function withBlock(editor) {
356
378
  tableUtils.exitTable();
357
379
  break;
358
380
 
381
+ case 'focus_next_table_cell':
382
+ tableUtils.focusNextTableCell();
383
+ break;
384
+
385
+ case 'focus_previous_table_cell':
386
+ tableUtils.focusPreviousTableCell();
387
+ break;
388
+
359
389
  case 'insert_formula':
360
390
  formulaUtils.insertFormula(command.data);
361
391
  break;
File without changes
@@ -327,34 +327,54 @@ var withMarkdownShortcut = function withMarkdownShortcut(editor) {
327
327
  if (listUtils.isInlist()) {
328
328
  var _Editor$nodes9 = Editor.nodes(editor, {
329
329
  match: [{
330
- type: 'ordered_list'
331
- }, {
332
- type: 'unordered_list'
330
+ type: 'list_item'
333
331
  }]
334
332
  }),
335
333
  _Editor$nodes10 = _slicedToArray(_Editor$nodes9, 1),
336
334
  _node3 = _Editor$nodes10[0];
337
335
 
338
- var listNode = _node3[0];
336
+ var listItemPath = _node3[1];
337
+ 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
339
338
 
340
- if (listNode.children.length === 1 && Node.text(listNode).length === 0) {
339
+ if (anchor.path[0] === 0 && anchor.path[1] === 0) {
341
340
  listUtils.unwrapList();
342
341
  return;
343
- } // Unwrap the list item when the selection is at the first list item of the first node of document
342
+ } // unwrap an empty list
344
343
 
345
344
 
346
- if (anchor.path[0] === 0 && anchor.path[1] === 0) {
345
+ if (listNode.children.length === 1 && Node.text(listNode).length === 0) {
347
346
  listUtils.unwrapList();
348
347
  return;
348
+ } // list items with mutiple chidren
349
+
350
+
351
+ var currentChildBlockIndex = anchor.path[anchor.path.length - 2];
352
+ var currentListItem;
353
+
354
+ for (var i = anchor.path.length - 1; i > 0; i--) {
355
+ var _node4 = Node.get(editor, anchor.path.slice(0, i));
356
+
357
+ if (_node4.type === 'list_item') {
358
+ currentListItem = _node4;
359
+ break;
360
+ }
361
+ }
362
+
363
+ if (currentChildBlockIndex === 0 && currentListItem.children.length > 1) {
364
+ Editor.withoutNormalizing(editor, function (editor) {
365
+ listUtils.unwrapList();
366
+ exec(command);
367
+ });
368
+ return;
349
369
  }
350
370
  }
351
371
 
352
372
  if (codeUtils.isInCodeBlock()) {
353
- var _node4 = Editor.match(editor, editor.selection, {
373
+ var _node5 = Editor.match(editor, editor.selection, {
354
374
  type: 'code_block'
355
375
  });
356
376
 
357
- var codeBlock = _node4[0];
377
+ var codeBlock = _node5[0];
358
378
  var children = codeBlock.children;
359
379
  var text = Node.text(codeBlock);
360
380
 
File without changes
File without changes
File without changes