@seafile/seafile-editor 0.4.1 → 0.4.2
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.
- package/dist/assets/css/new-editor.css +5 -0
- package/dist/slate-extension/core/queries/index.js +6 -0
- package/dist/slate-extension/core/utils/index.js +1 -0
- package/dist/slate-extension/plugins/list/plugin/normalize-list.js +2 -2
- package/dist/slate-extension/plugins/list/transforms/move-list-items-to-list.js +0 -1
- package/dist/slate-extension/plugins/list/transforms/normalize-list-item.js +7 -6
- package/dist/slate-extension/plugins/list/transforms/unwrap-list.js +1 -3
- package/package.json +1 -1
|
@@ -114,6 +114,12 @@ export var getLastChildPath = function getLastChildPath(nodeEntry) {
|
|
|
114
114
|
if (!lastChild) return nodeEntry[1].concat([-1]);
|
|
115
115
|
return lastChild[1];
|
|
116
116
|
};
|
|
117
|
+
export var getPreviousPath = function getPreviousPath(path) {
|
|
118
|
+
if (path.length === 0) return;
|
|
119
|
+
var last = path[path.length - 1];
|
|
120
|
+
if (last <= 0) return;
|
|
121
|
+
return path.slice(0, -1).concat(last - 1);
|
|
122
|
+
};
|
|
117
123
|
export var isLastChild = function isLastChild(nodeEntry, childPath) {
|
|
118
124
|
var lastChildPath = getLastChildPath(nodeEntry);
|
|
119
125
|
return Path.equals(lastChildPath, childPath);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { Node, Element, Transforms, Path } from 'slate';
|
|
3
3
|
import { LIST_ITEM, LIST_LIC, PARAGRAPH } from '../../../constants';
|
|
4
|
-
import { getChildren, getNode, match } from '../../../core';
|
|
4
|
+
import { getChildren, getNode, getPreviousPath, match } from '../../../core';
|
|
5
5
|
import { getListTypes } from '../queries';
|
|
6
6
|
import { moveListItemsToList, normalizeListItem, normalizeNestedList } from '../transforms';
|
|
7
7
|
export var normalizeList = function normalizeList(editor) {
|
|
@@ -53,7 +53,7 @@ export var normalizeList = function normalizeList(editor) {
|
|
|
53
53
|
deleteFromList: true
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
var prevPath =
|
|
56
|
+
var prevPath = getPreviousPath(path);
|
|
57
57
|
var prevNode = getNode(editor, prevPath);
|
|
58
58
|
if ((prevNode === null || prevNode === void 0 ? void 0 : prevNode.type) === node.type) {
|
|
59
59
|
editor.normalizeNode([prevNode, prevPath]);
|
|
@@ -23,9 +23,10 @@ export var normalizeListItem = function normalizeListItem(editor, _ref) {
|
|
|
23
23
|
return Editor.pathRef(editor, childPath);
|
|
24
24
|
});
|
|
25
25
|
var firstLiChild = liChildren[0];
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var _ref6 = firstLiChild !== null && firstLiChild !== void 0 ? firstLiChild : [],
|
|
27
|
+
_ref7 = _slicedToArray(_ref6, 2),
|
|
28
|
+
firstLiChildNode = _ref7[0],
|
|
29
|
+
firstLiChildPath = _ref7[1];
|
|
29
30
|
if (!firstLiChild || !Editor.isBlock(editor, firstLiChildNode)) {
|
|
30
31
|
var emptyLic = {
|
|
31
32
|
type: LIST_LIC,
|
|
@@ -92,9 +93,9 @@ export var normalizeListItem = function normalizeListItem(editor, _ref) {
|
|
|
92
93
|
_iterator.f();
|
|
93
94
|
}
|
|
94
95
|
var to = Path.next((_licChildren = licChildren[licChildren.length - 1]) === null || _licChildren === void 0 ? void 0 : _licChildren[1]);
|
|
95
|
-
inlineChildren.reverse().forEach(function (
|
|
96
|
-
var
|
|
97
|
-
path =
|
|
96
|
+
inlineChildren.reverse().forEach(function (_ref8) {
|
|
97
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
|
98
|
+
path = _ref9[1];
|
|
98
99
|
Transforms.moveNodes(editor, {
|
|
99
100
|
at: path,
|
|
100
101
|
to: to
|
|
@@ -8,8 +8,7 @@ export var unwrapList = function unwrapList(editor) {
|
|
|
8
8
|
var ancestorListTypeCheck = function ancestorListTypeCheck() {
|
|
9
9
|
if (getAboveNode(editor, {
|
|
10
10
|
match: {
|
|
11
|
-
type: getListTypes()
|
|
12
|
-
at: at
|
|
11
|
+
type: getListTypes()
|
|
13
12
|
}
|
|
14
13
|
})) {
|
|
15
14
|
return true;
|
|
@@ -32,7 +31,6 @@ export var unwrapList = function unwrapList(editor) {
|
|
|
32
31
|
type: LIST_LIC
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
|
-
console.log(licEntry);
|
|
36
34
|
if (licEntry) {
|
|
37
35
|
Transforms.setNodes(editor, {
|
|
38
36
|
type: PARAGRAPH
|