@quansitech/antd-admin 1.1.8 → 1.1.9
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/dist/components/Column/Readonly/index.d.ts +0 -1
- package/dist/components/Column/Readonly/index.js +0 -3
- package/dist/components/Column/index.d.ts +0 -1
- package/dist/components/Column/index.js +0 -3
- package/dist/components/Table/Action/StartEditable.js +2 -2
- package/dist/lib/container.js +11 -0
- package/dist/lib/helpers.js +3 -2
- package/dist/lib/schemaHandler.js +13 -9
- package/dist/lib/writeExtra.js +1 -1
- package/package.json +1 -1
- package/dist/components/Column/Readonly/Ueditor.d.ts +0 -4
- package/dist/components/Column/Readonly/Ueditor.js +0 -25
- package/dist/components/Column/Readonly/Ueditor.scss +0 -6
- package/dist/components/Column/Ueditor.d.ts +0 -26
- package/dist/components/Column/Ueditor.js +0 -311
|
@@ -2,7 +2,6 @@ declare const _default: {
|
|
|
2
2
|
Cascader: () => Promise<typeof import("./Cascader")>;
|
|
3
3
|
File: () => Promise<typeof import("./File")>;
|
|
4
4
|
Image: () => Promise<typeof import("./Image")>;
|
|
5
|
-
Ueditor: () => Promise<typeof import("./Ueditor")>;
|
|
6
5
|
Action: () => Promise<typeof import("./Action")>;
|
|
7
6
|
};
|
|
8
7
|
export default _default;
|
|
@@ -27,14 +27,14 @@ export default function (props) {
|
|
|
27
27
|
}
|
|
28
28
|
var onStartClick = function onStartClick() {
|
|
29
29
|
var rowKey = tableContext.getTableProps().rowKey;
|
|
30
|
-
allChildren(tableContext.
|
|
30
|
+
allChildren(tableContext.dataSource, function (item) {
|
|
31
31
|
var _tableContext$actionR;
|
|
32
32
|
(_tableContext$actionR = tableContext.actionRef) === null || _tableContext$actionR === void 0 || _tableContext$actionR.startEditable(item[rowKey], item);
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
var onCancelClick = function onCancelClick() {
|
|
36
36
|
var rowKey = tableContext.getTableProps().rowKey;
|
|
37
|
-
allChildren(tableContext.
|
|
37
|
+
allChildren(tableContext.dataSource, function (item) {
|
|
38
38
|
var _tableContext$actionR2;
|
|
39
39
|
(_tableContext$actionR2 = tableContext.actionRef) === null || _tableContext$actionR2 === void 0 || _tableContext$actionR2.cancelEditable(item[rowKey]);
|
|
40
40
|
});
|
package/dist/lib/container.js
CHANGED
|
@@ -17,6 +17,7 @@ import tableAction from "../components/Table/Action";
|
|
|
17
17
|
import formAction from "../components/Form/Action";
|
|
18
18
|
import { lazy } from "react";
|
|
19
19
|
import { lowerFirst } from "lodash";
|
|
20
|
+
import { calc_file_hash } from "./upload";
|
|
20
21
|
var components = {};
|
|
21
22
|
var container = {
|
|
22
23
|
register: function register(name, componentLoader) {
|
|
@@ -50,6 +51,16 @@ var container = {
|
|
|
50
51
|
schemaHandler: schemaHandler,
|
|
51
52
|
routerNavigateTo: routerNavigateTo
|
|
52
53
|
};
|
|
54
|
+
if (typeof window !== 'undefined') {
|
|
55
|
+
;
|
|
56
|
+
(function (globalThis) {
|
|
57
|
+
if (globalThis.$qsContainer) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
globalThis.$qsContainer = container;
|
|
61
|
+
globalThis.calc_file_hash = calc_file_hash;
|
|
62
|
+
})(window);
|
|
63
|
+
}
|
|
53
64
|
function autoRegister(_x, _x2) {
|
|
54
65
|
return _autoRegister.apply(this, arguments);
|
|
55
66
|
} // -------- 通用 -----------
|
package/dist/lib/helpers.js
CHANGED
|
@@ -166,6 +166,7 @@ export function getProValueTypeMap() {
|
|
|
166
166
|
}, {});
|
|
167
167
|
}
|
|
168
168
|
export function handleCondition(condition, data) {
|
|
169
|
+
var _condition$value, _condition$value2;
|
|
169
170
|
switch (condition.operator) {
|
|
170
171
|
case 'eq':
|
|
171
172
|
case '=':
|
|
@@ -187,9 +188,9 @@ export function handleCondition(condition, data) {
|
|
|
187
188
|
case '<=':
|
|
188
189
|
return data[condition.field] <= condition.value;
|
|
189
190
|
case 'in':
|
|
190
|
-
return
|
|
191
|
+
return (_condition$value = condition.value) === null || _condition$value === void 0 ? void 0 : _condition$value.includes(data[condition.field]);
|
|
191
192
|
case 'not in':
|
|
192
|
-
return
|
|
193
|
+
return !((_condition$value2 = condition.value) !== null && _condition$value2 !== void 0 && _condition$value2.includes(data[condition.field]));
|
|
193
194
|
}
|
|
194
195
|
return false;
|
|
195
196
|
}
|
|
@@ -105,20 +105,24 @@ export var schemaHandler = {
|
|
|
105
105
|
return schema;
|
|
106
106
|
},
|
|
107
107
|
dependency: function dependency(schema) {
|
|
108
|
-
var _columns
|
|
108
|
+
var _columns;
|
|
109
|
+
var _columns2 = schema.columns,
|
|
109
110
|
valueType = schema.valueType;
|
|
111
|
+
_columns2 = ((_columns = _columns2) === null || _columns === void 0 ? void 0 : _columns.map(function (c) {
|
|
112
|
+
commonHandler(c);
|
|
113
|
+
if (container.schemaHandler[c.valueType]) {
|
|
114
|
+
return container.schemaHandler[c.valueType](c);
|
|
115
|
+
}
|
|
116
|
+
return c;
|
|
117
|
+
})) || [];
|
|
110
118
|
return {
|
|
111
119
|
valueType: valueType,
|
|
112
120
|
name: [schema.showCondition.field],
|
|
113
121
|
columns: function columns(fields) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
return c;
|
|
120
|
-
});
|
|
121
|
-
return handleCondition(schema.showCondition, fields) ? _columns : [];
|
|
122
|
+
if (schema.showCondition) {
|
|
123
|
+
return handleCondition(schema.showCondition, fields) ? _columns2 : [];
|
|
124
|
+
}
|
|
125
|
+
return _columns2;
|
|
122
126
|
}
|
|
123
127
|
};
|
|
124
128
|
},
|
package/dist/lib/writeExtra.js
CHANGED
|
@@ -23,6 +23,6 @@ export default function () {
|
|
|
23
23
|
cs.push("container.register('".concat(componentKey, "', ()=>import('../../../vendor").concat(path.join('/', e.path, e.component[componentKey]), "'));"));
|
|
24
24
|
}
|
|
25
25
|
return cs.join('\n');
|
|
26
|
-
}), "\n");
|
|
26
|
+
}).join('\n'), "\n");
|
|
27
27
|
fs.writeFileSync(process.cwd() + '/resources/js/backend/extra.ts', extra_script);
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useEffect, useState } from "react";
|
|
8
|
-
import "./Ueditor.scss";
|
|
9
|
-
export default function (props) {
|
|
10
|
-
var _useState = useState(props.fieldProps.value),
|
|
11
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
-
value = _useState2[0],
|
|
13
|
-
setValue = _useState2[1];
|
|
14
|
-
useEffect(function () {
|
|
15
|
-
var div = document.createElement('div');
|
|
16
|
-
div.innerHTML = props.fieldProps.value;
|
|
17
|
-
setValue(div.innerText);
|
|
18
|
-
}, []);
|
|
19
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: 'article-content',
|
|
21
|
-
dangerouslySetInnerHTML: {
|
|
22
|
-
__html: value
|
|
23
|
-
}
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ColumnProps } from "./types";
|
|
2
|
-
import React, { Component } from "react";
|
|
3
|
-
import { ModalContextProps } from "../ModalContext";
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
UE: any;
|
|
7
|
-
UE_LOADING_PROMISE: Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export default class Ueditor extends Component<ColumnProps & {
|
|
11
|
-
fieldProps: {
|
|
12
|
-
ueditorPath: string;
|
|
13
|
-
};
|
|
14
|
-
}, any> {
|
|
15
|
-
modalContext: ModalContextProps;
|
|
16
|
-
editor: any;
|
|
17
|
-
containerRef: HTMLElement | null;
|
|
18
|
-
state: {
|
|
19
|
-
loading: boolean;
|
|
20
|
-
containerId: string;
|
|
21
|
-
width: string;
|
|
22
|
-
};
|
|
23
|
-
componentDidMount(): void;
|
|
24
|
-
componentWillUnmount(): void;
|
|
25
|
-
render(): React.JSX.Element;
|
|
26
|
-
}
|
|
@@ -1,311 +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 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; }
|
|
3
|
-
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; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
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); }
|
|
8
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
-
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); }; }
|
|
10
|
-
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); }
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
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; } }
|
|
13
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
-
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; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
-
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); }
|
|
17
|
-
import React, { Component } from "react";
|
|
18
|
-
import { createScript } from "../../lib/helpers";
|
|
19
|
-
import { Spin } from "antd";
|
|
20
|
-
import { ModalContext } from "../ModalContext";
|
|
21
|
-
import { uniqueId } from "es-toolkit/compat";
|
|
22
|
-
var Ueditor = /*#__PURE__*/function (_Component) {
|
|
23
|
-
_inherits(Ueditor, _Component);
|
|
24
|
-
var _super = _createSuper(Ueditor);
|
|
25
|
-
function Ueditor() {
|
|
26
|
-
var _this;
|
|
27
|
-
_classCallCheck(this, Ueditor);
|
|
28
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
-
args[_key] = arguments[_key];
|
|
30
|
-
}
|
|
31
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "modalContext", {});
|
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "editor", null);
|
|
34
|
-
_defineProperty(_assertThisInitialized(_this), "containerRef", null);
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
36
|
-
loading: true,
|
|
37
|
-
containerId: uniqueId('ueditor_'),
|
|
38
|
-
width: ''
|
|
39
|
-
});
|
|
40
|
-
return _this;
|
|
41
|
-
}
|
|
42
|
-
_createClass(Ueditor, [{
|
|
43
|
-
key: "componentDidMount",
|
|
44
|
-
value: function componentDidMount() {
|
|
45
|
-
var _this$containerRef,
|
|
46
|
-
_this$containerRef2,
|
|
47
|
-
_this2 = this;
|
|
48
|
-
this.setState({
|
|
49
|
-
width: (_this$containerRef = this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.offsetWidth ? "".concat((_this$containerRef2 = this.containerRef) === null || _this$containerRef2 === void 0 ? void 0 : _this$containerRef2.offsetWidth, "px") : '100%'
|
|
50
|
-
});
|
|
51
|
-
if (!window.UE && !window.UE_LOADING_PROMISE) {
|
|
52
|
-
window.UE_LOADING_PROMISE = createScript(this.props.fieldProps.configJsPath || this.props.fieldProps.ueditorPath + '/ueditor.config.js').then(function () {
|
|
53
|
-
return createScript(_this2.props.fieldProps.ueditorPath + '/ueditor.all.js');
|
|
54
|
-
}).then(function () {
|
|
55
|
-
return createScript(_this2.props.fieldProps.ueditorPath + '/lang/zh-cn/zh-cn.js');
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
window.UE_LOADING_PROMISE.then(function () {
|
|
59
|
-
var _this2$props$fieldPro, _this2$props$fieldPro2, _this2$modalContext, _this2$editor;
|
|
60
|
-
var that = _this2;
|
|
61
|
-
window.UE.plugins['forceCatchRemoteImg'] = function () {
|
|
62
|
-
if (this.options.forcecatchremote) {
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
this.addListener("afterpaste", function (t, a) {
|
|
65
|
-
var load_src = that.props.fieldProps.ueditorPath + '/img/load.gif';
|
|
66
|
-
var domUtils = window.UE.dom.domUtils;
|
|
67
|
-
var parser = new DOMParser();
|
|
68
|
-
var pasteDom = parser.parseFromString(a.html, "text/html");
|
|
69
|
-
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
var allImgs = domUtils.getElementsByTagName(this.document, "img");
|
|
72
|
-
var imgs = domUtils.getElementsByTagName(pasteDom, "img");
|
|
73
|
-
var notCatch = function notCatch(src) {
|
|
74
|
-
if (src.indexOf(location.host) !== -1) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
if (/(^\.)|(^\/)/.test(src)) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return src.indexOf('img_catch_success') !== -1;
|
|
81
|
-
};
|
|
82
|
-
var catchGo = false;
|
|
83
|
-
for (var i = 0; i < imgs.length; i++) {
|
|
84
|
-
if (notCatch(imgs[i].src)) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
for (var l = 0; l < allImgs.length; l++) {
|
|
88
|
-
if (allImgs[l].src == imgs[i].src) {
|
|
89
|
-
catchGo = true;
|
|
90
|
-
domUtils.setAttributes(allImgs[l], {
|
|
91
|
-
"src": load_src,
|
|
92
|
-
"_src": allImgs[l].src
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (catchGo) {
|
|
98
|
-
var _that$editor, _that$props$form;
|
|
99
|
-
// $('.submit').trigger('startHandlePostData', '正在抓取图片');
|
|
100
|
-
that.setState({
|
|
101
|
-
loading: true
|
|
102
|
-
});
|
|
103
|
-
that.props.fieldProps.onChange('[抓取图片中]' + ((_that$editor = that.editor) === null || _that$editor === void 0 ? void 0 : _that$editor.getContent().replace(/^\[抓取图片中]/, '')));
|
|
104
|
-
that.props.dataIndex && ((_that$props$form = that.props.form) === null || _that$props$form === void 0 ? void 0 : _that$props$form.validateFields([that.props.dataIndex]));
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
this.addListener("catchremotesuccess", function () {
|
|
108
|
-
var _that$editor2, _that$props$form2;
|
|
109
|
-
that.props.fieldProps.onChange((_that$editor2 = that.editor) === null || _that$editor2 === void 0 ? void 0 : _that$editor2.getContent().replace(/^\[抓取图片中]/, ''));
|
|
110
|
-
that.props.dataIndex && ((_that$props$form2 = that.props.form) === null || _that$props$form2 === void 0 ? void 0 : _that$props$form2.validateFields([that.props.dataIndex]));
|
|
111
|
-
that.setState({
|
|
112
|
-
loading: false
|
|
113
|
-
});
|
|
114
|
-
// $('.submit').trigger('endHandlePostData');
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// plugins/insert_richtext.js
|
|
120
|
-
/**
|
|
121
|
-
* 抓取微信富文本
|
|
122
|
-
*/
|
|
123
|
-
window.UE.plugin.register('insert_richtext', function () {
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
var me = this;
|
|
126
|
-
function filter(div) {
|
|
127
|
-
var domUtils = window.UE.dom.domUtils;
|
|
128
|
-
var browser = window.UE.browser;
|
|
129
|
-
var utils = window.UE.utils;
|
|
130
|
-
var html;
|
|
131
|
-
var ci;
|
|
132
|
-
if (div.firstChild) {
|
|
133
|
-
//去掉cut中添加的边界值
|
|
134
|
-
var nodes = domUtils.getElementsByTagName(div, 'span');
|
|
135
|
-
for (var i = 0, ni; ni = nodes[i++];) {
|
|
136
|
-
if (ni.id == '_baidu_cut_start' || ni.id == '_baidu_cut_end') {
|
|
137
|
-
domUtils.remove(ni);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (browser.webkit) {
|
|
141
|
-
var brs = div.querySelectorAll('div br');
|
|
142
|
-
for (var _i = 0, bi; bi = brs[_i++];) {
|
|
143
|
-
var pN = bi.parentNode;
|
|
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
|
-
var divs = div.querySelectorAll('#baidu_pastebin');
|
|
152
|
-
for (var _i2 = 0, di; di = divs[_i2++];) {
|
|
153
|
-
var _di$parentNode;
|
|
154
|
-
var tmpP = me.document.createElement('p');
|
|
155
|
-
(_di$parentNode = di.parentNode) === null || _di$parentNode === void 0 || _di$parentNode.insertBefore(tmpP, di);
|
|
156
|
-
while (di.firstChild) {
|
|
157
|
-
tmpP.appendChild(di.firstChild);
|
|
158
|
-
}
|
|
159
|
-
domUtils.remove(di);
|
|
160
|
-
}
|
|
161
|
-
var metas = div.querySelectorAll('meta');
|
|
162
|
-
for (var _i3 = 0, _ci; _ci = metas[_i3++];) {
|
|
163
|
-
domUtils.remove(_ci);
|
|
164
|
-
}
|
|
165
|
-
brs = div.querySelectorAll('br');
|
|
166
|
-
for (var _i4 = 0; ci = brs[_i4++];) {
|
|
167
|
-
if (/^apple-/i.test(ci.className)) {
|
|
168
|
-
domUtils.remove(ci);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (browser.gecko) {
|
|
173
|
-
var dirtyNodes = div.querySelectorAll('[_moz_dirty]');
|
|
174
|
-
for (var _i5 = 0; ci = dirtyNodes[_i5++];) {
|
|
175
|
-
ci.removeAttribute('_moz_dirty');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (!browser.ie) {
|
|
179
|
-
var spans = div.querySelectorAll('span.Apple-style-span');
|
|
180
|
-
for (var _i6 = 0, _ci2; _ci2 = spans[_i6++];) {
|
|
181
|
-
domUtils.remove(_ci2, true);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
//ie下使用innerHTML会产生多余的\r\n字符,也会产生 这里过滤掉
|
|
186
|
-
html = div.innerHTML; //.replace(/>(?:(\s| )*?)</g,'><');
|
|
187
|
-
|
|
188
|
-
//过滤word粘贴过来的冗余属性
|
|
189
|
-
html = window.UE.filterWord(html);
|
|
190
|
-
//取消了忽略空白的第二个参数,粘贴过来的有些是有空白的,会被套上相关的标签
|
|
191
|
-
var root = window.UE.htmlparser(html);
|
|
192
|
-
|
|
193
|
-
//如果给了过滤规则就先进行过滤
|
|
194
|
-
if (me.options.filterRules) {
|
|
195
|
-
window.UE.filterNode(root, me.options.filterRules);
|
|
196
|
-
}
|
|
197
|
-
//执行默认的处理
|
|
198
|
-
me.filterInputRule(root);
|
|
199
|
-
//针对chrome的处理
|
|
200
|
-
if (browser.webkit) {
|
|
201
|
-
var br = root.lastChild();
|
|
202
|
-
if (br && br.type == 'element' && br.tagName == 'br') {
|
|
203
|
-
root.removeChild(br);
|
|
204
|
-
}
|
|
205
|
-
utils.each(me.body.querySelectorAll('div'), function (node) {
|
|
206
|
-
if (domUtils.isEmptyBlock(node)) {
|
|
207
|
-
domUtils.remove(node, true);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
html = {
|
|
212
|
-
'html': root.toHtml()
|
|
213
|
-
};
|
|
214
|
-
me.fireEvent('beforepaste', html, root);
|
|
215
|
-
//抢了默认的粘贴,那后边的内容就不执行了,比如表格粘贴
|
|
216
|
-
if (!html.html) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
root = window.UE.htmlparser(html.html, true);
|
|
220
|
-
//如果开启了纯文本模式
|
|
221
|
-
if (me.queryCommandState('pasteplain') === 1) {
|
|
222
|
-
me.execCommand('insertHtml', window.UE.filterNode(root, me.options.filterTxtRules).toHtml(), true);
|
|
223
|
-
} else {
|
|
224
|
-
//文本模式
|
|
225
|
-
window.UE.filterNode(root, me.options.filterTxtRules);
|
|
226
|
-
var txtContent = root.toHtml();
|
|
227
|
-
//完全模式
|
|
228
|
-
var htmlContent = html.html;
|
|
229
|
-
var address = me.selection.getRange().createAddress(true);
|
|
230
|
-
// @ts-ignore
|
|
231
|
-
me.execCommand('insertHtml', me.getOpt('retainOnlyLabelPasted') === true ? getPureHtml(htmlContent) : htmlContent, true);
|
|
232
|
-
}
|
|
233
|
-
me.fireEvent("afterpaste", html);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
bindEvents: {
|
|
238
|
-
'afterInsertRichText': function afterInsertRichText(e, html) {
|
|
239
|
-
var _that$editor3, _that$props$form3;
|
|
240
|
-
me.execCommand('cleardoc');
|
|
241
|
-
filter.call(me, html);
|
|
242
|
-
me.document.body.innerHTML = "<section>".concat(html, "</section>");
|
|
243
|
-
me.fireEvent('catchremoteimage');
|
|
244
|
-
that.setState({
|
|
245
|
-
loading: true
|
|
246
|
-
});
|
|
247
|
-
that.props.fieldProps.onChange('[抓取图片中]' + ((_that$editor3 = that.editor) === null || _that$editor3 === void 0 ? void 0 : _that$editor3.getContent().replace(/^\[抓取图片中]/, '')));
|
|
248
|
-
that.props.dataIndex && ((_that$props$form3 = that.props.form) === null || _that$props$form3 === void 0 ? void 0 : _that$props$form3.validateFields([that.props.dataIndex]));
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
commands: {}
|
|
252
|
-
};
|
|
253
|
-
});
|
|
254
|
-
var config = _objectSpread(_objectSpread({}, (_this2$props$fieldPro = _this2.props.fieldProps) === null || _this2$props$fieldPro === void 0 ? void 0 : _this2$props$fieldPro.config), {}, {
|
|
255
|
-
forcecatchremote: typeof ((_this2$props$fieldPro2 = _this2.props.fieldProps) === null || _this2$props$fieldPro2 === void 0 || (_this2$props$fieldPro2 = _this2$props$fieldPro2.config) === null || _this2$props$fieldPro2 === void 0 ? void 0 : _this2$props$fieldPro2.forcecatchremote) === 'undefined' ? true : _this2.props.fieldProps.config.forcecatchremote
|
|
256
|
-
});
|
|
257
|
-
if ((_this2$modalContext = _this2.modalContext) !== null && _this2$modalContext !== void 0 && _this2$modalContext.inModal) {
|
|
258
|
-
config.zIndex = 2000;
|
|
259
|
-
config.topOffset = 0;
|
|
260
|
-
}
|
|
261
|
-
_this2.editor = window.UE.getEditor(_this2.state.containerId, config);
|
|
262
|
-
(_this2$editor = _this2.editor) === null || _this2$editor === void 0 || _this2$editor.ready(function () {
|
|
263
|
-
var _this2$editor4;
|
|
264
|
-
var value = _this2.props.fieldProps.value;
|
|
265
|
-
if (value) {
|
|
266
|
-
var _this2$editor2, _this2$editor3;
|
|
267
|
-
var div = document.createElement('div');
|
|
268
|
-
div.innerHTML = value;
|
|
269
|
-
(_this2$editor2 = _this2.editor) === null || _this2$editor2 === void 0 || _this2$editor2.setContent(div.innerText || '');
|
|
270
|
-
_this2.props.fieldProps.onChange((_this2$editor3 = _this2.editor) === null || _this2$editor3 === void 0 ? void 0 : _this2$editor3.getContent());
|
|
271
|
-
}
|
|
272
|
-
(_this2$editor4 = _this2.editor) === null || _this2$editor4 === void 0 || _this2$editor4.addListener('contentChange', function () {
|
|
273
|
-
var _this2$editor5;
|
|
274
|
-
_this2.props.fieldProps.onChange((_this2$editor5 = _this2.editor) === null || _this2$editor5 === void 0 ? void 0 : _this2$editor5.getContent());
|
|
275
|
-
});
|
|
276
|
-
_this2.setState({
|
|
277
|
-
loading: false
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}, {
|
|
283
|
-
key: "componentWillUnmount",
|
|
284
|
-
value: function componentWillUnmount() {
|
|
285
|
-
var _this$editor;
|
|
286
|
-
(_this$editor = this.editor) === null || _this$editor === void 0 || _this$editor.destroy();
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "render",
|
|
290
|
-
value: function render() {
|
|
291
|
-
var _this3 = this;
|
|
292
|
-
return /*#__PURE__*/React.createElement(ModalContext.Consumer, null, function (modalContext) {
|
|
293
|
-
_this3.modalContext = modalContext;
|
|
294
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
295
|
-
ref: function ref(el) {
|
|
296
|
-
return _this3.containerRef = el;
|
|
297
|
-
}
|
|
298
|
-
}, /*#__PURE__*/React.createElement(Spin, {
|
|
299
|
-
spinning: _this3.state.loading
|
|
300
|
-
}, /*#__PURE__*/React.createElement("textarea", {
|
|
301
|
-
id: _this3.state.containerId,
|
|
302
|
-
style: {
|
|
303
|
-
width: _this3.state.width
|
|
304
|
-
}
|
|
305
|
-
})));
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}]);
|
|
309
|
-
return Ueditor;
|
|
310
|
-
}(Component);
|
|
311
|
-
export { Ueditor as default };
|