@quansitech/antd-admin 1.0.0 → 1.1.0
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/components/Column/Cascader.tsx +78 -78
- package/components/Column/File.tsx +165 -167
- package/components/Column/Image.tsx +76 -76
- package/components/{Table/Option → Column/Readonly/Action}/Link.tsx +77 -67
- package/components/{Table/Option → Column/Readonly/Action}/types.d.ts +5 -4
- package/components/Column/Readonly/Action.tsx +80 -0
- package/components/Column/Readonly/Cascader.tsx +50 -50
- package/components/Column/Readonly/File.tsx +52 -53
- package/components/Column/Readonly/Image.tsx +38 -77
- package/components/Column/Readonly/Ueditor.tsx +18 -0
- package/components/Column/Readonly/types.d.ts +9 -8
- package/components/Column/Ueditor.tsx +313 -313
- package/components/Column/types.d.ts +29 -28
- package/components/Form/Action/Button.tsx +128 -124
- package/components/Form/Action/types.d.ts +5 -4
- package/components/Form/Actions.tsx +38 -34
- package/components/Form.tsx +176 -170
- package/components/FormContext.ts +8 -7
- package/components/Layout/New.tsx +252 -0
- package/components/Layout.tsx +52 -237
- package/components/LayoutContext.ts +25 -25
- package/components/ModalContext.ts +15 -15
- package/components/Table/Action/Button.tsx +88 -88
- package/components/Table/Action/StartEditable.tsx +58 -58
- package/components/Table/Action/types.d.ts +7 -6
- package/components/Table/ToolbarActions.tsx +43 -38
- package/components/Table.scss +4 -7
- package/components/Table.tsx +280 -279
- package/components/TableContext.ts +14 -13
- package/components/Tabs.tsx +71 -71
- package/lib/container.ts +83 -81
- package/lib/customRule.ts +9 -9
- package/lib/global.ts +10 -10
- package/lib/helpers.tsx +145 -149
- package/lib/http.ts +73 -73
- package/lib/schemaHandler.ts +121 -121
- package/lib/upload.ts +177 -177
- package/lib/writeExtra.js +31 -0
- package/package.json +2 -6
- package/readme.md +151 -128
- package/components/Column/Readonly/Option.tsx +0 -58
|
@@ -1,314 +1,314 @@
|
|
|
1
|
-
import {ColumnProps} from "./types";
|
|
2
|
-
import {Component} from "react";
|
|
3
|
-
import {createScript, filterObjectKeys} from "../../lib/helpers";
|
|
4
|
-
import {Spin} from "antd";
|
|
5
|
-
import {ModalContext, ModalContextProps} from "../ModalContext";
|
|
6
|
-
import uniqueId from "lodash
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
me.
|
|
245
|
-
|
|
246
|
-
me.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
</ModalContext.Consumer>
|
|
313
|
-
}
|
|
1
|
+
import {ColumnProps} from "./types";
|
|
2
|
+
import {Component} from "react";
|
|
3
|
+
import {createScript, filterObjectKeys} from "../../lib/helpers";
|
|
4
|
+
import {Spin} from "antd";
|
|
5
|
+
import {ModalContext, ModalContextProps} from "../ModalContext";
|
|
6
|
+
import {uniqueId} from "lodash";
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
UE: any,
|
|
11
|
+
UE_LOADING_PROMISE: Promise<any>,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class Ueditor extends Component<ColumnProps & {
|
|
16
|
+
fieldProps: {
|
|
17
|
+
ueditorPath: string,
|
|
18
|
+
}
|
|
19
|
+
}, any> {
|
|
20
|
+
modalContext = {} as ModalContextProps
|
|
21
|
+
|
|
22
|
+
editor: any = null
|
|
23
|
+
catching = false
|
|
24
|
+
containerRef: HTMLElement | null = null
|
|
25
|
+
state = {
|
|
26
|
+
loading: true,
|
|
27
|
+
containerId: uniqueId('ueditor_'),
|
|
28
|
+
width: '',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
componentDidMount() {
|
|
33
|
+
this.setState({
|
|
34
|
+
width: this.containerRef?.offsetWidth ? `${this.containerRef?.offsetWidth}px` : '100%'
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
this.props.rules?.push({
|
|
38
|
+
validator: async (rule: any, value: any) => {
|
|
39
|
+
if (this.catching) {
|
|
40
|
+
throw new Error('正在抓取图片')
|
|
41
|
+
}
|
|
42
|
+
return true
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
if (!window.UE && !window.UE_LOADING_PROMISE) {
|
|
47
|
+
window.UE_LOADING_PROMISE =
|
|
48
|
+
createScript(this.props.fieldProps.configJsPath || this.props.fieldProps.ueditorPath + '/ueditor.config.js')
|
|
49
|
+
.then(() => {
|
|
50
|
+
return createScript(this.props.fieldProps.ueditorPath + '/ueditor.all.js')
|
|
51
|
+
})
|
|
52
|
+
.then(() => {
|
|
53
|
+
return createScript(this.props.fieldProps.ueditorPath + '/lang/zh-cn/zh-cn.js')
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
window.UE_LOADING_PROMISE.then(() => {
|
|
58
|
+
let that = this
|
|
59
|
+
window.UE.plugins['forceCatchRemoteImg'] = function () {
|
|
60
|
+
if (this.options.forcecatchremote) {
|
|
61
|
+
this.addListener("afterpaste", function (t: any, a: any) {
|
|
62
|
+
const load_src = that.props.fieldProps.ueditorPath + '/img/load.gif';
|
|
63
|
+
const domUtils = window.UE.dom.domUtils;
|
|
64
|
+
|
|
65
|
+
const parser = new DOMParser();
|
|
66
|
+
const pasteDom = parser.parseFromString(a.html, "text/html");
|
|
67
|
+
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const allImgs = domUtils.getElementsByTagName(this.document, "img");
|
|
70
|
+
const imgs = domUtils.getElementsByTagName(pasteDom, "img");
|
|
71
|
+
|
|
72
|
+
let notCatch = (src: string) => {
|
|
73
|
+
if (src.indexOf(location.host) !== -1) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (/(^\.)|(^\/)/.test(src)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return src.indexOf('img_catch_success') !== -1;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let catchGo = false;
|
|
84
|
+
for (let i = 0; i < imgs.length; i++) {
|
|
85
|
+
if (notCatch(imgs[i].src)) {
|
|
86
|
+
continue
|
|
87
|
+
}
|
|
88
|
+
for (let l = 0; l < allImgs.length; l++) {
|
|
89
|
+
if (allImgs[l].src == imgs[i].src) {
|
|
90
|
+
catchGo = true;
|
|
91
|
+
domUtils.setAttributes(allImgs[l], {
|
|
92
|
+
"src": load_src,
|
|
93
|
+
"_src": allImgs[l].src
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (catchGo) {
|
|
100
|
+
// $('.submit').trigger('startHandlePostData', '正在抓取图片');
|
|
101
|
+
that.catching = true
|
|
102
|
+
that.props.dataIndex && that.props.form?.validateFields([that.props.dataIndex])
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
this.addListener("catchremotesuccess", function () {
|
|
107
|
+
that.catching = false
|
|
108
|
+
that.props.dataIndex && that.props.form?.validateFields([that.props.dataIndex])
|
|
109
|
+
// $('.submit').trigger('endHandlePostData');
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// plugins/insert_richtext.js
|
|
116
|
+
/**
|
|
117
|
+
* 抓取微信富文本
|
|
118
|
+
*/
|
|
119
|
+
window.UE.plugin.register('insert_richtext', function () {
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
const me = this;
|
|
122
|
+
|
|
123
|
+
function filter(div: HTMLElement) {
|
|
124
|
+
const domUtils = window.UE.dom.domUtils;
|
|
125
|
+
const browser = window.UE.browser;
|
|
126
|
+
const utils = window.UE.utils;
|
|
127
|
+
|
|
128
|
+
let html;
|
|
129
|
+
let ci;
|
|
130
|
+
if (div.firstChild) {
|
|
131
|
+
//去掉cut中添加的边界值
|
|
132
|
+
const nodes = domUtils.getElementsByTagName(div, 'span');
|
|
133
|
+
for (let i = 0, ni; ni = nodes[i++];) {
|
|
134
|
+
if (ni.id == '_baidu_cut_start' || ni.id == '_baidu_cut_end') {
|
|
135
|
+
domUtils.remove(ni);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (browser.webkit) {
|
|
140
|
+
|
|
141
|
+
let brs = div.querySelectorAll('div br');
|
|
142
|
+
for (let i = 0, bi; bi = brs[i++];) {
|
|
143
|
+
const pN = bi.parentNode as HTMLElement;
|
|
144
|
+
if (pN) {
|
|
145
|
+
if (pN.tagName == 'DIV' && pN.childNodes.length == 1) {
|
|
146
|
+
pN.innerHTML = '<p><br/></p>';
|
|
147
|
+
domUtils.remove(pN);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const divs = div.querySelectorAll('#baidu_pastebin');
|
|
152
|
+
for (let i = 0, di; di = divs[i++];) {
|
|
153
|
+
const tmpP = me.document.createElement('p');
|
|
154
|
+
di.parentNode?.insertBefore(tmpP, di);
|
|
155
|
+
while (di.firstChild) {
|
|
156
|
+
tmpP.appendChild(di.firstChild);
|
|
157
|
+
}
|
|
158
|
+
domUtils.remove(di);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const metas = div.querySelectorAll('meta');
|
|
162
|
+
for (let i = 0, ci; ci = metas[i++];) {
|
|
163
|
+
domUtils.remove(ci);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
brs = div.querySelectorAll('br');
|
|
167
|
+
for (let i = 0; ci = brs[i++];) {
|
|
168
|
+
if (/^apple-/i.test(ci.className)) {
|
|
169
|
+
domUtils.remove(ci);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (browser.gecko) {
|
|
174
|
+
const dirtyNodes = div.querySelectorAll('[_moz_dirty]');
|
|
175
|
+
for (let i = 0; ci = dirtyNodes[i++];) {
|
|
176
|
+
ci.removeAttribute('_moz_dirty');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (!browser.ie) {
|
|
180
|
+
const spans = div.querySelectorAll('span.Apple-style-span');
|
|
181
|
+
for (let i = 0, ci; ci = spans[i++];) {
|
|
182
|
+
domUtils.remove(ci, true);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
//ie下使用innerHTML会产生多余的\r\n字符,也会产生 这里过滤掉
|
|
187
|
+
html = div.innerHTML;//.replace(/>(?:(\s| )*?)</g,'><');
|
|
188
|
+
|
|
189
|
+
//过滤word粘贴过来的冗余属性
|
|
190
|
+
html = window.UE.filterWord(html);
|
|
191
|
+
//取消了忽略空白的第二个参数,粘贴过来的有些是有空白的,会被套上相关的标签
|
|
192
|
+
var root = window.UE.htmlparser(html);
|
|
193
|
+
|
|
194
|
+
//如果给了过滤规则就先进行过滤
|
|
195
|
+
if (me.options.filterRules) {
|
|
196
|
+
window.UE.filterNode(root, me.options.filterRules);
|
|
197
|
+
}
|
|
198
|
+
//执行默认的处理
|
|
199
|
+
me.filterInputRule(root);
|
|
200
|
+
//针对chrome的处理
|
|
201
|
+
if (browser.webkit) {
|
|
202
|
+
var br = root.lastChild();
|
|
203
|
+
if (br && br.type == 'element' && br.tagName == 'br') {
|
|
204
|
+
root.removeChild(br)
|
|
205
|
+
}
|
|
206
|
+
utils.each(me.body.querySelectorAll('div'), function (node: HTMLElement) {
|
|
207
|
+
if (domUtils.isEmptyBlock(node)) {
|
|
208
|
+
domUtils.remove(node, true)
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
html = {'html': root.toHtml()};
|
|
213
|
+
me.fireEvent('beforepaste', html, root);
|
|
214
|
+
//抢了默认的粘贴,那后边的内容就不执行了,比如表格粘贴
|
|
215
|
+
if (!html.html) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
root = window.UE.htmlparser(html.html, true);
|
|
219
|
+
//如果开启了纯文本模式
|
|
220
|
+
if (me.queryCommandState('pasteplain') === 1) {
|
|
221
|
+
me.execCommand('insertHtml', window.UE.filterNode(root, me.options.filterTxtRules).toHtml(), true);
|
|
222
|
+
} else {
|
|
223
|
+
//文本模式
|
|
224
|
+
window.UE.filterNode(root, me.options.filterTxtRules);
|
|
225
|
+
const txtContent = root.toHtml();
|
|
226
|
+
//完全模式
|
|
227
|
+
const htmlContent = html.html;
|
|
228
|
+
|
|
229
|
+
const address = me.selection.getRange().createAddress(true);
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
me.execCommand('insertHtml', me.getOpt('retainOnlyLabelPasted') === true ? getPureHtml(htmlContent) : htmlContent, true);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
me.fireEvent("afterpaste", html);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
bindEvents: {
|
|
241
|
+
'afterInsertRichText': function (e: Event, html: HTMLElement) {
|
|
242
|
+
me.execCommand('cleardoc');
|
|
243
|
+
filter.call(me, html);
|
|
244
|
+
me.document.body.innerHTML = `<section>${html}</section>`;
|
|
245
|
+
|
|
246
|
+
me.fireEvent('catchremoteimage');
|
|
247
|
+
|
|
248
|
+
that.catching = true
|
|
249
|
+
that.props.dataIndex && that.props.form?.validateFields([that.props.dataIndex])
|
|
250
|
+
// $('.submit').trigger('startHandlePostData', '正在抓取图片');
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
commands: {}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
const config = {
|
|
259
|
+
...this.props.fieldProps?.config,
|
|
260
|
+
forcecatchremote: typeof this.props.fieldProps?.config?.forcecatchremote === 'undefined' ? true : this.props.fieldProps.config.forcecatchremote,
|
|
261
|
+
}
|
|
262
|
+
if (this.modalContext?.inModal) {
|
|
263
|
+
config.zIndex = 2000
|
|
264
|
+
config.topOffset = 0
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this.editor = window.UE.getEditor(this.state.containerId, config)
|
|
268
|
+
this.editor?.ready(() => {
|
|
269
|
+
const value = this.props.config.value
|
|
270
|
+
if (value) {
|
|
271
|
+
const div = document.createElement('div')
|
|
272
|
+
div.innerHTML = value
|
|
273
|
+
this.editor?.setContent(div.innerText || '')
|
|
274
|
+
this.props.form?.setFieldValue(this.props.dataIndex, this.editor?.getContent())
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
this.editor?.addListener('contentChange', () => {
|
|
278
|
+
this.props.form?.setFieldValue(this.props.dataIndex, this.editor?.getContent())
|
|
279
|
+
})
|
|
280
|
+
this.setState({loading: false})
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
componentWillUnmount() {
|
|
287
|
+
this.editor?.destroy()
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
render() {
|
|
291
|
+
return <ModalContext.Consumer>
|
|
292
|
+
{
|
|
293
|
+
modalContext => {
|
|
294
|
+
this.modalContext = modalContext
|
|
295
|
+
return <div {...filterObjectKeys(this.props, [
|
|
296
|
+
'id',
|
|
297
|
+
'fieldProps',
|
|
298
|
+
'onChange',
|
|
299
|
+
'value',
|
|
300
|
+
'form',
|
|
301
|
+
'config',
|
|
302
|
+
'rules',
|
|
303
|
+
'ueditorPath',
|
|
304
|
+
'dataIndex',
|
|
305
|
+
])} ref={el => this.containerRef = el}>
|
|
306
|
+
<Spin spinning={this.state.loading}>
|
|
307
|
+
<div id={this.state.containerId} style={{width: this.state.width}}/>
|
|
308
|
+
</Spin>
|
|
309
|
+
</div>
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
</ModalContext.Consumer>
|
|
313
|
+
}
|
|
314
314
|
}
|