@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,148 +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 _prosemirrorUtils = require("prosemirror-utils");
13
-
14
- var _Popup = _interopRequireDefault(require("../../../../ui/Popup"));
15
-
16
- var _input = _interopRequireDefault(require("../../../../../form/form-fields/input"));
17
-
18
- var _button = require("../../../../../button");
19
-
20
- var _commands = require("../commands");
21
-
22
- require("./index.css");
23
-
24
- var _main = require("../pm-plugins/main");
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
-
28
- 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); }
29
-
30
- 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; }
31
-
32
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
-
34
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
35
-
36
- 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; }
37
-
38
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
39
-
40
- 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."); }
41
-
42
- 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); }
43
-
44
- 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; }
45
-
46
- 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; }
47
-
48
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
-
50
- var preCls = 'tita-rich-editor-link';
51
-
52
- function LinkEditor(_ref) {
53
- var editor = _ref.editor,
54
- text = _ref.text,
55
- href = _ref.href,
56
- editType = _ref.editType,
57
- pos = _ref.pos;
58
-
59
- var _useState = (0, _react.useState)(),
60
- _useState2 = _slicedToArray(_useState, 2),
61
- target = _useState2[0],
62
- setTarget = _useState2[1];
63
-
64
- var _useState3 = (0, _react.useState)({
65
- text: text,
66
- href: href
67
- }),
68
- _useState4 = _slicedToArray(_useState3, 2),
69
- content = _useState4[0],
70
- setContent = _useState4[1];
71
-
72
- (0, _react.useEffect)(function () {
73
- var view = editor.view;
74
- setTarget((0, _prosemirrorUtils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view)));
75
- }, []);
76
- (0, _react.useEffect)(function () {
77
- setContent({
78
- text: text,
79
- href: href
80
- });
81
- }, [text, href]);
82
- var handleSubmit = (0, _react.useCallback)(function () {
83
- var text = content.text,
84
- href = content.href;
85
-
86
- if (!href) {
87
- (0, _commands.hideLinkToolbar)()(editor.state, editor.view.dispatch);
88
- return;
89
- }
90
-
91
- var _editor$state$selecti = editor.state.selection,
92
- from = _editor$state$selecti.from,
93
- to = _editor$state$selecti.to;
94
-
95
- if (editType == _main.InsertStatus.INSERT_LINK_TOOLBAR) {
96
- (0, _commands.insertLink)(from, to, href, text)(editor.state, editor.view.dispatch);
97
- } else {
98
- console.log(pos);
99
- (0, _commands.updateLink)(href, text || href, pos || from)(editor.state, editor.view.dispatch);
100
- }
101
-
102
- editor.view.focus();
103
- }, [content.text, content.href, pos]);
104
- return /*#__PURE__*/_react["default"].createElement(_Popup["default"], {
105
- mountTo: editor.view.dom.parentNode,
106
- target: target
107
- }, /*#__PURE__*/_react["default"].createElement("div", {
108
- className: preCls,
109
- onMouseDown: function onMouseDown(e) {
110
- return e.stopPropagation();
111
- }
112
- }, /*#__PURE__*/_react["default"].createElement(_input["default"], {
113
- className: preCls + '__input',
114
- label: "\u6587\u672C",
115
- name: "text",
116
- layout: "row",
117
- placeholder: "\u8BF7\u8F93\u5165\u6587\u672C",
118
- onChange: function onChange(text) {
119
- return setContent(_objectSpread(_objectSpread({}, content), {}, {
120
- text: text
121
- }));
122
- },
123
- value: content.text
124
- }), /*#__PURE__*/_react["default"].createElement(_input["default"], {
125
- className: preCls + '__input',
126
- label: "\u94FE\u63A5",
127
- name: "href",
128
- layout: "row",
129
- placeholder: "\u6DFB\u52A0\u94FE\u63A5\u5730\u5740",
130
- onChange: function onChange(href) {
131
- return setContent(_objectSpread(_objectSpread({}, content), {}, {
132
- href: href
133
- }));
134
- },
135
- value: content.href
136
- }), /*#__PURE__*/_react["default"].createElement("div", {
137
- className: preCls + '__btn-wrapper'
138
- }, /*#__PURE__*/_react["default"].createElement(_button.RectBtn, {
139
- type: "primary",
140
- style: {
141
- width: 90
142
- },
143
- onClick: handleSubmit
144
- }, "\u5E94\u7528"))));
145
- }
146
-
147
- var _default = LinkEditor;
148
- exports["default"] = _default;
@@ -1,88 +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 _prosemirrorUtils = require("prosemirror-utils");
13
-
14
- var _Popup = _interopRequireDefault(require("../../../../ui/Popup"));
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- require("./index.css");
19
-
20
- var _commands = require("../commands");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
- 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); }
25
-
26
- 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; }
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-toolbar';
41
-
42
- function LinkToolBar(_ref) {
43
- var editor = _ref.editor,
44
- href = _ref.href,
45
- pos = _ref.pos;
46
-
47
- var _useState = (0, _react.useState)(),
48
- _useState2 = _slicedToArray(_useState, 2),
49
- target = _useState2[0],
50
- setTarget = _useState2[1];
51
-
52
- (0, _react.useEffect)(function () {
53
- var view = editor.view;
54
- setTarget((0, _prosemirrorUtils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view)));
55
- }, []);
56
- var handleEdit = (0, _react.useCallback)(function () {
57
- (0, _commands.editInsertedLink)()(editor.state, editor.view.dispatch);
58
- }, []);
59
- var handleRemoveLink = (0, _react.useCallback)(function () {
60
- (0, _commands.removeLink)(pos)(editor.state, editor.view.dispatch);
61
- }, [pos]);
62
- var handleOpenLink = (0, _react.useCallback)(function () {
63
- window.open(href);
64
- }, [href]);
65
- return /*#__PURE__*/_react["default"].createElement(_Popup["default"], {
66
- mountTo: editor.view.dom.parentNode,
67
- target: target
68
- }, /*#__PURE__*/_react["default"].createElement("div", {
69
- className: preCls,
70
- onMouseDown: function onMouseDown(e) {
71
- return e.stopPropagation();
72
- }
73
- }, /*#__PURE__*/_react["default"].createElement("div", {
74
- className: preCls + '__text'
75
- }, href), /*#__PURE__*/_react["default"].createElement("div", {
76
- className: (0, _classnames["default"])('tu-icon-visit', preCls + '__btn'),
77
- onClick: handleOpenLink
78
- }), /*#__PURE__*/_react["default"].createElement("div", {
79
- className: (0, _classnames["default"])('tu-icon-bianji3', preCls + '__btn'),
80
- onClick: handleEdit
81
- }), /*#__PURE__*/_react["default"].createElement("div", {
82
- className: (0, _classnames["default"])('tu-icon-quxiaoguanlian', preCls + '__btn'),
83
- onClick: handleRemoveLink
84
- })));
85
- }
86
-
87
- var _default = LinkToolBar;
88
- exports["default"] = _default;
@@ -1,117 +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 _events = require("../../../../consts/events");
13
-
14
- var _focusHandler = require("../../../core/pm-plugins/focus-handler");
15
-
16
- var _commands = require("../commands");
17
-
18
- var _main = require("../pm-plugins/main");
19
-
20
- var _linkEditor = _interopRequireDefault(require("./linkEditor"));
21
-
22
- require("./index.css");
23
-
24
- var _linkToolbar = _interopRequireDefault(require("./linkToolbar"));
25
-
26
- var _utils = require("../utils");
27
-
28
- var _classnames = _interopRequireDefault(require("classnames"));
29
-
30
- var _tooltip = _interopRequireDefault(require("../../../../../tooltip"));
31
-
32
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33
-
34
- 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); }
35
-
36
- 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; }
37
-
38
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
39
-
40
- 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."); }
41
-
42
- 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); }
43
-
44
- 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; }
45
-
46
- 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; }
47
-
48
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
-
50
- var preCls = 'tita-rich-editor-link';
51
-
52
- function ToolbarBtn(_ref) {
53
- var _linkState$activeLink, _linkState$activeLink2, _linkState$activeLink3, _findLinkMark, _linkState$activeLink4, _linkState$activeLink5;
54
-
55
- var editor = _ref.editor,
56
- config = _ref.config;
57
-
58
- var _useState = (0, _react.useState)(),
59
- _useState2 = _slicedToArray(_useState, 2),
60
- linkState = _useState2[0],
61
- setLinkState = _useState2[1];
62
-
63
- var linkStateRef = (0, _react.useRef)();
64
- (0, _react.useEffect)(function () {
65
- editor.on(_main.stateKey.key, function (state) {
66
- setLinkState(state);
67
- linkStateRef.current = state;
68
- });
69
- editor.on(_events.TOOLBAR_MOUSE_DOWN, function () {
70
- return (0, _commands.hideLinkToolbar)()(editor.state, editor.view.dispatch);
71
- });
72
- editor.on(_focusHandler.focusStateKey.key, function (focus) {
73
- var _linkStateRef$current, _linkStateRef$current2;
74
-
75
- if (((_linkStateRef$current = linkStateRef.current) === null || _linkStateRef$current === void 0 ? void 0 : (_linkStateRef$current2 = _linkStateRef$current.activeLinkMark) === null || _linkStateRef$current2 === void 0 ? void 0 : _linkStateRef$current2.type) == _main.InsertStatus.INSERT_LINK_TOOLBAR && focus) {
76
- (0, _commands.hideLinkToolbar)()(editor.state, editor.view.dispatch);
77
- }
78
- });
79
- }, []);
80
- var handleClick = (0, _react.useCallback)(function () {
81
- editor.view.dispatch(editor.state.tr.setMeta(_main.stateKey, {
82
- type: _main.LinkAction.SHOW_INSERT_TOOLBAR
83
- }));
84
- }, []);
85
- var activeType = linkState === null || linkState === void 0 ? void 0 : (_linkState$activeLink = linkState.activeLinkMark) === null || _linkState$activeLink === void 0 ? void 0 : _linkState$activeLink.type;
86
- var text = (linkState === null || linkState === void 0 ? void 0 : (_linkState$activeLink2 = linkState.activeLinkMark) === null || _linkState$activeLink2 === void 0 ? void 0 : (_linkState$activeLink3 = _linkState$activeLink2.node) === null || _linkState$activeLink3 === void 0 ? void 0 : _linkState$activeLink3.text) || (linkState === null || linkState === void 0 ? void 0 : linkState.activeText);
87
- var href = (_findLinkMark = (0, _utils.findLinkMark)(linkState === null || linkState === void 0 ? void 0 : (_linkState$activeLink4 = linkState.activeLinkMark) === null || _linkState$activeLink4 === void 0 ? void 0 : _linkState$activeLink4.node)) === null || _findLinkMark === void 0 ? void 0 : _findLinkMark.attrs.href;
88
- var pos = linkState === null || linkState === void 0 ? void 0 : (_linkState$activeLink5 = linkState.activeLinkMark) === null || _linkState$activeLink5 === void 0 ? void 0 : _linkState$activeLink5.pos;
89
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
90
- overlay: config.title,
91
- placement: "top"
92
- }, /*#__PURE__*/_react["default"].createElement("div", {
93
- className: (0, _classnames["default"])(preCls + '__common-tool-bar-btn'),
94
- onClick: handleClick
95
- }, /*#__PURE__*/_react["default"].createElement("span", {
96
- className: config.icon
97
- }))), (activeType == _main.InsertStatus.INSERT_LINK_TOOLBAR || activeType == _main.InsertStatus.EDIT_INSERTED_TOOLBAR) && /*#__PURE__*/_react["default"].createElement(_linkEditor["default"], {
98
- editType: activeType,
99
- text: text,
100
- href: href,
101
- editor: editor,
102
- pos: pos
103
- }), activeType == _main.InsertStatus.EDIT_LINK_TOOLBAR && /*#__PURE__*/_react["default"].createElement(_linkToolbar["default"], {
104
- href: href,
105
- editor: editor,
106
- pos: pos
107
- }));
108
- }
109
-
110
- var _default = function _default(editor, config) {
111
- return /*#__PURE__*/_react["default"].createElement(ToolbarBtn, {
112
- editor: editor,
113
- config: config
114
- });
115
- };
116
-
117
- exports["default"] = _default;
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.findLinkMark = findLinkMark;
7
- exports.isSafeUrl = void 0;
8
- exports.normalizeUrl = normalizeUrl;
9
- var whitelistedURLPatterns = [/^https?:\/\//im, /^ftps?:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:/im, /^facetime:/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im];
10
-
11
- var isSafeUrl = function isSafeUrl(url) {
12
- return whitelistedURLPatterns.some(function (p) {
13
- return p.test(url.trim()) === true;
14
- });
15
- };
16
-
17
- exports.isSafeUrl = isSafeUrl;
18
-
19
- function normalizeUrl(url) {
20
- if (!url) {
21
- return '';
22
- }
23
-
24
- return isSafeUrl(url) ? url : 'http://' + url;
25
- }
26
-
27
- function findLinkMark(node) {
28
- var _node$marks;
29
-
30
- return node === null || node === void 0 ? void 0 : (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.find(function (m) {
31
- return m.type.name == 'link';
32
- });
33
- }
@@ -1,137 +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.StrongSchema = exports.StrongPlugin = exports.StrongController = void 0;
9
-
10
- var _mark = require("../../../utils/mark");
11
-
12
- var _prosemirrorCommands = require("prosemirror-commands");
13
-
14
- var _controller = _interopRequireDefault(require("../../../models/controller"));
15
-
16
- var _plugin = _interopRequireDefault(require("../../../models/plugin"));
17
-
18
- var _schema = require("../../../models/schema");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
-
24
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
25
-
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
-
28
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
-
30
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
33
-
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
35
-
36
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
-
38
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
-
40
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
-
42
- var PLUGIN_NAME = 'strong';
43
-
44
- var StrongSchema = /*#__PURE__*/function (_InlineSchema) {
45
- _inherits(StrongSchema, _InlineSchema);
46
-
47
- var _super = _createSuper(StrongSchema);
48
-
49
- function StrongSchema() {
50
- var _this;
51
-
52
- _classCallCheck(this, StrongSchema);
53
-
54
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- return _possibleConstructorReturn(_this, (_this = _super.call.apply(_super, [this].concat(args)), _this.name = PLUGIN_NAME, _this.group = 'fontStyle', _this.parseDOM = [{
59
- tag: "strong"
60
- }, {
61
- tag: "b",
62
- getAttrs: function getAttrs(node) {
63
- return node.style.fontWeight !== "normal" && null;
64
- }
65
- }, {
66
- style: "font-weight",
67
- getAttrs: function getAttrs(value) {
68
- return /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
69
- }
70
- }], _assertThisInitialized(_this)));
71
- }
72
-
73
- _createClass(StrongSchema, [{
74
- key: "toDOM",
75
- value: function toDOM() {
76
- return ["strong", 0];
77
- }
78
- }]);
79
-
80
- return StrongSchema;
81
- }(_schema.InlineSchema);
82
-
83
- exports.StrongSchema = StrongSchema;
84
-
85
- var StrongController = /*#__PURE__*/function (_BaseController) {
86
- _inherits(StrongController, _BaseController);
87
-
88
- var _super2 = _createSuper(StrongController);
89
-
90
- function StrongController() {
91
- var _this2;
92
-
93
- _classCallCheck(this, StrongController);
94
-
95
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
96
- args[_key2] = arguments[_key2];
97
- }
98
-
99
- return _possibleConstructorReturn(_this2, (_this2 = _super2.call.apply(_super2, [this].concat(args)), _this2.toolbar = {
100
- title: '加粗',
101
- icon: 'tu-icon-text-blod',
102
- handler: function handler(editor) {
103
- (0, _prosemirrorCommands.toggleMark)(editor.state.schema.marks[PLUGIN_NAME])(editor.state, editor.view.dispatch);
104
- editor.view.focus();
105
- },
106
- active: function active(state) {
107
- return (0, _mark.selectionContainsMark)(state, PLUGIN_NAME);
108
- }
109
- }, _assertThisInitialized(_this2)));
110
- }
111
-
112
- return _createClass(StrongController);
113
- }(_controller["default"]);
114
-
115
- exports.StrongController = StrongController;
116
-
117
- var StrongPlugin = /*#__PURE__*/function (_BasePlugin) {
118
- _inherits(StrongPlugin, _BasePlugin);
119
-
120
- var _super3 = _createSuper(StrongPlugin);
121
-
122
- function StrongPlugin() {
123
- var _this3;
124
-
125
- _classCallCheck(this, StrongPlugin);
126
-
127
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
128
- args[_key3] = arguments[_key3];
129
- }
130
-
131
- return _possibleConstructorReturn(_this3, (_this3 = _super3.call.apply(_super3, [this].concat(args)), _this3.name = PLUGIN_NAME, _this3.schema = StrongSchema, _this3.controller = StrongController, _assertThisInitialized(_this3)));
132
- }
133
-
134
- return _createClass(StrongPlugin);
135
- }(_plugin["default"]);
136
-
137
- exports.StrongPlugin = StrongPlugin;