@progress/kendo-editor-common 1.12.8-develop.1 → 1.12.9-develop.1
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/cdn/js/kendo-editor-common.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/lists.js +16 -4
- package/dist/npm/lists.js +16 -4
- package/package.json +5 -2
package/dist/es/lists.js
CHANGED
|
@@ -71,6 +71,7 @@ function toggleListCommand(options) {
|
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
state = view.state;
|
|
74
|
+
const dispatchWithMarks = preserveStoredMarks(state, dispatch);
|
|
74
75
|
const listNode = state.schema.nodes[options.listType];
|
|
75
76
|
const { $from, $to } = state.selection;
|
|
76
77
|
const parent = $from.node(-2);
|
|
@@ -80,15 +81,26 @@ function toggleListCommand(options) {
|
|
|
80
81
|
(grandgrandParent && grandgrandParent.type === listNode)) &&
|
|
81
82
|
isRangeOfSingleType) {
|
|
82
83
|
// Untoggles list
|
|
83
|
-
return liftListItems(options)(state,
|
|
84
|
+
return liftListItems(options)(state, dispatchWithMarks);
|
|
84
85
|
}
|
|
85
86
|
else {
|
|
86
87
|
// Wraps selection in list and converts list type e.g. bullet_list -> ordered_list if needed
|
|
87
88
|
if (!isRangeOfSingleType) {
|
|
88
|
-
liftListItems(options)(state,
|
|
89
|
+
liftListItems(options)(state, dispatchWithMarks);
|
|
89
90
|
state = view.state;
|
|
90
91
|
}
|
|
91
|
-
return wrapInList(listNode, options.listAttrs)(state,
|
|
92
|
+
return wrapInList(listNode, options.listAttrs)(state, dispatchWithMarks);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function preserveStoredMarks(state, dispatch) {
|
|
97
|
+
const marks = state.storedMarks || state.selection.$from.marks();
|
|
98
|
+
return tr => {
|
|
99
|
+
if (marks) {
|
|
100
|
+
tr.ensureMarks(marks);
|
|
101
|
+
}
|
|
102
|
+
if (dispatch) {
|
|
103
|
+
dispatch(tr);
|
|
92
104
|
}
|
|
93
105
|
};
|
|
94
106
|
}
|
|
@@ -241,7 +253,7 @@ export const toggleList = (state, dispatch, view, options, command) => {
|
|
|
241
253
|
let tr = liftFollowingList(state, selection.$to.pos, selection.$to.end(depth), depth, view.state.tr, listNodes.listItem);
|
|
242
254
|
tr = liftSelectionList(state, tr, options);
|
|
243
255
|
tr.setMeta('commandName', command);
|
|
244
|
-
dispatch(tr);
|
|
256
|
+
preserveStoredMarks(state, dispatch)(tr);
|
|
245
257
|
return true;
|
|
246
258
|
}
|
|
247
259
|
};
|
package/dist/npm/lists.js
CHANGED
|
@@ -76,6 +76,7 @@ function toggleListCommand(options) {
|
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
state = view.state;
|
|
79
|
+
const dispatchWithMarks = preserveStoredMarks(state, dispatch);
|
|
79
80
|
const listNode = state.schema.nodes[options.listType];
|
|
80
81
|
const { $from, $to } = state.selection;
|
|
81
82
|
const parent = $from.node(-2);
|
|
@@ -85,15 +86,26 @@ function toggleListCommand(options) {
|
|
|
85
86
|
(grandgrandParent && grandgrandParent.type === listNode)) &&
|
|
86
87
|
isRangeOfSingleType) {
|
|
87
88
|
// Untoggles list
|
|
88
|
-
return liftListItems(options)(state,
|
|
89
|
+
return liftListItems(options)(state, dispatchWithMarks);
|
|
89
90
|
}
|
|
90
91
|
else {
|
|
91
92
|
// Wraps selection in list and converts list type e.g. bullet_list -> ordered_list if needed
|
|
92
93
|
if (!isRangeOfSingleType) {
|
|
93
|
-
liftListItems(options)(state,
|
|
94
|
+
liftListItems(options)(state, dispatchWithMarks);
|
|
94
95
|
state = view.state;
|
|
95
96
|
}
|
|
96
|
-
return wrapInList(listNode, options.listAttrs)(state,
|
|
97
|
+
return wrapInList(listNode, options.listAttrs)(state, dispatchWithMarks);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function preserveStoredMarks(state, dispatch) {
|
|
102
|
+
const marks = state.storedMarks || state.selection.$from.marks();
|
|
103
|
+
return tr => {
|
|
104
|
+
if (marks) {
|
|
105
|
+
tr.ensureMarks(marks);
|
|
106
|
+
}
|
|
107
|
+
if (dispatch) {
|
|
108
|
+
dispatch(tr);
|
|
97
109
|
}
|
|
98
110
|
};
|
|
99
111
|
}
|
|
@@ -247,7 +259,7 @@ const toggleList = (state, dispatch, view, options, command) => {
|
|
|
247
259
|
let tr = liftFollowingList(state, selection.$to.pos, selection.$to.end(depth), depth, view.state.tr, listNodes.listItem);
|
|
248
260
|
tr = liftSelectionList(state, tr, options);
|
|
249
261
|
tr.setMeta('commandName', command);
|
|
250
|
-
dispatch(tr);
|
|
262
|
+
preserveStoredMarks(state, dispatch)(tr);
|
|
251
263
|
return true;
|
|
252
264
|
}
|
|
253
265
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-editor-common",
|
|
3
3
|
"description": "Kendo UI TypeScript package exporting functions for Editor component",
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.9-develop.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Kendo UI"
|
|
7
7
|
],
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
"prepare": "husky",
|
|
30
30
|
"prepublishOnly": "npm pkg delete devDependencies scripts"
|
|
31
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@progress/kendo-common": "^1.0.2"
|
|
34
|
+
},
|
|
32
35
|
"dependencies": {
|
|
33
|
-
"@progress/kendo-common": "^1.0.2",
|
|
34
36
|
"prosemirror-commands": "1.7.1",
|
|
35
37
|
"prosemirror-dropcursor": "1.8.3",
|
|
36
38
|
"prosemirror-gapcursor": "1.4.1",
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@commitlint/cli": "^17.3.0",
|
|
50
52
|
"@commitlint/config-conventional": "^17.3.0",
|
|
53
|
+
"@progress/kendo-common": "^1.0.2",
|
|
51
54
|
"@progress/kendo-e2e": "^4.7.0",
|
|
52
55
|
"@progress/kendo-package-tasks": "dev",
|
|
53
56
|
"@progress/kendo-typescript-tasks": "dev",
|