@titaui/pc 1.10.39 → 1.10.43
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/dynamic/dynamic-item/dynamic-chart/index.js +18 -3
- package/lib/components/upload/index.js +2 -4
- package/lib/index.js +0 -8
- package/package.json +2 -20
- package/lib/components/rich-editor/basic/schema.js +0 -47
- package/lib/components/rich-editor/consts/events.js +0 -12
- package/lib/components/rich-editor/enums.js +0 -42
- package/lib/components/rich-editor/index.js +0 -58
- package/lib/components/rich-editor/keymap.js +0 -119
- package/lib/components/rich-editor/keymaps/index.js +0 -241
- package/lib/components/rich-editor/models/controller.js +0 -18
- package/lib/components/rich-editor/models/editor.js +0 -47
- package/lib/components/rich-editor/models/plugin.js +0 -20
- package/lib/components/rich-editor/models/schema.js +0 -121
- package/lib/components/rich-editor/plugins/block/block-quote/commond.js +0 -27
- package/lib/components/rich-editor/plugins/block/block-quote/index.js +0 -126
- package/lib/components/rich-editor/plugins/block/heading/commonds.js +0 -31
- package/lib/components/rich-editor/plugins/block/heading/index.js +0 -188
- package/lib/components/rich-editor/plugins/block/index.js +0 -57
- package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +0 -172
- package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +0 -163
- package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +0 -59
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +0 -74
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +0 -45
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -104
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -92
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -89
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -48
- package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -61
- package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +0 -34
- package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +0 -289
- package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +0 -180
- package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +0 -328
- package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +0 -60
- package/lib/components/rich-editor/plugins/block/lists/commond/index.js +0 -398
- package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +0 -45
- package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +0 -302
- package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +0 -43
- package/lib/components/rich-editor/plugins/block/lists/index.js +0 -222
- package/lib/components/rich-editor/plugins/block/lists/messages.js +0 -38
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +0 -152
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +0 -33
- package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +0 -94
- package/lib/components/rich-editor/plugins/block/lists/styles.js +0 -15
- package/lib/components/rich-editor/plugins/block/lists/transforms.js +0 -347
- package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +0 -48
- package/lib/components/rich-editor/plugins/block/lists/utils/find.js +0 -126
- package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +0 -87
- package/lib/components/rich-editor/plugins/block/lists/utils/node.js +0 -144
- package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +0 -31
- package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +0 -201
- package/lib/components/rich-editor/plugins/block/lists/utils.js +0 -52
- package/lib/components/rich-editor/plugins/block/paragraph/index.js +0 -91
- package/lib/components/rich-editor/plugins/core/index.js +0 -90
- package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +0 -67
- package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +0 -29
- package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +0 -80
- package/lib/components/rich-editor/plugins/extension/alignment/commond.js +0 -24
- package/lib/components/rich-editor/plugins/extension/alignment/index.js +0 -111
- package/lib/components/rich-editor/plugins/extension/alignment/utils.js +0 -19
- package/lib/components/rich-editor/plugins/extension/index.js +0 -18
- package/lib/components/rich-editor/plugins/index.js +0 -44
- package/lib/components/rich-editor/plugins/inline/color/commond.js +0 -128
- package/lib/components/rich-editor/plugins/inline/color/consts.js +0 -43
- package/lib/components/rich-editor/plugins/inline/color/index.css +0 -61
- package/lib/components/rich-editor/plugins/inline/color/index.js +0 -209
- package/lib/components/rich-editor/plugins/inline/color/selector.js +0 -252
- package/lib/components/rich-editor/plugins/inline/delete-line/index.js +0 -147
- package/lib/components/rich-editor/plugins/inline/em/index.js +0 -93
- package/lib/components/rich-editor/plugins/inline/index.js +0 -83
- package/lib/components/rich-editor/plugins/inline/link/commands.js +0 -256
- package/lib/components/rich-editor/plugins/inline/link/index.js +0 -149
- package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +0 -77
- package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +0 -293
- package/lib/components/rich-editor/plugins/inline/link/ui/index.css +0 -79
- package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +0 -148
- package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +0 -88
- package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +0 -117
- package/lib/components/rich-editor/plugins/inline/link/utils.js +0 -33
- package/lib/components/rich-editor/plugins/inline/strong/index.js +0 -137
- package/lib/components/rich-editor/plugins/inline/under-line/index.js +0 -145
- package/lib/components/rich-editor/plugins/util.js +0 -281
- package/lib/components/rich-editor/react/reactNodeView.js +0 -383
- package/lib/components/rich-editor/react/uiProvider.js +0 -185
- package/lib/components/rich-editor/schemas/basic.js +0 -309
- package/lib/components/rich-editor/schemas/index.js +0 -19
- package/lib/components/rich-editor/schemas/list.js +0 -342
- package/lib/components/rich-editor/types/commond.js +0 -5
- package/lib/components/rich-editor/types/index.js +0 -18
- package/lib/components/rich-editor/ui/Popup/index.js +0 -247
- package/lib/components/rich-editor/ui/Popup/utils.js +0 -399
- package/lib/components/rich-editor/ui/editor/index.css +0 -141
- package/lib/components/rich-editor/ui/editor/index.js +0 -130
- package/lib/components/rich-editor/ui/normal-toolbar/index.css +0 -28
- package/lib/components/rich-editor/ui/normal-toolbar/index.js +0 -109
- package/lib/components/rich-editor/utils/browser.js +0 -35
- package/lib/components/rich-editor/utils/commands.js +0 -266
- package/lib/components/rich-editor/utils/document.js +0 -160
- package/lib/components/rich-editor/utils/event.js +0 -79
- package/lib/components/rich-editor/utils/helpers.js +0 -16
- package/lib/components/rich-editor/utils/mark.js +0 -168
- package/lib/components/rich-editor/utils/slice.js +0 -85
- package/lib/components/rich-editor/utils/toolbar.js +0 -228
- package/yarn-error.log +0 -22184
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.selectionContainsMark = exports.sanitiseSelectionMarksForWrapping = exports.sanitiseMarksInSelection = exports.removeBlockMarks = exports.isMarkExcluded = exports.isMarkAllowedInRange = void 0;
|
|
7
|
-
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
|
|
10
|
-
var isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
|
|
11
|
-
var _loop = function _loop(i) {
|
|
12
|
-
var _ranges$i = ranges[i],
|
|
13
|
-
$from = _ranges$i.$from,
|
|
14
|
-
$to = _ranges$i.$to;
|
|
15
|
-
var can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
|
|
16
|
-
doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
17
|
-
if (can) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
can = node.inlineContent && node.type.allowsMarkType(type);
|
|
22
|
-
return;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if (can) {
|
|
26
|
-
return {
|
|
27
|
-
v: can
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
for (var i = 0; i < ranges.length; i++) {
|
|
33
|
-
var _ret = _loop(i);
|
|
34
|
-
|
|
35
|
-
if (_typeof(_ret) === "object") return _ret.v;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return false;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
exports.isMarkAllowedInRange = isMarkAllowedInRange;
|
|
42
|
-
|
|
43
|
-
var isMarkExcluded = function isMarkExcluded(type, marks) {
|
|
44
|
-
if (marks) {
|
|
45
|
-
return marks.some(function (mark) {
|
|
46
|
-
return mark.type !== type && mark.type.excludes(type);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return false;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
exports.isMarkExcluded = isMarkExcluded;
|
|
54
|
-
|
|
55
|
-
var not = function not(fn) {
|
|
56
|
-
return function (arg) {
|
|
57
|
-
return !fn(arg);
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var removeBlockMarks = function removeBlockMarks(state, marks) {
|
|
62
|
-
var selection = state.selection,
|
|
63
|
-
schema = state.schema;
|
|
64
|
-
var tr = state.tr; // Marks might not exist in Schema
|
|
65
|
-
|
|
66
|
-
var marksToRemove = marks.filter(Boolean);
|
|
67
|
-
|
|
68
|
-
if (marksToRemove.length === 0) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
/** Saves an extra dispatch */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var blockMarksExists = false;
|
|
75
|
-
|
|
76
|
-
var hasMark = function hasMark(mark) {
|
|
77
|
-
return marksToRemove.indexOf(mark.type) > -1;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* When you need to toggle the selection
|
|
81
|
-
* when another type which does not allow alignment is applied
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
state.doc.nodesBetween(selection.from, selection.to, function (node, pos) {
|
|
86
|
-
if (node.type === schema.nodes.paragraph && node.marks.some(hasMark)) {
|
|
87
|
-
blockMarksExists = true;
|
|
88
|
-
var resolvedPos = state.doc.resolve(pos);
|
|
89
|
-
var withoutBlockMarks = node.marks.filter(not(hasMark));
|
|
90
|
-
tr = tr.setNodeMarkup(resolvedPos.pos, undefined, node.attrs, withoutBlockMarks);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return blockMarksExists ? tr : undefined;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Removes marks from nodes in the current selection that are not supported
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
exports.removeBlockMarks = removeBlockMarks;
|
|
101
|
-
|
|
102
|
-
var sanitiseSelectionMarksForWrapping = function sanitiseSelectionMarksForWrapping(state, newParentType) {
|
|
103
|
-
var tr = state.tr;
|
|
104
|
-
sanitiseMarksInSelection(tr, newParentType);
|
|
105
|
-
return tr;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
exports.sanitiseSelectionMarksForWrapping = sanitiseSelectionMarksForWrapping;
|
|
109
|
-
|
|
110
|
-
var sanitiseMarksInSelection = function sanitiseMarksInSelection(tr, newParentType) {
|
|
111
|
-
var _tr$selection = tr.selection,
|
|
112
|
-
from = _tr$selection.from,
|
|
113
|
-
to = _tr$selection.to;
|
|
114
|
-
var nodesSanitized = [];
|
|
115
|
-
tr.doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
116
|
-
if (node.isText) {
|
|
117
|
-
return false;
|
|
118
|
-
} // Skip expands and layouts if they are outside selection
|
|
119
|
-
// but continue to iterate over their children.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (['expand', 'layoutSection'].includes(node.type.name) && (pos < from || pos > to)) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
node.marks.forEach(function (mark) {
|
|
127
|
-
if (!parent.type.allowsMarkType(mark.type) || newParentType && !newParentType.allowsMarkType(mark.type)) {
|
|
128
|
-
var filteredMarks = node.marks.filter(function (m) {
|
|
129
|
-
return m.type !== mark.type;
|
|
130
|
-
});
|
|
131
|
-
var position = pos > 0 ? pos : 0;
|
|
132
|
-
var marksRemoved = node.marks.filter(function (m) {
|
|
133
|
-
return m.type === mark.type;
|
|
134
|
-
});
|
|
135
|
-
nodesSanitized.push({
|
|
136
|
-
node: node,
|
|
137
|
-
marksRemoved: marksRemoved
|
|
138
|
-
});
|
|
139
|
-
tr.setNodeMarkup(position, undefined, node.attrs, filteredMarks);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
return nodesSanitized;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
exports.sanitiseMarksInSelection = sanitiseMarksInSelection;
|
|
147
|
-
|
|
148
|
-
var selectionContainsMark = function selectionContainsMark(state, markName) {
|
|
149
|
-
var _state$selection = state.selection,
|
|
150
|
-
from = _state$selection.from,
|
|
151
|
-
to = _state$selection.to,
|
|
152
|
-
$from = _state$selection.$from;
|
|
153
|
-
var marks = [];
|
|
154
|
-
|
|
155
|
-
if (from == to) {
|
|
156
|
-
marks = state.storedMarks || $from.marks();
|
|
157
|
-
} else {
|
|
158
|
-
state.doc.nodesBetween(from, to, function (node) {
|
|
159
|
-
marks.concat(node.marks);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return marks.findIndex(function (m) {
|
|
164
|
-
return m.type.name == markName;
|
|
165
|
-
}) !== -1;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
exports.selectionContainsMark = selectionContainsMark;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.flatmap = flatmap;
|
|
7
|
-
exports.getFragmentBackingArray = getFragmentBackingArray;
|
|
8
|
-
exports.mapChildren = mapChildren;
|
|
9
|
-
exports.mapFragment = mapFragment;
|
|
10
|
-
exports.mapSlice = mapSlice;
|
|
11
|
-
|
|
12
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
13
|
-
|
|
14
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
-
|
|
16
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
|
|
18
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
-
|
|
20
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
|
-
|
|
22
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
-
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A helper to get the underlying array of a fragment.
|
|
28
|
-
*/
|
|
29
|
-
function getFragmentBackingArray(fragment) {
|
|
30
|
-
return fragment.content;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function mapFragment(content, callback) {
|
|
34
|
-
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
35
|
-
var children = [];
|
|
36
|
-
|
|
37
|
-
for (var i = 0, size = content.childCount; i < size; i++) {
|
|
38
|
-
var _node = content.child(i);
|
|
39
|
-
|
|
40
|
-
var transformed = _node.isLeaf ? callback(_node, parent, i) : callback(_node.copy(mapFragment(_node.content, callback, _node)), parent, i);
|
|
41
|
-
|
|
42
|
-
if (transformed) {
|
|
43
|
-
if (transformed instanceof _prosemirrorModel.Fragment) {
|
|
44
|
-
children.push.apply(children, _toConsumableArray(getFragmentBackingArray(transformed)));
|
|
45
|
-
} else if (Array.isArray(transformed)) {
|
|
46
|
-
children.push.apply(children, _toConsumableArray(transformed));
|
|
47
|
-
} else {
|
|
48
|
-
children.push(transformed);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return _prosemirrorModel.Fragment.fromArray(children);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function mapSlice(slice, callback) {
|
|
57
|
-
var fragment = mapFragment(slice.content, callback);
|
|
58
|
-
return new _prosemirrorModel.Slice(fragment, slice.openStart, slice.openEnd);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function flatmap(fragment, callback) {
|
|
62
|
-
var fragmentContent = [];
|
|
63
|
-
|
|
64
|
-
for (var i = 0; i < fragment.childCount; i++) {
|
|
65
|
-
var child = callback(fragment.child(i), i, fragment);
|
|
66
|
-
|
|
67
|
-
if (Array.isArray(child)) {
|
|
68
|
-
fragmentContent.push.apply(fragmentContent, _toConsumableArray(child));
|
|
69
|
-
} else {
|
|
70
|
-
fragmentContent.push(child);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return _prosemirrorModel.Fragment.fromArray(fragmentContent);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function mapChildren(node, callback) {
|
|
78
|
-
var array = [];
|
|
79
|
-
|
|
80
|
-
for (var i = 0; i < node.childCount; i++) {
|
|
81
|
-
array.push(callback(node.child(i), i, node instanceof _prosemirrorModel.Fragment ? node : node.content));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return array;
|
|
85
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getMenuDescibitionFromType = getMenuDescibitionFromType;
|
|
7
|
-
exports.handleClickToolMenu = handleClickToolMenu;
|
|
8
|
-
exports.headingIsActive = headingIsActive;
|
|
9
|
-
exports.markActive = markActive;
|
|
10
|
-
exports.orderedListIsActive = orderedListIsActive;
|
|
11
|
-
|
|
12
|
-
var _prosemirrorCommands = require("prosemirror-commands");
|
|
13
|
-
|
|
14
|
-
var _schemas = _interopRequireDefault(require("../schemas"));
|
|
15
|
-
|
|
16
|
-
var _commands = require("./commands");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
function getMenuDescibitionFromType(type) {
|
|
21
|
-
switch (type) {
|
|
22
|
-
case 'h1':
|
|
23
|
-
return {
|
|
24
|
-
title: '一级标题',
|
|
25
|
-
icon: 'tu-icon-text-H1'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
case 'h2':
|
|
29
|
-
return {
|
|
30
|
-
title: '二级标题',
|
|
31
|
-
icon: 'tu-icon-text-H2'
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
case 'h3':
|
|
35
|
-
return {
|
|
36
|
-
title: '三级标题',
|
|
37
|
-
icon: 'tu-icon-text-H3'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
case 'strong':
|
|
41
|
-
return {
|
|
42
|
-
title: '加粗',
|
|
43
|
-
icon: 'tu-icon-text-blod'
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
case 'color':
|
|
47
|
-
return {
|
|
48
|
-
title: '文字颜色',
|
|
49
|
-
icon: 'tu-icon-text-color'
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
case 'underLine':
|
|
53
|
-
return {
|
|
54
|
-
title: '下划线',
|
|
55
|
-
icon: 'tu-icon-text-underline'
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
case 'deleteLine':
|
|
59
|
-
return {
|
|
60
|
-
title: '删除线',
|
|
61
|
-
icon: 'tu-icon-text-delline'
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
case 'orderList':
|
|
65
|
-
return {
|
|
66
|
-
title: '有序列表',
|
|
67
|
-
icon: 'tu-icon-text-number-list'
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
case 'unOrderList':
|
|
71
|
-
return {
|
|
72
|
-
title: '无序列表',
|
|
73
|
-
icon: 'tu-icon-text-bullet-list'
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
case 'left':
|
|
77
|
-
return {
|
|
78
|
-
title: '左对齐',
|
|
79
|
-
icon: 'tu-icon-text-left'
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
case 'center':
|
|
83
|
-
return {
|
|
84
|
-
title: '居中对齐',
|
|
85
|
-
icon: 'tu-icon-text-center'
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
case 'right':
|
|
89
|
-
return {
|
|
90
|
-
title: '右对齐',
|
|
91
|
-
icon: 'tu-icon-text-right'
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
case 'task':
|
|
95
|
-
return {
|
|
96
|
-
title: '任务',
|
|
97
|
-
icon: 'tu-icon-text-task'
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
case 'checkList':
|
|
101
|
-
return {
|
|
102
|
-
title: '清单',
|
|
103
|
-
icon: 'tu-icon-text-box'
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
case 'table':
|
|
107
|
-
return {
|
|
108
|
-
title: '表格',
|
|
109
|
-
icon: 'tu-icon-text-table'
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
case 'image':
|
|
113
|
-
return {
|
|
114
|
-
title: '图片/视频',
|
|
115
|
-
icon: 'tu-icon-text-photo'
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
case 'quote':
|
|
119
|
-
return {
|
|
120
|
-
title: '引用',
|
|
121
|
-
icon: 'tu-icon-text-quotel'
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
case 'link':
|
|
125
|
-
return {
|
|
126
|
-
title: '链接',
|
|
127
|
-
icon: 'tu-icon-text-link'
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
case 'at':
|
|
131
|
-
return {
|
|
132
|
-
title: '@人',
|
|
133
|
-
icon: 'tu-icon-text-man'
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
default:
|
|
137
|
-
return {
|
|
138
|
-
title: '',
|
|
139
|
-
icon: ''
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function handleClickToolMenu(state, dispatchTransiction, type) {
|
|
145
|
-
switch (type) {
|
|
146
|
-
case 'h1':
|
|
147
|
-
return (0, _commands.setHeadLine)(state, dispatchTransiction, 1);
|
|
148
|
-
|
|
149
|
-
case 'h2':
|
|
150
|
-
return (0, _commands.setHeadLine)(state, dispatchTransiction, 2);
|
|
151
|
-
|
|
152
|
-
case 'h3':
|
|
153
|
-
return (0, _commands.setHeadLine)(state, dispatchTransiction, 3);
|
|
154
|
-
|
|
155
|
-
case 'strong':
|
|
156
|
-
return (0, _prosemirrorCommands.toggleMark)(_schemas["default"].marks.strong)(state, dispatchTransiction);
|
|
157
|
-
|
|
158
|
-
case 'color':
|
|
159
|
-
return;
|
|
160
|
-
|
|
161
|
-
case 'underLine':
|
|
162
|
-
return (0, _prosemirrorCommands.toggleMark)(_schemas["default"].marks.underLine)(state, dispatchTransiction);
|
|
163
|
-
|
|
164
|
-
case 'deleteLine':
|
|
165
|
-
return (0, _prosemirrorCommands.toggleMark)(_schemas["default"].marks.deleteLine)(state, dispatchTransiction);
|
|
166
|
-
|
|
167
|
-
case 'orderList':
|
|
168
|
-
return (0, _commands.toggleList)(state, dispatchTransiction, _schemas["default"].nodes.ordered_list);
|
|
169
|
-
|
|
170
|
-
case 'unOrderList':
|
|
171
|
-
return (0, _commands.toggleList)(state, dispatchTransiction, _schemas["default"].nodes.bullet_list);
|
|
172
|
-
|
|
173
|
-
case 'left':
|
|
174
|
-
case 'center':
|
|
175
|
-
case 'right':
|
|
176
|
-
return (0, _commands.setAlignment)(state, dispatchTransiction, type);
|
|
177
|
-
|
|
178
|
-
case 'task':
|
|
179
|
-
return;
|
|
180
|
-
|
|
181
|
-
case 'checkList':
|
|
182
|
-
return;
|
|
183
|
-
|
|
184
|
-
case 'table':
|
|
185
|
-
return;
|
|
186
|
-
|
|
187
|
-
case 'image':
|
|
188
|
-
return;
|
|
189
|
-
|
|
190
|
-
case 'quote':
|
|
191
|
-
return;
|
|
192
|
-
|
|
193
|
-
case 'link':
|
|
194
|
-
return;
|
|
195
|
-
|
|
196
|
-
case 'at':
|
|
197
|
-
return;
|
|
198
|
-
|
|
199
|
-
default:
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function headingIsActive(state, level) {
|
|
207
|
-
var $from = state.selection.$from;
|
|
208
|
-
var node = $from.node();
|
|
209
|
-
return node.type === _schemas["default"].nodes.heading && node.attrs.level === level;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function markActive(state, type) {
|
|
213
|
-
var _state$selection = state.selection,
|
|
214
|
-
from = _state$selection.from,
|
|
215
|
-
$from = _state$selection.$from,
|
|
216
|
-
to = _state$selection.to,
|
|
217
|
-
empty = _state$selection.empty;
|
|
218
|
-
if (empty) return type.isInSet(state.storedMarks || $from.marks());else return state.doc.rangeHasMark(from, to, type);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function orderedListIsActive(state) {// const { $from,ranges } = state.selection;
|
|
222
|
-
// const node = $from.node();
|
|
223
|
-
// for(let range of ranges) {
|
|
224
|
-
// state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
225
|
-
// // console.log(node)
|
|
226
|
-
// })
|
|
227
|
-
// }
|
|
228
|
-
}
|