@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
@@ -41,6 +41,21 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
41
41
 
42
42
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
43
43
 
44
+ var getChartProps = function getChartProps(chartPropsStr) {
45
+ var chartQuery = JSON.parse(chartPropsStr);
46
+
47
+ if (typeof chartQuery === "number") {
48
+ return {
49
+ chartId: String(chartQuery)
50
+ };
51
+ }
52
+
53
+ return {
54
+ chartId: chartQuery.id,
55
+ timeRange: chartQuery.timeRange
56
+ };
57
+ };
58
+
44
59
  var systemPublisher = {
45
60
  avatar: {
46
61
  big: "https://file.tita.com/TitaImage/352728/d820ed195e204b5aa7d6d1b9bd94f215_b.png",
@@ -78,6 +93,7 @@ var DynamicChart = function DynamicChart(_ref) {
78
93
  var _useContext = (0, _react.useContext)(_context.SearchKeyContext),
79
94
  searchKeyWord = _useContext.searchKeyWord;
80
95
 
96
+ var chartQuery = getChartProps(data.biId);
81
97
  (0, _react.useEffect)(function () {
82
98
  (0, _tools.highLightWord)({
83
99
  parentDom: contentRef.current,
@@ -112,12 +128,11 @@ var DynamicChart = function DynamicChart(_ref) {
112
128
  alt: "right"
113
129
  }))), /*#__PURE__*/_react["default"].createElement("div", {
114
130
  className: "".concat(prefixCls, "__charts")
115
- }, /*#__PURE__*/_react["default"].createElement(_supersetCharts["default"], {
116
- chartId: data.biId,
131
+ }, /*#__PURE__*/_react["default"].createElement(_supersetCharts["default"], _extends({}, chartQuery, {
117
132
  layout: "feed-card",
118
133
  width: 800,
119
134
  height: 400
120
- })));
135
+ }))));
121
136
  };
122
137
 
123
138
  var _default = DynamicChart;
