@titaui/pc 1.10.40 → 1.10.44-beta.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.
Files changed (107) hide show
  1. package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +18 -3
  2. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-project.js +5 -1
  3. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/index.css +19 -1
  4. package/lib/components/superset-charts/utils/axios.js +2 -2
  5. package/lib/components/upload/index.js +2 -4
  6. package/lib/index.js +0 -8
  7. package/package.json +2 -20
  8. package/lib/components/rich-editor/basic/schema.js +0 -47
  9. package/lib/components/rich-editor/consts/events.js +0 -12
  10. package/lib/components/rich-editor/enums.js +0 -42
  11. package/lib/components/rich-editor/index.js +0 -58
  12. package/lib/components/rich-editor/keymap.js +0 -119
  13. package/lib/components/rich-editor/keymaps/index.js +0 -241
  14. package/lib/components/rich-editor/models/controller.js +0 -18
  15. package/lib/components/rich-editor/models/editor.js +0 -47
  16. package/lib/components/rich-editor/models/plugin.js +0 -20
  17. package/lib/components/rich-editor/models/schema.js +0 -121
  18. package/lib/components/rich-editor/plugins/block/block-quote/commond.js +0 -27
  19. package/lib/components/rich-editor/plugins/block/block-quote/index.js +0 -126
  20. package/lib/components/rich-editor/plugins/block/heading/commonds.js +0 -31
  21. package/lib/components/rich-editor/plugins/block/heading/index.js +0 -188
  22. package/lib/components/rich-editor/plugins/block/index.js +0 -57
  23. package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +0 -172
  24. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +0 -163
  25. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +0 -59
  26. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +0 -74
  27. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +0 -45
  28. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -104
  29. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -92
  30. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -89
  31. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -48
  32. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -61
  33. package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +0 -34
  34. package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +0 -289
  35. package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +0 -180
  36. package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +0 -328
  37. package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +0 -60
  38. package/lib/components/rich-editor/plugins/block/lists/commond/index.js +0 -398
  39. package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +0 -45
  40. package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +0 -302
  41. package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +0 -43
  42. package/lib/components/rich-editor/plugins/block/lists/index.js +0 -222
  43. package/lib/components/rich-editor/plugins/block/lists/messages.js +0 -38
  44. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +0 -152
  45. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +0 -33
  46. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +0 -94
  47. package/lib/components/rich-editor/plugins/block/lists/styles.js +0 -15
  48. package/lib/components/rich-editor/plugins/block/lists/transforms.js +0 -347
  49. package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +0 -48
  50. package/lib/components/rich-editor/plugins/block/lists/utils/find.js +0 -126
  51. package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +0 -87
  52. package/lib/components/rich-editor/plugins/block/lists/utils/node.js +0 -144
  53. package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +0 -31
  54. package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +0 -201
  55. package/lib/components/rich-editor/plugins/block/lists/utils.js +0 -52
  56. package/lib/components/rich-editor/plugins/block/paragraph/index.js +0 -91
  57. package/lib/components/rich-editor/plugins/core/index.js +0 -90
  58. package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +0 -67
  59. package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +0 -29
  60. package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +0 -80
  61. package/lib/components/rich-editor/plugins/extension/alignment/commond.js +0 -24
  62. package/lib/components/rich-editor/plugins/extension/alignment/index.js +0 -111
  63. package/lib/components/rich-editor/plugins/extension/alignment/utils.js +0 -19
  64. package/lib/components/rich-editor/plugins/extension/index.js +0 -18
  65. package/lib/components/rich-editor/plugins/index.js +0 -44
  66. package/lib/components/rich-editor/plugins/inline/color/commond.js +0 -128
  67. package/lib/components/rich-editor/plugins/inline/color/consts.js +0 -43
  68. package/lib/components/rich-editor/plugins/inline/color/index.css +0 -61
  69. package/lib/components/rich-editor/plugins/inline/color/index.js +0 -209
  70. package/lib/components/rich-editor/plugins/inline/color/selector.js +0 -250
  71. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +0 -147
  72. package/lib/components/rich-editor/plugins/inline/em/index.js +0 -93
  73. package/lib/components/rich-editor/plugins/inline/index.js +0 -83
  74. package/lib/components/rich-editor/plugins/inline/link/commands.js +0 -256
  75. package/lib/components/rich-editor/plugins/inline/link/index.js +0 -149
  76. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +0 -77
  77. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +0 -293
  78. package/lib/components/rich-editor/plugins/inline/link/ui/index.css +0 -79
  79. package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +0 -148
  80. package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +0 -88
  81. package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +0 -117
  82. package/lib/components/rich-editor/plugins/inline/link/utils.js +0 -33
  83. package/lib/components/rich-editor/plugins/inline/strong/index.js +0 -137
  84. package/lib/components/rich-editor/plugins/inline/under-line/index.js +0 -145
  85. package/lib/components/rich-editor/plugins/util.js +0 -281
  86. package/lib/components/rich-editor/react/reactNodeView.js +0 -383
  87. package/lib/components/rich-editor/react/uiProvider.js +0 -185
  88. package/lib/components/rich-editor/schemas/basic.js +0 -309
  89. package/lib/components/rich-editor/schemas/index.js +0 -19
  90. package/lib/components/rich-editor/schemas/list.js +0 -342
  91. package/lib/components/rich-editor/types/commond.js +0 -5
  92. package/lib/components/rich-editor/types/index.js +0 -18
  93. package/lib/components/rich-editor/ui/Popup/index.js +0 -247
  94. package/lib/components/rich-editor/ui/Popup/utils.js +0 -399
  95. package/lib/components/rich-editor/ui/editor/index.css +0 -144
  96. package/lib/components/rich-editor/ui/editor/index.js +0 -143
  97. package/lib/components/rich-editor/ui/normal-toolbar/index.css +0 -29
  98. package/lib/components/rich-editor/ui/normal-toolbar/index.js +0 -109
  99. package/lib/components/rich-editor/utils/browser.js +0 -35
  100. package/lib/components/rich-editor/utils/commands.js +0 -266
  101. package/lib/components/rich-editor/utils/document.js +0 -160
  102. package/lib/components/rich-editor/utils/event.js +0 -79
  103. package/lib/components/rich-editor/utils/helpers.js +0 -16
  104. package/lib/components/rich-editor/utils/mark.js +0 -168
  105. package/lib/components/rich-editor/utils/slice.js +0 -85
  106. package/lib/components/rich-editor/utils/toolbar.js +0 -228
  107. package/yarn-error.log +0 -22184
