pro-comp-x 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -12
- package/compiled/@ant-design/icons/index.js +1 -0
- package/compiled/@ant-design/icons/package.json +1 -0
- package/compiled/antd/index.d.ts +482 -0
- package/compiled/antd/index.js +29 -0
- package/compiled/antd/package.json +1 -0
- package/compiled/classnames/index.js +7 -0
- package/compiled/classnames/package.json +1 -0
- package/compiled/dayjs/index.js +1 -0
- package/compiled/dayjs/package.json +1 -0
- package/dist/404.html +36 -0
- package/dist/esm/antd-alias/antd.less +30 -0
- package/dist/esm/antd-alias/button.d.ts +2 -0
- package/dist/esm/antd-alias/button.js +2 -0
- package/dist/esm/antd-alias/cascader.d.ts +2 -0
- package/dist/esm/antd-alias/cascader.js +2 -0
- package/dist/esm/antd-alias/checkbox.d.ts +2 -0
- package/dist/esm/antd-alias/checkbox.js +2 -0
- package/dist/esm/antd-alias/col.d.ts +2 -0
- package/dist/esm/antd-alias/col.js +2 -0
- package/dist/esm/antd-alias/config-provider.d.ts +2 -0
- package/dist/esm/antd-alias/config-provider.js +2 -0
- package/dist/esm/antd-alias/date-picker.d.ts +2 -0
- package/dist/esm/antd-alias/date-picker.js +2 -0
- package/dist/esm/antd-alias/form.d.ts +2 -0
- package/dist/esm/antd-alias/form.js +2 -0
- package/dist/esm/antd-alias/index.d.ts +36 -0
- package/dist/esm/antd-alias/index.js +48 -0
- package/dist/esm/antd-alias/input-number.d.ts +2 -0
- package/dist/esm/antd-alias/input-number.js +2 -0
- package/dist/esm/antd-alias/input.d.ts +2 -0
- package/dist/esm/antd-alias/input.js +2 -0
- package/dist/esm/antd-alias/mentions.d.ts +2 -0
- package/dist/esm/antd-alias/mentions.js +2 -0
- package/dist/esm/antd-alias/modal.d.ts +2 -0
- package/dist/esm/antd-alias/modal.js +2 -0
- package/dist/esm/antd-alias/pagination.d.ts +2 -0
- package/dist/esm/antd-alias/pagination.js +2 -0
- package/dist/esm/antd-alias/popover.d.ts +2 -0
- package/dist/esm/antd-alias/popover.js +2 -0
- package/dist/esm/antd-alias/radio.d.ts +2 -0
- package/dist/esm/antd-alias/radio.js +2 -0
- package/dist/esm/antd-alias/row.d.ts +2 -0
- package/dist/esm/antd-alias/row.js +2 -0
- package/dist/esm/antd-alias/select.d.ts +2 -0
- package/dist/esm/antd-alias/select.js +2 -0
- package/dist/esm/antd-alias/slider.d.ts +2 -0
- package/dist/esm/antd-alias/slider.js +2 -0
- package/dist/esm/antd-alias/spin.d.ts +2 -0
- package/dist/esm/antd-alias/spin.js +2 -0
- package/dist/esm/antd-alias/switch.d.ts +2 -0
- package/dist/esm/antd-alias/switch.js +2 -0
- package/dist/esm/antd-alias/table.d.ts +2 -0
- package/dist/esm/antd-alias/table.js +2 -0
- package/dist/esm/antd-alias/tabs.d.ts +2 -0
- package/dist/esm/antd-alias/tabs.js +2 -0
- package/dist/esm/antd-alias/time-picker.d.ts +2 -0
- package/dist/esm/antd-alias/time-picker.js +2 -0
- package/dist/esm/antd-alias/tooltip.d.ts +2 -0
- package/dist/esm/antd-alias/tooltip.js +2 -0
- package/dist/esm/antd-alias/tree-select.d.ts +2 -0
- package/dist/esm/antd-alias/tree-select.js +2 -0
- package/dist/esm/antd-alias/upload.d.ts +2 -0
- package/dist/esm/antd-alias/upload.js +2 -0
- package/dist/esm/components/ComponentExtends/DatePicker/index.d.ts +9 -0
- package/dist/esm/components/ComponentExtends/DatePicker/index.js +5 -12
- package/dist/esm/components/ComponentExtends/InputBox/index.d.ts +31 -0
- package/dist/esm/components/ComponentExtends/InputBox/index.js +3 -4
- package/dist/esm/components/ComponentExtends/InputSearch/index.d.ts +9 -0
- package/dist/esm/components/ComponentExtends/InputSearch/index.js +3 -10
- package/dist/esm/components/ComponentExtends/InputTooltip/index.d.ts +11 -0
- package/dist/esm/components/ComponentExtends/InputTooltip/index.js +18 -28
- package/dist/esm/components/ComponentExtends/Modal/index.d.ts +15 -0
- package/dist/esm/components/ComponentExtends/Modal/index.js +4 -13
- package/dist/esm/components/ComponentExtends/NumberRange/index.d.ts +13 -0
- package/dist/esm/components/ComponentExtends/NumberRange/index.js +21 -30
- package/dist/esm/components/ComponentExtends/Raido/index.d.ts +10 -0
- package/dist/esm/components/ComponentExtends/Raido/index.js +3 -10
- package/dist/esm/components/ComponentExtends/SelectQuery/index.d.ts +32 -0
- package/dist/esm/components/ComponentExtends/SelectQuery/index.js +40 -51
- package/dist/esm/components/ComponentExtends/TableEditCell/index.d.ts +20 -0
- package/dist/esm/components/ComponentExtends/TableEditCell/index.js +5 -19
- package/dist/esm/components/ComponentExtends/Tabs/index.d.ts +8 -0
- package/dist/esm/components/ComponentExtends/Tabs/index.js +11 -16
- package/dist/esm/components/ComponentExtends/Text/index.d.ts +4 -0
- package/dist/esm/components/ComponentExtends/Text/index.js +1 -4
- package/dist/esm/components/ComponentExtends/TimePicker/index.d.ts +6 -0
- package/dist/esm/components/ComponentExtends/TimePicker/index.js +5 -12
- package/dist/esm/components/ComponentExtends/UploadImages/index.d.ts +8 -0
- package/dist/esm/components/ComponentExtends/UploadImages/index.js +10 -23
- package/dist/esm/components/ComponentExtends/index.d.ts +15 -0
- package/dist/esm/components/DndProvider/index.d.ts +7 -0
- package/dist/esm/components/DndProvider/index.js +15 -0
- package/dist/esm/components/DraggableBodyRow/DraggableBodyRow.less +16 -14
- package/dist/esm/components/DraggableBodyRow/index.d.ts +18 -0
- package/dist/esm/components/DraggableBodyRow/index.js +2 -2
- package/dist/esm/components/DraggableCell/index.d.ts +40 -0
- package/dist/esm/components/DraggableCell/index.js +23 -10
- package/dist/esm/components/DraggableTabNode/index.d.ts +7 -0
- package/dist/esm/components/DraggableTabNode/index.js +3 -5
- package/dist/esm/components/DraggableTable/DraggableTable.less +31 -0
- package/dist/esm/components/DraggableTable/index.d.ts +23 -0
- package/dist/esm/components/DraggableTable/index.js +170 -0
- package/dist/esm/components/PageList/FilterForm/index.d.ts +53 -0
- package/dist/esm/components/PageList/FilterForm/index.js +52 -66
- package/dist/esm/components/PageList/index.d.ts +76 -0
- package/dist/esm/components/PageList/index.js +148 -138
- package/dist/esm/components/PageWraper/index.d.ts +13 -0
- package/dist/esm/components/PageWraper/index.js +8 -13
- package/dist/esm/components/Panel/Panel.less +2 -0
- package/dist/esm/components/Panel/index.d.ts +20 -0
- package/dist/esm/components/Panel/index.js +17 -27
- package/dist/esm/components/ProConfigProvider/context.d.ts +17 -0
- package/dist/esm/components/ProConfigProvider/context.js +6 -1
- package/dist/esm/components/ProConfigProvider/index.d.ts +10 -0
- package/dist/esm/components/ProConfigProvider/index.js +4 -9
- package/dist/esm/components/RenderForm/RenderForm.less +19 -0
- package/dist/esm/components/RenderForm/index.d.ts +64 -0
- package/dist/esm/components/RenderForm/index.js +106 -103
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.js +4 -17
- package/dist/esm/styles/antd-custom.less +5 -0
- package/dist/esm/styles/base.less +3 -6
- package/dist/esm/styles/dumi.less +17 -0
- package/dist/esm/styles/index.less +1 -0
- package/dist/esm/utils/getClassPrefix.d.ts +2 -0
- package/dist/index.css +26895 -0
- package/dist/index.html +36 -0
- package/dist/pro-components-dark.css +1 -0
- package/dist/pro-components-default.css +1 -0
- package/dist/umi.css +2 -0
- package/dist/umi.js +1 -0
- package/package.json +29 -30
- package/public/pro-components-dark.css +19 -0
- package/public/pro-components-default.css +23 -0
- package/dist/esm/components/ActionConfigForm/index.js +0 -129
- package/dist/esm/components/ColorPalette/ColorPalette.less +0 -9
- package/dist/esm/components/ColorPalette/index.js +0 -88
- package/dist/esm/components/MarkdownView/MarkdownView.less +0 -93
- package/dist/esm/components/MarkdownView/index.js +0 -142
- package/dist/esm/components/MdPlainText/MdPlainText.less +0 -118
- package/dist/esm/components/MdPlainText/constants.js +0 -2
- package/dist/esm/components/MdPlainText/index.js +0 -717
- package/dist/esm/components/MdPlainText/planinShortcuts.js +0 -18
- package/dist/esm/components/MdPlainText/textContent.js +0 -4
- package/dist/esm/components/MdPlainText/utils.js +0 -159
- package/dist/esm/components/PlainText/index.js +0 -122
- package/dist/esm/components/PlainTextBox/PlainTextBox.less +0 -94
- package/dist/esm/components/PlainTextBox/index.js +0 -264
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
-
import React, { useMemo, useImperativeHandle, useCallback, forwardRef } from 'react';
|
|
15
|
-
import { Editor, createEditor, Transforms, Node, Text } from 'slate';
|
|
16
|
-
import { withReact, ReactEditor } from 'slate-react';
|
|
17
|
-
import { CloseCircleFilled } from '@ant-design/icons';
|
|
18
|
-
import { withHistory } from 'slate-history';
|
|
19
|
-
import classnames from 'classnames';
|
|
20
|
-
import { ConfigContext } from 'antd/es/config-provider';
|
|
21
|
-
import PlainText from "../PlainText";
|
|
22
|
-
import getClassPrefix from "../../utils/getClassPrefix";
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
var PlainTextBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
|
-
var prefixCls = _ref.prefixCls,
|
|
27
|
-
hotKeys = _ref.hotKeys,
|
|
28
|
-
value = _ref.value,
|
|
29
|
-
placeholder = _ref.placeholder,
|
|
30
|
-
className = _ref.className,
|
|
31
|
-
readOnly = _ref.readOnly,
|
|
32
|
-
_onChange = _ref.onChange,
|
|
33
|
-
setPopverOpen = _ref.setPopverOpen,
|
|
34
|
-
_ref$allowClear = _ref.allowClear,
|
|
35
|
-
allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
|
|
36
|
-
toggleMouseWheel = _ref.toggleMouseWheel;
|
|
37
|
-
var _React$useContext = React.useContext(ConfigContext),
|
|
38
|
-
antGetPrefixCls = _React$useContext.getPrefixCls;
|
|
39
|
-
var antPrefixCls = antGetPrefixCls(prefixCls);
|
|
40
|
-
var clsPrefix = getClassPrefix(antPrefixCls, 'plain-text-box');
|
|
41
|
-
var withInlines = function withInlines(editor) {
|
|
42
|
-
var isInline = editor.isInline,
|
|
43
|
-
isSelectable = editor.isSelectable,
|
|
44
|
-
isElementReadOnly = editor.isElementReadOnly;
|
|
45
|
-
|
|
46
|
-
// 自定义的type需要在这里重写,否则编辑不认
|
|
47
|
-
editor.isInline = function (element) {
|
|
48
|
-
return ['badge'].includes(element.type) || isInline(element);
|
|
49
|
-
};
|
|
50
|
-
editor.isElementReadOnly = function (element) {
|
|
51
|
-
return element.type === 'badge' || isElementReadOnly(element);
|
|
52
|
-
};
|
|
53
|
-
editor.isSelectable = function (element) {
|
|
54
|
-
return element.type !== 'badge' && isSelectable(element);
|
|
55
|
-
};
|
|
56
|
-
return editor;
|
|
57
|
-
};
|
|
58
|
-
var editor = useMemo(function () {
|
|
59
|
-
return withInlines(withHistory(withReact(createEditor())));
|
|
60
|
-
}, []);
|
|
61
|
-
var splitWords = function splitWords(textContent) {
|
|
62
|
-
if (typeof textContent === 'string' && textContent.length > 0) {
|
|
63
|
-
var regex = /\$\{(.+?)\}/g;
|
|
64
|
-
var match = textContent.match(regex);
|
|
65
|
-
var parts = textContent.split(regex);
|
|
66
|
-
return parts.map(function (part) {
|
|
67
|
-
if (match !== null && match !== void 0 && match.includes("${".concat(part, "}"))) {
|
|
68
|
-
return {
|
|
69
|
-
highlight: true,
|
|
70
|
-
text: "${".concat(part, "}")
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
text: part
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return [{
|
|
79
|
-
text: textContent
|
|
80
|
-
}];
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// 获取浮窗的坐标位置
|
|
84
|
-
// const getPopverRect = () => {
|
|
85
|
-
// try {
|
|
86
|
-
// const domSelection = window.getSelection();
|
|
87
|
-
// if (domSelection) {
|
|
88
|
-
// const domRange = domSelection.getRangeAt(0);
|
|
89
|
-
// if (domRange) {
|
|
90
|
-
// const rect = domRange.getBoundingClientRect();
|
|
91
|
-
// setPopverRect(rect);
|
|
92
|
-
// }
|
|
93
|
-
// }
|
|
94
|
-
// } catch (err) {
|
|
95
|
-
// console.error(err);
|
|
96
|
-
// }
|
|
97
|
-
// };
|
|
98
|
-
|
|
99
|
-
// 监听文本坐标变化
|
|
100
|
-
var watchPreviousCharacter = function watchPreviousCharacter() {
|
|
101
|
-
var selection = editor.selection;
|
|
102
|
-
if (!selection) return;
|
|
103
|
-
// 获取当前路径上的文本节点
|
|
104
|
-
var textNode = Editor.node(editor, selection)[0];
|
|
105
|
-
if (Text.isText(textNode)) {
|
|
106
|
-
var _selection$focus;
|
|
107
|
-
var nodeStr = Node.string(textNode);
|
|
108
|
-
var lastStr = nodeStr && nodeStr.length > 0 ? nodeStr[(selection === null || selection === void 0 || (_selection$focus = selection.focus) === null || _selection$focus === void 0 ? void 0 : _selection$focus.offset) - 1] : null;
|
|
109
|
-
if (Array.isArray(hotKeys) && hotKeys.length > 0 && lastStr && hotKeys.includes(lastStr)) {
|
|
110
|
-
setPopverOpen === null || setPopverOpen === void 0 || setPopverOpen(true);
|
|
111
|
-
} else {
|
|
112
|
-
setPopverOpen === null || setPopverOpen === void 0 || setPopverOpen(false);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// 插入文字
|
|
118
|
-
var onInsertText = function onInsertText(textContent) {
|
|
119
|
-
var _selection$focus2;
|
|
120
|
-
var deleteBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
121
|
-
var selection = editor.selection;
|
|
122
|
-
if (!selection || !textContent) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
var newOffsetLength = (selection === null || selection === void 0 || (_selection$focus2 = selection.focus) === null || _selection$focus2 === void 0 ? void 0 : _selection$focus2.offset) + textContent.length;
|
|
126
|
-
if (deleteBackward) {
|
|
127
|
-
newOffsetLength -= 1;
|
|
128
|
-
editor.deleteBackward(editor, {
|
|
129
|
-
unit: 'word'
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
Transforms.insertText(editor, textContent);
|
|
133
|
-
// 创建新的选区
|
|
134
|
-
var newSelection = {
|
|
135
|
-
anchor: {
|
|
136
|
-
path: selection.anchor.path,
|
|
137
|
-
offset: newOffsetLength
|
|
138
|
-
},
|
|
139
|
-
focus: {
|
|
140
|
-
path: selection.focus.path,
|
|
141
|
-
offset: newOffsetLength
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
// 设置新的选区
|
|
145
|
-
Transforms.select(editor, newSelection);
|
|
146
|
-
ReactEditor.focus(editor);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// 插入节点
|
|
150
|
-
var onInsertNode = function onInsertNode(node) {
|
|
151
|
-
var deleteBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
152
|
-
var selection = editor.selection;
|
|
153
|
-
if (!selection || !node) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (deleteBackward) {
|
|
157
|
-
editor.deleteBackward(editor, {
|
|
158
|
-
unit: 'character'
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
Transforms.insertNodes(editor, node);
|
|
162
|
-
};
|
|
163
|
-
var renderLeaf = function renderLeaf(props) {
|
|
164
|
-
var attributes = props.attributes,
|
|
165
|
-
children = props.children,
|
|
166
|
-
leaf = props.leaf;
|
|
167
|
-
return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({}, attributes), {}, {
|
|
168
|
-
className: leaf.highlight ? "".concat(clsPrefix, "-badge") : '',
|
|
169
|
-
children: children
|
|
170
|
-
}));
|
|
171
|
-
};
|
|
172
|
-
var decorate = useCallback(function (_ref2) {
|
|
173
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
174
|
-
node = _ref3[0],
|
|
175
|
-
path = _ref3[1];
|
|
176
|
-
var ranges = [];
|
|
177
|
-
if (!Text.isText(node)) {
|
|
178
|
-
return ranges;
|
|
179
|
-
}
|
|
180
|
-
try {
|
|
181
|
-
// 对文字分片装饰
|
|
182
|
-
var tokens = splitWords(node.text);
|
|
183
|
-
var start = 0;
|
|
184
|
-
var _iterator = _createForOfIteratorHelper(tokens),
|
|
185
|
-
_step;
|
|
186
|
-
try {
|
|
187
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
188
|
-
var _token$text;
|
|
189
|
-
var token = _step.value;
|
|
190
|
-
var length = (token === null || token === void 0 || (_token$text = token.text) === null || _token$text === void 0 ? void 0 : _token$text.length) || 0;
|
|
191
|
-
var end = start + length;
|
|
192
|
-
ranges.push({
|
|
193
|
-
highlight: token === null || token === void 0 ? void 0 : token.highlight,
|
|
194
|
-
anchor: {
|
|
195
|
-
path: path,
|
|
196
|
-
offset: start
|
|
197
|
-
},
|
|
198
|
-
focus: {
|
|
199
|
-
path: path,
|
|
200
|
-
offset: end
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
start = end;
|
|
204
|
-
}
|
|
205
|
-
} catch (err) {
|
|
206
|
-
_iterator.e(err);
|
|
207
|
-
} finally {
|
|
208
|
-
_iterator.f();
|
|
209
|
-
}
|
|
210
|
-
} catch (err) {
|
|
211
|
-
console.log(err);
|
|
212
|
-
}
|
|
213
|
-
return ranges;
|
|
214
|
-
}, []);
|
|
215
|
-
var imperactiveHandle = {
|
|
216
|
-
onInsertText: onInsertText,
|
|
217
|
-
onInsertNode: onInsertNode
|
|
218
|
-
};
|
|
219
|
-
useImperativeHandle(ref, function () {
|
|
220
|
-
return imperactiveHandle;
|
|
221
|
-
});
|
|
222
|
-
return /*#__PURE__*/_jsx("div", {
|
|
223
|
-
className: classnames("".concat(clsPrefix, "-wrap"), className),
|
|
224
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
225
|
-
className: "".concat(clsPrefix, "-container"),
|
|
226
|
-
children: [/*#__PURE__*/_jsx(PlainText, {
|
|
227
|
-
placeholder: placeholder,
|
|
228
|
-
className: "".concat(clsPrefix, "-text"),
|
|
229
|
-
decorate: decorate,
|
|
230
|
-
editor: editor,
|
|
231
|
-
value: value,
|
|
232
|
-
readOnly: readOnly,
|
|
233
|
-
onChange: function onChange(content, nodes) {
|
|
234
|
-
watchPreviousCharacter();
|
|
235
|
-
if (_onChange) {
|
|
236
|
-
_onChange(content, nodes);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
// renderElement={renderElement}
|
|
240
|
-
,
|
|
241
|
-
renderLeaf: renderLeaf,
|
|
242
|
-
toggleMouseWheel: toggleMouseWheel
|
|
243
|
-
}), allowClear && value && /*#__PURE__*/_jsx("div", {
|
|
244
|
-
className: "".concat(clsPrefix, "-extra"),
|
|
245
|
-
children: /*#__PURE__*/_jsx(CloseCircleFilled, {
|
|
246
|
-
onClick: function onClick(ev) {
|
|
247
|
-
Transforms.removeNodes(editor, {
|
|
248
|
-
at: {
|
|
249
|
-
anchor: Editor.start(editor, []),
|
|
250
|
-
focus: Editor.end(editor, [])
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
Transforms.insertNodes(editor, {
|
|
254
|
-
children: [{
|
|
255
|
-
text: ''
|
|
256
|
-
}]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
})
|
|
260
|
-
})]
|
|
261
|
-
})
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
export default PlainTextBox;
|