@@ -130,10 +130,14 @@ function _default(props) {
130
130
  })), /*#__PURE__*/_react["default"].createElement("span", {
131
131
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-title ")),
132
132
  onClick: openProjectDetail
133
+ }, /*#__PURE__*/_react["default"].createElement("span", {
134
+ className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-title-name "))
133
135
  }, /*#__PURE__*/_react["default"].createElement(_tooltipText["default"], {
134
136
  text: (0, _helpers.escapeHtml)(title),
135
137
  isPercent: true
136
- })), /*#__PURE__*/_react["default"].createElement("div", {
138
+ })), (data === null || data === void 0 ? void 0 : data.workApplyStatus) === 1 && /*#__PURE__*/_react["default"].createElement("span", {
139
+ className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-title-approvaling"))
140
+ }, "\u7ACB\u9879\u4E2D")), /*#__PURE__*/_react["default"].createElement("div", {
137
141
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-actions"))
138
142
  }, /*#__PURE__*/_react["default"].createElement("span", {
139
143
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-actions-user"))
@@ -147,7 +147,7 @@
147
147
  }
148
148
 
149
149
  .tita-okrdt-tree__e-project-node-title {
150
- display: inline-block;
150
+ display: inline-flex;
151
151
  font-size: 14px;
152
152
  font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
153
153
  color: #3f4755;
@@ -158,6 +158,24 @@
158
158
  flex: 1;
159
159
  }
160
160
 
161
+ .tita-okrdt-tree__e-project-node-title-name {
162
+ overflow: hidden;
163
+ }
164
+
165
+ .tita-okrdt-tree__e-project-node-title-approvaling {
166
+ display: inline-flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ min-width: 48px;
170
+ height: 20px;
171
+ font-size: 12px;
172
+ font-weight: 400;
173
+ color: #F05E5E;
174
+ background: rgba(240, 94, 94, 0.1);
175
+ border-radius: 10px;
176
+ margin-left: 8px;
177
+ }
178
+
161
179
  .tita-okrdt-tree__e-project-node-gray {
162
180
  color: #BFC7D5 !important;
163
181
  }
@@ -61,8 +61,8 @@ var beforeResponse = function beforeResponse(res) {
61
61
  config.retry = 3;
62
62
  config.retryCount = config.retryCount || 0;
63
63
 
64
- if (res.data.code === 401) {
65
- // 401错误表示未登录授权或者token失效
64
+ if (res.data.code === 203) {
65
+ // 203错误表示未登录授权或者token失效
66
66
  clearToken();
67
67
 
68
68
  if (config.retryCount <= config.retry) {
@@ -501,13 +501,11 @@ var Upload = /*#__PURE__*/function (_PureComponent) {
501
501
  return Upload;
502
502
  }(_react.PureComponent);
503
503
 
504
- Upload.Preview = _uploadedPreview["default"];
504
+ exports["default"] = Upload;
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
- };
512
- var _default = Upload;
513
- exports["default"] = _default;
511
+ };
package/lib/index.js CHANGED
@@ -375,12 +375,6 @@ 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
- });
384
378
  Object.defineProperty(exports, "Scrollbar", {
385
379
  enumerable: true,
386
380
  get: function get() {
@@ -744,8 +738,6 @@ var _uploadPhotoModal = _interopRequireDefault(require("./components/upload-phot
744
738
 
745
739
  var _bookDemo = _interopRequireDefault(require("./components/book-demo"));
746
740
 
747
- var _richEditor = _interopRequireDefault(require("./components/rich-editor"));
748
-
749
741
  var _videoModal = _interopRequireDefault(require("./components/video-modal"));
750
742
 
751
743
  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.40",
3
+ "version": "1.10.44-beta.1",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -33,7 +33,6 @@
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",
37
36
  "@types/styled-components": "^5.1.2",
38
37
  "@typescript-eslint/eslint-plugin": "^5.10.0",
39
38
  "@typescript-eslint/parser": "^5.10.0",
@@ -77,15 +76,12 @@
77
76
  "@titaui/rc-trigger": "^5.2.5",
78
77
  "@titaui/react-flow-renderer": "9.5.4",
79
78
  "@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",
83
79
  "axios": "^0.21.1",
84
80
  "bowser": "^2.11.0",
85
81
  "can-use-dom": "^0.1.0",
86
82
  "classnames": "^2.2.6",
87
83
  "clone-deep": "^4.0.1",
88
- "color": "^4.2.1",
84
+ "color": "^3.2.1",
89
85
  "cos-js-sdk-v5": "^1.3.3",
90
86
  "dayjs": "^1.10.4",
91
87
  "html2canvas": "1.3.2",
@@ -96,21 +92,7 @@
96
92
  "lodash.throttle": "^4.1.1",
97
93
  "lottie-web": "^5.7.12",
98
94
  "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",
112
95
  "qs": "^6.10.1",
113
- "raf-schd": "^4.0.3",
114
96
  "rc-cascader": "^2.2.0",
115
97
  "rc-checkbox": "^2.3.2",
116
98
  "rc-color-picker": "^1.2.6",
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var basicSchema = {
8
- nodes: {
9
- doc: {
10
- content: "block+"
11
- },
12
- text: {
13
- group: "inline"
14
- },
15
- hard_break: {
16
- inline: true,
17
- group: "inline",
18
- selectable: false,
19
- parseDOM: [{
20
- tag: "br"
21
- }],
22
- toDOM: function toDOM() {
23
- return ["br"];
24
- }
25
- },
26
- paragraph: {
27
- content: "inline*",
28
- attrs: {
29
- textAlign: {
30
- "default": 'left'
31
- }
32
- },
33
- group: "block",
34
- parseDOM: [{
35
- tag: "p"
36
- }],
37
- toDOM: function toDOM(node) {
38
- return ["p", {
39
- style: "text-align:".concat(node.attrs["textAlign"])
40
- }, 0];
41
- }
42
- }
43
- },
44
- marks: {}
45
- };
46
- var _default = basicSchema;
47
- exports["default"] = _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TOOLBAR_MOUSE_DOWN = exports.EDITOR_STATE_CHANGE = exports.EDITOR_MOUSE_DOWN = void 0;
7
- var TOOLBAR_MOUSE_DOWN = 'tool_bar_mouse_down';
8
- exports.TOOLBAR_MOUSE_DOWN = TOOLBAR_MOUSE_DOWN;
9
- var EDITOR_MOUSE_DOWN = 'editor_mouse_down';
10
- exports.EDITOR_MOUSE_DOWN = EDITOR_MOUSE_DOWN;
11
- var EDITOR_STATE_CHANGE = 'editor_state_change';
12
- exports.EDITOR_STATE_CHANGE = EDITOR_STATE_CHANGE;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FontColor = exports.BackgroundColor = void 0;
7
- var FontColor;
8
- exports.FontColor = FontColor;
9
-
10
- (function (FontColor) {
11
- FontColor["black1"] = "#141C28";
12
- FontColor["black2"] = "#3F4755";
13
- FontColor["black3"] = "#6F7886";
14
- FontColor["red1"] = "#F02673";
15
- FontColor["red2"] = "#F05E5E";
16
- FontColor["yellow1"] = "#F0A326";
17
- FontColor["yellow2"] = "#F6BD16";
18
- FontColor["green1"] = "#5AD8A6";
19
- FontColor["green2"] = "#26D8F0";
20
- FontColor["blue1"] = "#3D26F0";
21
- FontColor["blue2"] = "#2879FF";
22
- FontColor["purple1"] = "#A226F0";
23
- })(FontColor || (exports.FontColor = FontColor = {}));
24
-
25
- var BackgroundColor;
26
- exports.BackgroundColor = BackgroundColor;
27
-
28
- (function (BackgroundColor) {
29
- BackgroundColor["transparent"] = "transparent";
30
- BackgroundColor["red1"] = "rgba(240, 94, 94, 0.6)";
31
- BackgroundColor["red2"] = "rgba(240, 94, 94, 0.2)";
32
- BackgroundColor["yellow1"] = "rgba(246, 189, 22, 0.6)";
33
- BackgroundColor["yellow2"] = "rgba(246, 189, 22, 0.2)";
34
- BackgroundColor["green1"] = "rgba(90, 216, 166, 0.6)";
35
- BackgroundColor["grenn2"] = "rgba(90, 216, 166, 0.2)";
36
- BackgroundColor["blue1"] = "rgba(40, 121, 255, 0.6)";
37
- BackgroundColor["blue2"] = "rgba(40, 121, 255, 0.2)";
38
- BackgroundColor["purple1"] = "rgba(162, 38, 240, 0.6)";
39
- BackgroundColor["purple2"] = "rgba(162, 38, 240, 0.2)";
40
- BackgroundColor["gray1"] = "rgba(191, 199, 213, 0.6)";
41
- BackgroundColor["gray2"] = "rgba(191, 199, 213, 0.2)";
42
- })(BackgroundColor || (exports.BackgroundColor = BackgroundColor = {}));
@@ -1,58 +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 _editor = _interopRequireDefault(require("./ui/editor"));
13
-
14
- var _normalToolbar = _interopRequireDefault(require("./ui/normal-toolbar"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- 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); }
19
-
20
- 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; }
21
-
22
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
-
24
- 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."); }
25
-
26
- 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); }
27
-
28
- 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; }
29
-
30
- 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; }
31
-
32
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
-
34
- // type Props = {}
35
- function TitaRichEditor() {
36
- var _useState = (0, _react.useState)(),
37
- _useState2 = _slicedToArray(_useState, 2),
38
- editor = _useState2[0],
39
- setEditor = _useState2[1];
40
-
41
- var handleInit = (0, _react.useCallback)(function (editor) {
42
- return setEditor(editor);
43
- }, []);
44
- return /*#__PURE__*/_react["default"].createElement("div", {
45
- style: {
46
- backgroundColor: '#fff'
47
- }
48
- }, /*#__PURE__*/_react["default"].createElement(_normalToolbar["default"], {
49
- editor: editor
50
- }), /*#__PURE__*/_react["default"].createElement(_editor["default"], {
51
- onInit: handleInit
52
- }));
53
- }
54
-
55
- TitaRichEditor.ToolBar = _normalToolbar["default"];
56
- TitaRichEditor.Editor = _editor["default"];
57
- var _default = TitaRichEditor;
58
- exports["default"] = _default;
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildKeymap = buildKeymap;
7
-
8
- var _prosemirrorCommands = require("prosemirror-commands");
9
-
10
- var _list = require("./schemas/list");
11
-
12
- var _prosemirrorHistory = require("prosemirror-history");
13
-
14
- var _prosemirrorInputrules = require("prosemirror-inputrules");
15
-
16
- var mac = typeof navigator != "undefined" ? /Mac/.test(navigator.platform) : false; // :: (Schema, ?Object) → Object
17
- // Inspect the given schema looking for marks and nodes from the
18
- // basic schema, and if found, add key bindings related to them.
19
- // This will add:
20
- //
21
- // * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
22
- // * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
23
- // * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
24
- // * **Ctrl-Shift-0** for making the current textblock a paragraph
25
- // * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
26
- // textblock a heading of the corresponding level
27
- // * **Ctrl-Shift-Backslash** to make the current textblock a code block
28
- // * **Ctrl-Shift-8** to wrap the selection in an ordered list
29
- // * **Ctrl-Shift-9** to wrap the selection in a bullet list
30
- // * **Ctrl->** to wrap the selection in a block quote
31
- // * **Enter** to split a non-empty textblock in a list item while at
32
- // the same time splitting the list item
33
- // * **Mod-Enter** to insert a hard break
34
- // * **Mod-_** to insert a horizontal rule
35
- // * **Backspace** to undo an input rule
36
- // * **Alt-ArrowUp** to `joinUp`
37
- // * **Alt-ArrowDown** to `joinDown`
38
- // * **Mod-BracketLeft** to `lift`
39
- // * **Escape** to `selectParentNode`
40
- //
41
- // You can suppress or map these bindings by passing a `mapKeys`
42
- // argument, which maps key names (say `"Mod-B"` to either `false`, to
43
- // remove the binding, or a new key name string.
44
-
45
- function buildKeymap(schema, mapKeys) {
46
- var keys = {},
47
- type;
48
-
49
- function bind(key, cmd) {
50
- if (mapKeys) {
51
- var mapped = mapKeys[key];
52
- if (mapped === false) return;
53
- if (mapped) key = mapped;
54
- }
55
-
56
- keys[key] = cmd;
57
- }
58
-
59
- bind("Mod-z", _prosemirrorHistory.undo);
60
- bind("Shift-Mod-z", _prosemirrorHistory.redo);
61
- bind("Backspace", _prosemirrorInputrules.undoInputRule);
62
- if (!mac) bind("Mod-y", _prosemirrorHistory.redo);
63
- bind("Alt-ArrowUp", _prosemirrorCommands.joinUp);
64
- bind("Alt-ArrowDown", _prosemirrorCommands.joinDown);
65
- bind("Mod-BracketLeft", _prosemirrorCommands.lift);
66
- bind("Escape", _prosemirrorCommands.selectParentNode);
67
-
68
- if (type = schema.marks.strong) {
69
- bind("Mod-b", (0, _prosemirrorCommands.toggleMark)(type));
70
- bind("Mod-B", (0, _prosemirrorCommands.toggleMark)(type));
71
- }
72
-
73
- if (type = schema.marks.em) {
74
- bind("Mod-i", (0, _prosemirrorCommands.toggleMark)(type));
75
- bind("Mod-I", (0, _prosemirrorCommands.toggleMark)(type));
76
- }
77
-
78
- if (type = schema.marks.code) bind("Mod-`", (0, _prosemirrorCommands.toggleMark)(type));
79
- if (type = schema.nodes.bullet_list) bind("Shift-Ctrl-8", (0, _list.wrapInList)(type));
80
- if (type = schema.nodes.ordered_list) bind("Shift-Ctrl-9", (0, _list.wrapInList)(type));
81
- if (type = schema.nodes.blockquote) bind("Ctrl->", (0, _prosemirrorCommands.wrapIn)(type));
82
-
83
- if (type = schema.nodes.hard_break) {
84
- var br = type,
85
- cmd = (0, _prosemirrorCommands.chainCommands)(_prosemirrorCommands.exitCode, function (state, dispatch) {
86
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
87
- return true;
88
- });
89
- bind("Mod-Enter", cmd);
90
- bind("Shift-Enter", cmd);
91
- if (mac) bind("Ctrl-Enter", cmd);
92
- }
93
-
94
- if (type = schema.nodes.list_item) {
95
- bind("Enter", (0, _list.splitListItem)(type));
96
- bind("Tab", (0, _list.sinkListItem)(type));
97
- bind("Shift-Tab", (0, _list.liftListItem)(type));
98
- bind("Mod-[", (0, _list.liftListItem)(type));
99
- bind("Mod-]", (0, _list.sinkListItem)(type));
100
- }
101
-
102
- if (type = schema.nodes.paragraph) bind("Shift-Ctrl-0", (0, _prosemirrorCommands.setBlockType)(type));
103
- if (type = schema.nodes.code_block) bind("Shift-Ctrl-\\", (0, _prosemirrorCommands.setBlockType)(type));
104
- if (type = schema.nodes.heading) for (var i = 1; i <= 6; i++) {
105
- bind("Shift-Ctrl-" + i, (0, _prosemirrorCommands.setBlockType)(type, {
106
- level: i
107
- }));
108
- }
109
-
110
- if (type = schema.nodes.horizontal_rule) {
111
- var hr = type;
112
- bind("Mod-_", function (state, dispatch) {
113
- dispatch(state.tr.replaceSelectionWith(hr.create()).scrollIntoView());
114
- return true;
115
- });
116
- }
117
-
118
- return keys;
119
- }