@@ -1,144 +0,0 @@
1
- .tita-rich-editor {
2
- min-height: 300px;
3
- cursor: text;
4
- li-line-height: 38px;
5
- }
6
-
7
- .tita-rich-editor--disabled {
8
- cursor: default;
9
- }
10
-
11
- .tita-rich-editor .ProseMirror {
12
- min-height: 100%;
13
- outline: none;
14
- font-size: 16px;
15
- }
16
-
17
- .tita-rich-editor h1 {
18
- font-size: 26px;
19
- font-weight: 500;
20
- color: #141c28;
21
- line-height: 38px;
22
- padding: 36px 0 20px;
23
- }
24
-
25
- .tita-rich-editor h2 {
26
- font-size: 22px;
27
- font-weight: 500;
28
- color: #141c28;
29
- line-height: 32px;
30
- padding: 20px 0 8px;
31
- }
32
-
33
- .tita-rich-editor h3 {
34
- font-size: 20px;
35
- font-weight: 500;
36
- color: #3f4755;
37
- line-height: 30px;
38
- padding: 18px 0 8px;
39
- }
40
-
41
- .tita-rich-editor p {
42
- font-size: 16px;
43
- font-weight: 400;
44
- color: #3f4755;
45
- line-height: 26px;
46
- padding: 6px 0;
47
- }
48
-
49
- .tita-rich-editor ol,
50
- .tita-rich-editor ul {
51
- padding-left: 22px;
52
- }
53
-
54
- .tita-rich-editor ol > li {
55
- list-style: decimal outside !important;
56
- }
57
-
58
- .tita-rich-editor ol ol > li {
59
- list-style: lower-latin outside !important;
60
- }
61
-
62
- .tita-rich-editor ol ol ol > li {
63
- list-style: lower-roman outside !important;
64
- }
65
-
66
- .tita-rich-editor ol ol ol ol > li {
67
- list-style: decimal outside !important;
68
- }
69
-
70
- .tita-rich-editor ol ol ol ol ol > li {
71
- list-style: lower-latin outside !important;
72
- }
73
-
74
- .tita-rich-editor ol ol ol ol ol ol > li {
75
- list-style: lower-roman outside !important;
76
- }
77
-
78
- .tita-rich-editor ul > li {
79
- list-style: disc outside !important;
80
- }
81
-
82
- .tita-rich-editor ul ul > li {
83
- list-style: circle outside !important;
84
- }
85
-
86
- .tita-rich-editor ul ul ul > li {
87
- list-style: square outside !important;
88
- }
89
-
90
- .tita-rich-editor ul ul ul ul > li {
91
- list-style: disc outside !important;
92
- }
93
-
94
- .tita-rich-editor ul ul ul ul ul > li {
95
- list-style: circle outside !important;
96
- }
97
-
98
- .tita-rich-editor ul ul ul ul ul ul > li {
99
- list-style: square outside !important;
100
- }
101
-
102
- .tita-rich-editor li::marker {
103
- color: #2879ff;
104
- }
105
-
106
- .tita-rich-editor-ul .tita-rich-editor-li::marker {
107
- position: absolute;
108
- width: 5px;
109
- height: 5px;
110
- border-radius: 50%;
111
- background-color: #2879ff;
112
- top: 10.5px;
113
- left: 3px;
114
- }
115
-
116
- .tita-rich-editor-li {
117
- position: relative;
118
- }
119
-
120
- .tita-rich-editor-li::before {
121
- display: inline-block;
122
- position: absolute;
123
- left: 0;
124
- font-weight: 400;
125
- color: #2879ff;
126
- line-height: 26px;
127
- }
128
-
129
- .tita-rich-editor blockquote {
130
- position: relative;
131
- padding-left: 22px;
132
- margin: 0;
133
- }
134
-
135
- .tita-rich-editor blockquote::before {
136
- content: '';
137
- position: absolute;
138
- left: 0;
139
- top: 0;
140
- bottom: 0;
141
- width: 3px;
142
- background-color: #2879ff;
143
- border-radius: 2px;
144
- }
@@ -1,143 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _prosemirrorState = require("prosemirror-state");
13
-
14
- var _prosemirrorView = require("prosemirror-view");
15
-
16
- var _prosemirrorModel = require("prosemirror-model");
17
-
18
- var _schema = _interopRequireDefault(require("../../basic/schema"));
19
-
20
- var _editor = _interopRequireDefault(require("../../models/editor"));
21
-
22
- var _util = require("../../plugins/util");
23
-
24
- var _event = require("../../utils/event");
25
-
26
- var _events = require("../../consts/events");
27
-
28
- var _plugins = require("../../plugins");
29
-
30
- require("./index.css");
31
-
32
- var _classnames = _interopRequireDefault(require("classnames"));
33
-
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
-
36
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
-
38
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- var preCls = 'tita-rich-editor';
43
- var defaultPlugins = [new _plugins.HeadingPlugin(), new _plugins.StrongPlugin(), new _plugins.ColorPlugin(), new _plugins.UnderLinePlugin(), new _plugins.DeleteLinePlugin(), new _plugins.ListPlugin(), new _plugins.AlignmentPlugin(), new _plugins.BlockquotePlugin(), new _plugins.LinkPlugin()];
44
-
45
- function RichEditor(_ref, ref) {
46
- var _ref$plugins = _ref.plugins,
47
- plugins = _ref$plugins === void 0 ? defaultPlugins : _ref$plugins,
48
- onInit = _ref.onInit,
49
- _ref$editable = _ref.editable,
50
- _editable = _ref$editable === void 0 ? true : _ref$editable,
51
- defaultState = _ref.defaultState;
52
-
53
- var container = (0, _react.useRef)();
54
- var dataRef = (0, _react.useRef)({});
55
- (0, _react.useEffect)(function () {
56
- var dispatcher = new _event.EventDispatcher();
57
-
58
- var _applyPlugins = (0, _util.applyPlugins)(plugins, _schema["default"], dispatcher),
59
- nativePlugins = _applyPlugins.nativePlugins,
60
- nodes = _applyPlugins.nodes,
61
- marks = _applyPlugins.marks,
62
- controllers = _applyPlugins.controllers;
63
-
64
- var pluginedSchema = new _prosemirrorModel.Schema({
65
- nodes: nodes,
66
- marks: marks
67
- });
68
- var stateConf = {
69
- schema: pluginedSchema,
70
- plugins: nativePlugins
71
- };
72
-
73
- var state = _prosemirrorState.EditorState.create(stateConf); // debugger
74
-
75
-
76
- if (defaultState) {
77
- try {
78
- var jsonState = typeof defaultState == 'string' ? JSON.parse(defaultState) : defaultState;
79
- state = _prosemirrorState.EditorState.fromJSON(stateConf, jsonState);
80
- } catch (e) {
81
- console.log(e);
82
- }
83
- }
84
-
85
- var pmEditor = new _prosemirrorView.EditorView(container.current, {
86
- state: state,
87
- editable: function editable() {
88
- return _editable;
89
- },
90
- dispatchTransaction: function dispatchTransaction(tr) {
91
- var _this$state$applyTran = this.state.applyTransaction(tr),
92
- state = _this$state$applyTran.state;
93
-
94
- this.updateState(state);
95
- dispatcher.emit(_events.EDITOR_STATE_CHANGE, state);
96
- }
97
- });
98
- dataRef.current.editor = new _editor["default"]({
99
- view: pmEditor,
100
- controllers: controllers,
101
- dispatcher: dispatcher
102
- }); // window.editor = dataRef.current.editor
103
-
104
- onInit === null || onInit === void 0 ? void 0 : onInit(dataRef.current.editor);
105
- return function () {
106
- return dataRef.current.editor.destroy();
107
- };
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
- }, []);
123
- (0, _react.useImperativeHandle)(ref, function () {
124
- return {
125
- getState: function getState() {
126
- return dataRef.current.editor.state.toJSON();
127
- }
128
- };
129
- }, []);
130
- return /*#__PURE__*/_react["default"].createElement("div", {
131
- ref: container,
132
- className: (0, _classnames["default"])(preCls, _defineProperty({}, preCls + '--disabled', !_editable)),
133
- style: {
134
- backgroundColor: "#FFF"
135
- },
136
- spellCheck: false,
137
- onClick: handleClick
138
- });
139
- }
140
-
141
- var _default = /*#__PURE__*/(0, _react.forwardRef)(RichEditor);
142
-
143
- exports["default"] = _default;
@@ -1,29 +0,0 @@
1
- .tita-rich-editor-normal-toolbar {
2
- display: flex;
3
- align-items: center;
4
- }
5
-
6
- .tita-rich-editor-normal-toolbar-item {
7
- width: 24px;
8
- height: 24px;
9
- margin: 0 2px;
10
- font-size: 16px;
11
- display: flex;
12
- align-items: center;
13
- justify-content: center;
14
- border-radius: 4px;
15
- cursor: pointer;
16
- overflow: hidden;
17
- }
18
-
19
- .tita-rich-editor-normal-toolbar-item:not(.tita-rich-editor-normal-toolbar-item--disabled):hover {
20
- background-color: #f0f4fa;
21
- }
22
-
23
- .tita-rich-editor-normal-toolbar-item--active {
24
- background: #f0f4fa;
25
- }
26
-
27
- .tita-rich-editor-normal-toolbar-item--disabled:hover {
28
- cursor: not-allowed;
29
- }
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- var _tooltip = _interopRequireDefault(require("../../../tooltip"));
15
-
16
- require("./index.css");
17
-
18
- var _events = require("../../consts/events");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
28
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
-
30
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
-
32
- 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); }
33
-
34
- 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; }
35
-
36
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
-
38
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
-
40
- var preCls = 'tita-rich-editor-normal-toolbar';
41
-
42
- function MenuItem(_ref) {
43
- var _config$active, _config$disabled, _classNames;
44
-
45
- var editor = _ref.editor,
46
- config = _ref.config;
47
-
48
- var _useState = (0, _react.useState)(editor.state),
49
- _useState2 = _slicedToArray(_useState, 2),
50
- state = _useState2[0],
51
- setState = _useState2[1];
52
-
53
- var handleClickItem = (0, _react.useCallback)(function () {
54
- var _config$handler;
55
-
56
- (_config$handler = config.handler) === null || _config$handler === void 0 ? void 0 : _config$handler.call(config, editor);
57
- }, []);
58
- (0, _react.useEffect)(function () {
59
- editor.on(_events.EDITOR_STATE_CHANGE, setState);
60
- }, []);
61
- var itemClass = (0, _classnames["default"])(preCls + '-item', (_classNames = {}, _defineProperty(_classNames, preCls + '-item--active', (_config$active = config.active) === null || _config$active === void 0 ? void 0 : _config$active.call(config, state)), _defineProperty(_classNames, preCls + '-item--disabled', (_config$disabled = config.disabled) === null || _config$disabled === void 0 ? void 0 : _config$disabled.call(config, state)), _classNames));
62
-
63
- if (config.renderMenu) {
64
- return /*#__PURE__*/_react["default"].createElement("div", {
65
- className: itemClass
66
- }, config.renderMenu(editor, config));
67
- }
68
-
69
- return /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
70
- overlay: config.title,
71
- placement: "top"
72
- }, /*#__PURE__*/_react["default"].createElement("div", {
73
- className: itemClass,
74
- onClick: handleClickItem
75
- }, /*#__PURE__*/_react["default"].createElement("span", {
76
- className: config === null || config === void 0 ? void 0 : config.icon
77
- })));
78
- }
79
-
80
- function RichEditorToolBar(_ref2) {
81
- var editor = _ref2.editor;
82
- var toolbars = (0, _react.useMemo)(function () {
83
- var res = [];
84
- editor === null || editor === void 0 ? void 0 : editor.controllers.forEach(function (controller) {
85
- if (Array.isArray(controller.toolbar)) {
86
- res = res.concat(controller.toolbar);
87
- } else {
88
- controller.toolbar && res.push(controller.toolbar);
89
- }
90
- });
91
- return res;
92
- }, [editor === null || editor === void 0 ? void 0 : editor.controllers]);
93
- var handleMouseDown = (0, _react.useCallback)(function () {
94
- editor === null || editor === void 0 ? void 0 : editor.emit(_events.TOOLBAR_MOUSE_DOWN);
95
- }, [editor]);
96
- if (!editor) return null;
97
- return /*#__PURE__*/_react["default"].createElement("div", {
98
- className: preCls,
99
- onMouseDown: handleMouseDown
100
- }, toolbars.map(function (config) {
101
- return /*#__PURE__*/_react["default"].createElement(MenuItem, {
102
- editor: editor,
103
- config: config
104
- });
105
- }));
106
- }
107
-
108
- var _default = RichEditorToolBar;
109
- exports["default"] = _default;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var result = {
8
- mac: false,
9
- ie: false,
10
- ie_version: 0,
11
- gecko: false,
12
- chrome: false,
13
- chrome_version: 0,
14
- android: false,
15
- ios: false,
16
- webkit: false
17
- };
18
-
19
- if (typeof navigator !== 'undefined') {
20
- var ieEdge = /Edge\/(\d+)/.exec(navigator.userAgent);
21
- var ieUpTo10 = /MSIE \d/.test(navigator.userAgent);
22
- var ie11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
23
- result.mac = /Mac/.test(navigator.platform);
24
- var ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
25
- result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
26
- result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
27
- result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
28
- result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d{2})/) || [])[1], 10);
29
- result.android = /Android \d/.test(navigator.userAgent);
30
- result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
31
- result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
32
- }
33
-
34
- var _default = result;
35
- exports["default"] = _default;