@seafile/sdoc-editor 3.0.220 → 3.0.221
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.
|
@@ -167,6 +167,14 @@ var withTable = function withTable(editor) {
|
|
|
167
167
|
if (!selection) {
|
|
168
168
|
return deleteFragment(unit);
|
|
169
169
|
}
|
|
170
|
+
var collapseSelection = function collapseSelection(point) {
|
|
171
|
+
if (point && _slate.Editor.hasPath(editor, point.path)) {
|
|
172
|
+
_slate.Transforms.select(editor, {
|
|
173
|
+
anchor: point,
|
|
174
|
+
focus: point
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
};
|
|
170
178
|
var match = function match(n) {
|
|
171
179
|
return n.type === _constants2.TABLE;
|
|
172
180
|
};
|
|
@@ -228,8 +236,8 @@ var withTable = function withTable(editor) {
|
|
|
228
236
|
at: selection.focus,
|
|
229
237
|
match: match
|
|
230
238
|
});
|
|
231
|
-
var _columnLength = focusEntry[0].columns.length;
|
|
232
239
|
if (focusEntry) {
|
|
240
|
+
var _columnLength = focusEntry[0].columns.length;
|
|
233
241
|
var focus = selection.focus;
|
|
234
242
|
var _isForward = _slate.Range.isForward(selection);
|
|
235
243
|
if (_isForward) {
|
|
@@ -242,13 +250,29 @@ var withTable = function withTable(editor) {
|
|
|
242
250
|
});
|
|
243
251
|
|
|
244
252
|
// delete other module
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
})
|
|
253
|
+
var prevBlockPath = _slate.Path.previous(focusEntry[1]);
|
|
254
|
+
var newFocus = (0, _core.getEndPoint)(editor, prevBlockPath);
|
|
255
|
+
var range = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, selection), {}, {
|
|
256
|
+
focus: newFocus
|
|
250
257
|
});
|
|
251
|
-
|
|
258
|
+
var targetFocus = {
|
|
259
|
+
path: focus.path,
|
|
260
|
+
offset: 0
|
|
261
|
+
};
|
|
262
|
+
if (_slate.Range.isCollapsed(range) && _slate.Editor.hasPath(editor, prevBlockPath)) {
|
|
263
|
+
_slate.Transforms.removeNodes(editor, {
|
|
264
|
+
at: prevBlockPath
|
|
265
|
+
});
|
|
266
|
+
targetFocus = {
|
|
267
|
+
path: prevBlockPath.concat(focus.path.slice(focusEntry[1].length)),
|
|
268
|
+
offset: 0
|
|
269
|
+
};
|
|
270
|
+
} else {
|
|
271
|
+
_slate.Transforms["delete"](editor, {
|
|
272
|
+
at: range
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
collapseSelection(targetFocus);
|
|
252
276
|
return;
|
|
253
277
|
}
|
|
254
278
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.221",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "30ff08d00b06b38e8d9f4e005ac5b2f8bfcccae6"
|
|
76
76
|
}
|