@titaui/pc 1.10.34 → 1.10.38

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.
Files changed (105) hide show
  1. package/lib/components/book-demo/utils.js +4 -0
  2. package/lib/components/okr-flow/export-modal/index.js +3 -3
  3. package/lib/components/rich-editor/basic/schema.js +47 -0
  4. package/lib/components/rich-editor/consts/events.js +12 -0
  5. package/lib/components/rich-editor/enums.js +42 -0
  6. package/lib/components/rich-editor/index.js +58 -0
  7. package/lib/components/rich-editor/keymap.js +119 -0
  8. package/lib/components/rich-editor/keymaps/index.js +241 -0
  9. package/lib/components/rich-editor/models/controller.js +18 -0
  10. package/lib/components/rich-editor/models/editor.js +47 -0
  11. package/lib/components/rich-editor/models/plugin.js +20 -0
  12. package/lib/components/rich-editor/models/schema.js +121 -0
  13. package/lib/components/rich-editor/plugins/block/block-quote/commond.js +27 -0
  14. package/lib/components/rich-editor/plugins/block/block-quote/index.js +126 -0
  15. package/lib/components/rich-editor/plugins/block/heading/commonds.js +31 -0
  16. package/lib/components/rich-editor/plugins/block/heading/index.js +188 -0
  17. package/lib/components/rich-editor/plugins/block/index.js +57 -0
  18. package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +172 -0
  19. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +163 -0
  20. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +59 -0
  21. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +74 -0
  22. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +45 -0
  23. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +104 -0
  24. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +92 -0
  25. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +89 -0
  26. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +48 -0
  27. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +61 -0
  28. package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +34 -0
  29. package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +289 -0
  30. package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +180 -0
  31. package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +328 -0
  32. package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +60 -0
  33. package/lib/components/rich-editor/plugins/block/lists/commond/index.js +398 -0
  34. package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +45 -0
  35. package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +302 -0
  36. package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +43 -0
  37. package/lib/components/rich-editor/plugins/block/lists/index.js +222 -0
  38. package/lib/components/rich-editor/plugins/block/lists/messages.js +38 -0
  39. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +152 -0
  40. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +33 -0
  41. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +94 -0
  42. package/lib/components/rich-editor/plugins/block/lists/styles.js +15 -0
  43. package/lib/components/rich-editor/plugins/block/lists/transforms.js +347 -0
  44. package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +48 -0
  45. package/lib/components/rich-editor/plugins/block/lists/utils/find.js +126 -0
  46. package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +87 -0
  47. package/lib/components/rich-editor/plugins/block/lists/utils/node.js +144 -0
  48. package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +31 -0
  49. package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +201 -0
  50. package/lib/components/rich-editor/plugins/block/lists/utils.js +52 -0
  51. package/lib/components/rich-editor/plugins/block/paragraph/index.js +91 -0
  52. package/lib/components/rich-editor/plugins/core/index.js +90 -0
  53. package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +67 -0
  54. package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +29 -0
  55. package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +80 -0
  56. package/lib/components/rich-editor/plugins/extension/alignment/commond.js +24 -0
  57. package/lib/components/rich-editor/plugins/extension/alignment/index.js +111 -0
  58. package/lib/components/rich-editor/plugins/extension/alignment/utils.js +19 -0
  59. package/lib/components/rich-editor/plugins/extension/index.js +18 -0
  60. package/lib/components/rich-editor/plugins/index.js +44 -0
  61. package/lib/components/rich-editor/plugins/inline/color/commond.js +128 -0
  62. package/lib/components/rich-editor/plugins/inline/color/consts.js +43 -0
  63. package/lib/components/rich-editor/plugins/inline/color/index.css +61 -0
  64. package/lib/components/rich-editor/plugins/inline/color/index.js +209 -0
  65. package/lib/components/rich-editor/plugins/inline/color/selector.js +252 -0
  66. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +147 -0
  67. package/lib/components/rich-editor/plugins/inline/em/index.js +93 -0
  68. package/lib/components/rich-editor/plugins/inline/index.js +83 -0
  69. package/lib/components/rich-editor/plugins/inline/link/commands.js +256 -0
  70. package/lib/components/rich-editor/plugins/inline/link/index.js +149 -0
  71. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +77 -0
  72. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +293 -0
  73. package/lib/components/rich-editor/plugins/inline/link/ui/index.css +79 -0
  74. package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +148 -0
  75. package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +88 -0
  76. package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +117 -0
  77. package/lib/components/rich-editor/plugins/inline/link/utils.js +33 -0
  78. package/lib/components/rich-editor/plugins/inline/strong/index.js +137 -0
  79. package/lib/components/rich-editor/plugins/inline/under-line/index.js +145 -0
  80. package/lib/components/rich-editor/plugins/util.js +281 -0
  81. package/lib/components/rich-editor/react/reactNodeView.js +383 -0
  82. package/lib/components/rich-editor/react/uiProvider.js +185 -0
  83. package/lib/components/rich-editor/schemas/basic.js +309 -0
  84. package/lib/components/rich-editor/schemas/index.js +19 -0
  85. package/lib/components/rich-editor/schemas/list.js +342 -0
  86. package/lib/components/rich-editor/types/commond.js +5 -0
  87. package/lib/components/rich-editor/types/index.js +18 -0
  88. package/lib/components/rich-editor/ui/Popup/index.js +247 -0
  89. package/lib/components/rich-editor/ui/Popup/utils.js +399 -0
  90. package/lib/components/rich-editor/ui/editor/index.css +141 -0
  91. package/lib/components/rich-editor/ui/editor/index.js +130 -0
  92. package/lib/components/rich-editor/ui/normal-toolbar/index.css +28 -0
  93. package/lib/components/rich-editor/ui/normal-toolbar/index.js +109 -0
  94. package/lib/components/rich-editor/utils/browser.js +35 -0
  95. package/lib/components/rich-editor/utils/commands.js +266 -0
  96. package/lib/components/rich-editor/utils/document.js +160 -0
  97. package/lib/components/rich-editor/utils/event.js +79 -0
  98. package/lib/components/rich-editor/utils/helpers.js +16 -0
  99. package/lib/components/rich-editor/utils/mark.js +168 -0
  100. package/lib/components/rich-editor/utils/slice.js +85 -0
  101. package/lib/components/rich-editor/utils/toolbar.js +228 -0
  102. package/lib/components/upload/index.js +4 -2
  103. package/lib/index.js +8 -0
  104. package/package.json +19 -2
  105. package/yarn-error.log +22184 -0
