@titaui/pc 1.10.38 → 1.10.41
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/lib/components/rich-editor/plugins/block/lists/commond/index.js +137 -139
- package/lib/components/rich-editor/plugins/inline/color/selector.js +6 -8
- package/lib/components/rich-editor/ui/editor/index.css +3 -0
- package/lib/components/rich-editor/ui/editor/index.js +21 -8
- package/lib/components/rich-editor/ui/normal-toolbar/index.css +1 -0
- package/lib/components/rich-editor/utils/mark.js +1 -1
- package/package.json +2 -1
|
@@ -73,144 +73,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
73
73
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
74
74
|
|
|
75
75
|
// export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
76
|
-
var enterKeyCommand = function enterKeyCommand(state, dispatch) {
|
|
77
|
-
var selection = state.selection;
|
|
78
|
-
|
|
79
|
-
if (selection.empty) {
|
|
80
|
-
var $from = selection.$from;
|
|
81
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
82
|
-
listItem = _state$schema$nodes.listItem,
|
|
83
|
-
codeBlock = _state$schema$nodes.codeBlock;
|
|
84
|
-
var node = $from.node($from.depth);
|
|
85
|
-
var wrapper = $from.node($from.depth - 1);
|
|
86
|
-
|
|
87
|
-
if (wrapper && wrapper.type === listItem) {
|
|
88
|
-
/** Check if the wrapper has any visible content */
|
|
89
|
-
var wrapperHasContent = (0, _document.hasVisibleContent)(wrapper);
|
|
90
|
-
|
|
91
|
-
if ((0, _document.isNodeEmpty)(node) && !wrapperHasContent) {
|
|
92
|
-
return (0, _outdentList.outdentList)()(state, dispatch);
|
|
93
|
-
} else if (!(0, _prosemirrorUtils.hasParentNodeOfType)(codeBlock)(selection)) {
|
|
94
|
-
return splitListItem(listItem)(state, dispatch);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return false;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
exports.enterKeyCommand = enterKeyCommand;
|
|
103
|
-
|
|
104
|
-
var backspaceKeyCommand = function backspaceKeyCommand(state, dispatch) {
|
|
105
|
-
return baseCommand.chainCommands(_listBackspace.listBackspace, // if we're at the start of a list item, we need to either backspace
|
|
106
|
-
// directly to an empty list item above, or outdent this node
|
|
107
|
-
(0, _commands.filter)([function (state) {
|
|
108
|
-
return state.selection.empty;
|
|
109
|
-
}, // list items might have multiple paragraphs; only do this at the first one
|
|
110
|
-
_commands.isFirstChildOfParent, _selection.isInsideListItem], baseCommand.chainCommands(deletePreviousEmptyListItem, (0, _outdentList.outdentList)())), // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
|
|
111
|
-
// the text to the previous list item, if one exists
|
|
112
|
-
(0, _commands.filter)([function (state) {
|
|
113
|
-
return state.selection.empty;
|
|
114
|
-
}, _selection.canJoinToPreviousListItem], joinToPreviousListItem))(state, dispatch);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
exports.backspaceKeyCommand = backspaceKeyCommand;
|
|
118
|
-
var deleteKeyCommand = _joinListItemForward.joinListItemForward; // Get the depth of the nearest ancestor list
|
|
119
|
-
|
|
120
|
-
exports.deleteKeyCommand = deleteKeyCommand;
|
|
121
|
-
|
|
122
|
-
var rootListDepth = function rootListDepth(pos, nodes) {
|
|
123
|
-
var bulletList = nodes.bulletList,
|
|
124
|
-
orderedList = nodes.orderedList,
|
|
125
|
-
listItem = nodes.listItem;
|
|
126
|
-
var depth;
|
|
127
|
-
|
|
128
|
-
for (var i = pos.depth - 1; i > 0; i--) {
|
|
129
|
-
var node = pos.node(i);
|
|
130
|
-
|
|
131
|
-
if (node.type === bulletList || node.type === orderedList) {
|
|
132
|
-
depth = i;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (node.type !== bulletList && node.type !== orderedList && node.type !== listItem) {
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return depth;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
exports.rootListDepth = rootListDepth;
|
|
144
|
-
|
|
145
|
-
function untoggleSelectedList(tr) {
|
|
146
|
-
var _tr = tr,
|
|
147
|
-
selection = _tr.selection;
|
|
148
|
-
var depth = rootListDepth(selection.$to, tr.doc.type.schema.nodes);
|
|
149
|
-
tr = (0, _transforms.liftFollowingList)(selection.$to.pos, selection.$to.end(depth), depth || 0, tr);
|
|
150
|
-
tr = (0, _transforms.liftSelectionList)(selection, tr);
|
|
151
|
-
}
|
|
152
76
|
|
|
153
|
-
function toggleList(listType) {
|
|
154
|
-
return function (state, dispatch) {
|
|
155
|
-
var tr = state.tr;
|
|
156
|
-
var listInsideSelection = (0, _selection.selectionContainsList)(tr);
|
|
157
|
-
var listNodeType = state.schema.nodes[listType];
|
|
158
|
-
|
|
159
|
-
if (listInsideSelection) {
|
|
160
|
-
var selection = state.selection;
|
|
161
|
-
var fromNode = selection.$from.node(selection.$from.depth - 2);
|
|
162
|
-
var toNode = selection.$to.node(selection.$to.depth - 2);
|
|
163
|
-
|
|
164
|
-
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
|
|
165
|
-
var _tr2 = state.tr;
|
|
166
|
-
untoggleSelectedList(_tr2);
|
|
167
|
-
|
|
168
|
-
if (dispatch) {
|
|
169
|
-
dispatch(_tr2);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
(0, _conversions.convertListType)({
|
|
176
|
-
tr: tr,
|
|
177
|
-
nextListNodeType: listNodeType
|
|
178
|
-
});
|
|
179
|
-
} else {
|
|
180
|
-
// Need to have this before wrapInList so the wrapping is done with valid content
|
|
181
|
-
// For example, if trying to convert centre or right aligned paragraphs to lists
|
|
182
|
-
(0, _mark.sanitiseMarksInSelection)(tr, listNodeType);
|
|
183
|
-
(0, _wrapAndJoinLists.wrapInListAndJoin)(listNodeType, tr);
|
|
184
|
-
} // If document wasn't changed, return false from the command to indicate that the
|
|
185
|
-
// editing action failed
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (!tr.docChanged) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (dispatch) {
|
|
193
|
-
dispatch(tr);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return true;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function toggleBulletList(view) {
|
|
201
|
-
return toggleList('bulletList')(view.state, view.dispatch);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function toggleOrderedList(view) {
|
|
205
|
-
return toggleList('orderedList')(view.state, view.dispatch);
|
|
206
|
-
}
|
|
207
77
|
/**
|
|
208
78
|
* Implementation taken and modified for our needs from PM
|
|
209
79
|
* @param itemType Node
|
|
210
80
|
* Splits the list items, specific implementation take from PM
|
|
211
81
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
82
|
function splitListItem(itemType) {
|
|
215
83
|
return function (state, dispatch) {
|
|
216
84
|
var ref = state.selection;
|
|
@@ -243,7 +111,7 @@ function splitListItem(itemType) {
|
|
|
243
111
|
var keepItem = $from.index(-1) > 0; // Build a fragment containing empty versions of the structure
|
|
244
112
|
// from the outer list item to the parent node of the cursor
|
|
245
113
|
|
|
246
|
-
for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d
|
|
114
|
+
for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d -= 1) {
|
|
247
115
|
wrap = _prosemirrorModel.Fragment.from($from.node(d).copy(wrap));
|
|
248
116
|
} // Add a second list item with an empty default start node
|
|
249
117
|
|
|
@@ -295,17 +163,46 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
295
163
|
return false;
|
|
296
164
|
};
|
|
297
165
|
|
|
166
|
+
var enterKeyCommand = function enterKeyCommand(state, dispatch) {
|
|
167
|
+
var selection = state.selection;
|
|
168
|
+
|
|
169
|
+
if (selection.empty) {
|
|
170
|
+
var $from = selection.$from;
|
|
171
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
172
|
+
listItem = _state$schema$nodes.listItem,
|
|
173
|
+
codeBlock = _state$schema$nodes.codeBlock;
|
|
174
|
+
var node = $from.node($from.depth);
|
|
175
|
+
var wrapper = $from.node($from.depth - 1);
|
|
176
|
+
|
|
177
|
+
if (wrapper && wrapper.type === listItem) {
|
|
178
|
+
/** Check if the wrapper has any visible content */
|
|
179
|
+
var wrapperHasContent = (0, _document.hasVisibleContent)(wrapper);
|
|
180
|
+
|
|
181
|
+
if ((0, _document.isNodeEmpty)(node) && !wrapperHasContent) {
|
|
182
|
+
return (0, _outdentList.outdentList)()(state, dispatch);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!(0, _prosemirrorUtils.hasParentNodeOfType)(codeBlock)(selection)) {
|
|
186
|
+
return splitListItem(listItem)(state, dispatch);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return false;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
exports.enterKeyCommand = enterKeyCommand;
|
|
195
|
+
|
|
298
196
|
var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
|
|
299
197
|
var $from = state.selection.$from;
|
|
300
198
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
301
199
|
paragraph = _state$schema$nodes2.paragraph,
|
|
302
|
-
listItem = _state$schema$nodes2.listItem,
|
|
303
200
|
codeBlock = _state$schema$nodes2.codeBlock,
|
|
304
201
|
bulletList = _state$schema$nodes2.bulletList,
|
|
305
202
|
orderedList = _state$schema$nodes2.orderedList; // const isGapCursorShown = state.selection instanceof GapCursorSelection;
|
|
306
203
|
|
|
307
204
|
var $cutPos =
|
|
308
|
-
/*isGapCursorShown ? state.doc.resolve($from.pos + 1)
|
|
205
|
+
/* isGapCursorShown ? state.doc.resolve($from.pos + 1) : */
|
|
309
206
|
$from;
|
|
310
207
|
var $cut = (0, _commands.findCutBefore)($cutPos);
|
|
311
208
|
|
|
@@ -353,13 +250,12 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
|
|
|
353
250
|
|
|
354
251
|
if (stepResult.failed) {
|
|
355
252
|
return false;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
tr = state.tr.step(step); // }
|
|
359
256
|
// find out if there's now another list following and join them
|
|
360
257
|
// as in, [list, p, list] => [list with p, list], and we want [joined list]
|
|
361
258
|
|
|
362
|
-
|
|
363
259
|
var $postCut = tr.doc.resolve(tr.mapping.map($cut.pos + $cut.nodeAfter.nodeSize));
|
|
364
260
|
|
|
365
261
|
if ($postCut.nodeBefore && $postCut.nodeAfter && $postCut.nodeBefore.type === $postCut.nodeAfter.type && [bulletList, orderedList].indexOf($postCut.nodeBefore.type) > -1) {
|
|
@@ -377,6 +273,108 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
|
|
|
377
273
|
return false;
|
|
378
274
|
};
|
|
379
275
|
|
|
276
|
+
var backspaceKeyCommand = function backspaceKeyCommand(state, dispatch) {
|
|
277
|
+
return baseCommand.chainCommands(_listBackspace.listBackspace, // if we're at the start of a list item, we need to either backspace
|
|
278
|
+
// directly to an empty list item above, or outdent this node
|
|
279
|
+
(0, _commands.filter)([_commands.isEmptySelectionAtStart, // list items might have multiple paragraphs; only do this at the first one
|
|
280
|
+
_commands.isFirstChildOfParent, _selection.isInsideListItem], baseCommand.chainCommands(deletePreviousEmptyListItem, (0, _outdentList.outdentList)())), // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
|
|
281
|
+
// the text to the previous list item, if one exists
|
|
282
|
+
(0, _commands.filter)([function (state) {
|
|
283
|
+
return state.selection.empty;
|
|
284
|
+
}, _selection.canJoinToPreviousListItem], joinToPreviousListItem))(state, dispatch);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
exports.backspaceKeyCommand = backspaceKeyCommand;
|
|
288
|
+
var deleteKeyCommand = _joinListItemForward.joinListItemForward; // Get the depth of the nearest ancestor list
|
|
289
|
+
|
|
290
|
+
exports.deleteKeyCommand = deleteKeyCommand;
|
|
291
|
+
|
|
292
|
+
var rootListDepth = function rootListDepth(pos, nodes) {
|
|
293
|
+
var bulletList = nodes.bulletList,
|
|
294
|
+
orderedList = nodes.orderedList,
|
|
295
|
+
listItem = nodes.listItem;
|
|
296
|
+
var depth;
|
|
297
|
+
|
|
298
|
+
for (var i = pos.depth - 1; i > 0; i -= 1) {
|
|
299
|
+
var node = pos.node(i);
|
|
300
|
+
|
|
301
|
+
if (node.type === bulletList || node.type === orderedList) {
|
|
302
|
+
depth = i;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (node.type !== bulletList && node.type !== orderedList && node.type !== listItem) {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return depth;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
exports.rootListDepth = rootListDepth;
|
|
314
|
+
|
|
315
|
+
function untoggleSelectedList(tr) {
|
|
316
|
+
var selection = tr.selection;
|
|
317
|
+
var depth = rootListDepth(selection.$to, tr.doc.type.schema.nodes);
|
|
318
|
+
var newtr = (0, _transforms.liftFollowingList)(selection.$to.pos, selection.$to.end(depth), depth || 0, tr);
|
|
319
|
+
newtr = (0, _transforms.liftSelectionList)(selection, tr);
|
|
320
|
+
return newtr;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function toggleList(listType) {
|
|
324
|
+
return function (state, dispatch) {
|
|
325
|
+
var tr = state.tr;
|
|
326
|
+
var listInsideSelection = (0, _selection.selectionContainsList)(tr);
|
|
327
|
+
var listNodeType = state.schema.nodes[listType];
|
|
328
|
+
|
|
329
|
+
if (listInsideSelection) {
|
|
330
|
+
var selection = state.selection;
|
|
331
|
+
var fromNode = selection.$from.node(selection.$from.depth - 2);
|
|
332
|
+
var toNode = selection.$to.node(selection.$to.depth - 2);
|
|
333
|
+
|
|
334
|
+
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
|
|
335
|
+
var _tr = state.tr;
|
|
336
|
+
_tr = untoggleSelectedList(_tr);
|
|
337
|
+
|
|
338
|
+
if (dispatch) {
|
|
339
|
+
dispatch(_tr);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
(0, _conversions.convertListType)({
|
|
346
|
+
tr: tr,
|
|
347
|
+
nextListNodeType: listNodeType
|
|
348
|
+
});
|
|
349
|
+
} else {
|
|
350
|
+
// Need to have this before wrapInList so the wrapping is done with valid content
|
|
351
|
+
// For example, if trying to convert centre or right aligned paragraphs to lists
|
|
352
|
+
(0, _mark.sanitiseMarksInSelection)(tr, listNodeType);
|
|
353
|
+
(0, _wrapAndJoinLists.wrapInListAndJoin)(listNodeType, tr);
|
|
354
|
+
} // If document wasn't changed, return false from the command to indicate that the
|
|
355
|
+
// editing action failed
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
if (!tr.docChanged) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (dispatch) {
|
|
363
|
+
dispatch(tr);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return true;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function toggleBulletList(view) {
|
|
371
|
+
return toggleList("bulletList")(view.state, view.dispatch);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function toggleOrderedList(view) {
|
|
375
|
+
return toggleList("orderedList")(view.state, view.dispatch);
|
|
376
|
+
}
|
|
377
|
+
|
|
380
378
|
var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
|
|
381
379
|
insertions.forEach(function (contentInsert) {
|
|
382
380
|
var _contentInsert = _slicedToArray(contentInsert, 2),
|
|
@@ -91,7 +91,8 @@ function ColorSelector(_ref) {
|
|
|
91
91
|
style: {
|
|
92
92
|
backgroundColor: color
|
|
93
93
|
},
|
|
94
|
-
onClick: function onClick() {
|
|
94
|
+
onClick: function onClick(e) {
|
|
95
|
+
e.stopPropagation();
|
|
95
96
|
onClickItem(editor.state.schema.marks[_index2.BACKGROUND_COLOR_SCHEMA_NAME], color);
|
|
96
97
|
}
|
|
97
98
|
}));
|
|
@@ -106,7 +107,10 @@ function ColorSelector(_ref) {
|
|
|
106
107
|
return colors;
|
|
107
108
|
}, [background]);
|
|
108
109
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
109
|
-
className: preCls
|
|
110
|
+
className: preCls,
|
|
111
|
+
onClick: function onClick(e) {
|
|
112
|
+
return e.stopPropagation();
|
|
113
|
+
}
|
|
110
114
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
111
115
|
className: preCls + '__title'
|
|
112
116
|
}, "\u6587\u5B57\u989C\u8272"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -216,12 +220,6 @@ function ColorSelectorPop(_ref2) {
|
|
|
216
220
|
}, [activeColor, activeBackground]);
|
|
217
221
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
218
222
|
className: preCls + '__icon',
|
|
219
|
-
onMouseOver: function onMouseOver(e) {
|
|
220
|
-
return e.stopPropagation();
|
|
221
|
-
},
|
|
222
|
-
onMouseEnter: function onMouseEnter(e) {
|
|
223
|
-
return e.stopPropagation();
|
|
224
|
-
},
|
|
225
223
|
style: {
|
|
226
224
|
backgroundColor: activeBackground || _consts.BackgroundColor["default"],
|
|
227
225
|
color: activeColor || _consts.FontColor["default"]
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
font-weight: 500;
|
|
20
20
|
color: #141c28;
|
|
21
21
|
line-height: 38px;
|
|
22
|
+
padding: 36px 0 20px;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.tita-rich-editor h2 {
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
font-weight: 500;
|
|
27
28
|
color: #141c28;
|
|
28
29
|
line-height: 32px;
|
|
30
|
+
padding: 20px 0 8px;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.tita-rich-editor h3 {
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
font-weight: 500;
|
|
34
36
|
color: #3f4755;
|
|
35
37
|
line-height: 30px;
|
|
38
|
+
padding: 18px 0 8px;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
.tita-rich-editor p {
|
|
@@ -70,13 +70,16 @@ function RichEditor(_ref, ref) {
|
|
|
70
70
|
plugins: nativePlugins
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
var state = _prosemirrorState.EditorState.create(stateConf);
|
|
73
|
+
var state = _prosemirrorState.EditorState.create(stateConf); // debugger
|
|
74
|
+
|
|
74
75
|
|
|
75
76
|
if (defaultState) {
|
|
76
77
|
try {
|
|
77
78
|
var jsonState = typeof defaultState == 'string' ? JSON.parse(defaultState) : defaultState;
|
|
78
|
-
state = _prosemirrorState.EditorState.fromJSON(
|
|
79
|
-
} catch (e) {
|
|
79
|
+
state = _prosemirrorState.EditorState.fromJSON(stateConf, jsonState);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
console.log(e);
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
var pmEditor = new _prosemirrorView.EditorView(container.current, {
|
|
@@ -103,6 +106,20 @@ function RichEditor(_ref, ref) {
|
|
|
103
106
|
return dataRef.current.editor.destroy();
|
|
104
107
|
};
|
|
105
108
|
}, []);
|
|
109
|
+
var handleClick = (0, _react.useCallback)(function (e) {
|
|
110
|
+
var _dataRef$current$edit, _dataRef$current$edit2;
|
|
111
|
+
|
|
112
|
+
if (e.target != e.currentTarget) return;
|
|
113
|
+
var view = (_dataRef$current$edit = dataRef.current.editor) === null || _dataRef$current$edit === void 0 ? void 0 : _dataRef$current$edit.view;
|
|
114
|
+
if (!view) return;
|
|
115
|
+
var tr = view.state.tr;
|
|
116
|
+
|
|
117
|
+
var selection = _prosemirrorState.TextSelection.atEnd(view.state.doc);
|
|
118
|
+
|
|
119
|
+
view.dispatch(tr.setSelection(selection));
|
|
120
|
+
view.focus();
|
|
121
|
+
(_dataRef$current$edit2 = dataRef.current.editor) === null || _dataRef$current$edit2 === void 0 ? void 0 : _dataRef$current$edit2.view.focus();
|
|
122
|
+
}, []);
|
|
106
123
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
107
124
|
return {
|
|
108
125
|
getState: function getState() {
|
|
@@ -117,11 +134,7 @@ function RichEditor(_ref, ref) {
|
|
|
117
134
|
backgroundColor: "#FFF"
|
|
118
135
|
},
|
|
119
136
|
spellCheck: false,
|
|
120
|
-
onClick:
|
|
121
|
-
var _dataRef$current$edit;
|
|
122
|
-
|
|
123
|
-
return (_dataRef$current$edit = dataRef.current.editor) === null || _dataRef$current$edit === void 0 ? void 0 : _dataRef$current$edit.view.focus();
|
|
124
|
-
}
|
|
137
|
+
onClick: handleClick
|
|
125
138
|
});
|
|
126
139
|
}
|
|
127
140
|
|
|
@@ -156,7 +156,7 @@ var selectionContainsMark = function selectionContainsMark(state, markName) {
|
|
|
156
156
|
marks = state.storedMarks || $from.marks();
|
|
157
157
|
} else {
|
|
158
158
|
state.doc.nodesBetween(from, to, function (node) {
|
|
159
|
-
marks.concat(node.marks);
|
|
159
|
+
marks = marks.concat(node.marks);
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titaui/pc",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.41",
|
|
4
4
|
"nameCN": "",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"prosemirror-utils": "^0.9.6",
|
|
111
111
|
"prosemirror-view": "^1.23.6",
|
|
112
112
|
"qs": "^6.10.1",
|
|
113
|
+
"raf-schd": "^4.0.3",
|
|
113
114
|
"rc-cascader": "^2.2.0",
|
|
114
115
|
"rc-checkbox": "^2.3.2",
|
|
115
116
|
"rc-color-picker": "^1.2.6",
|