@@ -0,0 +1,168 @@
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;
@@ -0,0 +1,85 @@
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
+ }
@@ -0,0 +1,228 @@
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
+ }
@@ -501,11 +501,13 @@ var Upload = /*#__PURE__*/function (_PureComponent) {
501
501
  return Upload;
502
502
  }(_react.PureComponent);
503
503
 
504
- exports["default"] = Upload;
504
+ Upload.Preview = _uploadedPreview["default"];
505
505
  Upload.defaultProps = {
506
506
  fileNumLimit: 20,
507
507
  fileSizeLimit: 50,
508
508
  filesTotal: 50,
509
509
  multiple: true,
510
510
  attachmentPreviewBox: "MBlog__attachmentViewBox"
511
- };
511
+ };
512
+ var _default = Upload;
513
+ exports["default"] = _default;
package/lib/index.js CHANGED
@@ -375,6 +375,12 @@ Object.defineProperty(exports, "RangePickerPop", {
375
375
  return _rangePickerPop["default"];
376
376
  }
377
377
  });
378
+ Object.defineProperty(exports, "RichEditor", {
379
+ enumerable: true,
380
+ get: function get() {
381
+ return _richEditor["default"];
382
+ }
383
+ });
378
384
  Object.defineProperty(exports, "Scrollbar", {
379
385
  enumerable: true,
380
386
  get: function get() {
@@ -738,6 +744,8 @@ var _uploadPhotoModal = _interopRequireDefault(require("./components/upload-phot
738
744
 
739
745
  var _bookDemo = _interopRequireDefault(require("./components/book-demo"));
740
746
 
747
+ var _richEditor = _interopRequireDefault(require("./components/rich-editor"));
748
+
741
749
  var _videoModal = _interopRequireDefault(require("./components/video-modal"));
742
750
 
743
751
  var _supersetCharts = _interopRequireDefault(require("./components/superset-charts"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.10.34",
3
+ "version": "1.10.38",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -33,6 +33,7 @@
33
33
  "@storybook/addon-knobs": "^6.0.10",
34
34
  "@storybook/addon-links": "6.0.10",
35
35
  "@storybook/react": "6.0.10",
36
+ "@types/prosemirror-state": "^1.2.8",
36
37
  "@types/styled-components": "^5.1.2",
37
38
  "@typescript-eslint/eslint-plugin": "^5.10.0",
38
39
  "@typescript-eslint/parser": "^5.10.0",
@@ -76,12 +77,15 @@
76
77
  "@titaui/rc-trigger": "^5.2.5",
77
78
  "@titaui/react-flow-renderer": "9.5.4",
78
79
  "@titaui/toast": "^1.0.0",
80
+ "@types/color": "^3.0.3",
81
+ "@types/prosemirror-commands": "^1.0.4",
82
+ "@types/prosemirror-schema-basic": "^1.0.2",
79
83
  "axios": "^0.21.1",
80
84
  "bowser": "^2.11.0",
81
85
  "can-use-dom": "^0.1.0",
82
86
  "classnames": "^2.2.6",
83
87
  "clone-deep": "^4.0.1",
84
- "color": "^3.2.1",
88
+ "color": "^4.2.1",
85
89
  "cos-js-sdk-v5": "^1.3.3",
86
90
  "dayjs": "^1.10.4",
87
91
  "html2canvas": "1.3.2",
@@ -92,6 +96,19 @@
92
96
  "lodash.throttle": "^4.1.1",
93
97
  "lottie-web": "^5.7.12",
94
98
  "moment": "^2.29.1",
99
+ "prosemirror-commands": "^1.2.1",
100
+ "prosemirror-example-setup": "^1.1.2",
101
+ "prosemirror-history": "^1.2.0",
102
+ "prosemirror-inputrules": "^1.1.3",
103
+ "prosemirror-keymap": "^1.1.5",
104
+ "prosemirror-model": "^1.16.1",
105
+ "prosemirror-schema-basic": "^1.1.2",
106
+ "prosemirror-schema-list": "^1.1.6",
107
+ "prosemirror-state": "^1.3.4",
108
+ "prosemirror-tables": "^1.1.1",
109
+ "prosemirror-transform": "^1.3.4",
110
+ "prosemirror-utils": "^0.9.6",
111
+ "prosemirror-view": "^1.23.6",
95
112
  "qs": "^6.10.1",
96
113
  "rc-cascader": "^2.2.0",
97
114
  "rc-checkbox": "^2.3.2",