@vtx/components 4.0.0-beta.8 → 4.0.0-beta.81
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 +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +106 -137
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +124 -32
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -33
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +211 -70
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +30 -19
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +37 -33
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +57 -3
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +13 -9
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +102 -36
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +42 -34
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +98 -35
- package/es/vtx-tree-select/index.js +71 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +93 -39
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +113 -143
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +124 -32
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -34
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +209 -71
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -18
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +37 -33
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +57 -3
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +13 -9
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +104 -38
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +40 -31
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +96 -33
- package/lib/vtx-tree-select/index.js +71 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +91 -37
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/package.json +240 -225
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -10,26 +10,27 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _editorForReact = require("@wangeditor/editor-for-react");
|
|
11
11
|
var _pluginUploadAttachment = _interopRequireDefault(require("@wangeditor/plugin-upload-attachment"));
|
|
12
12
|
var _editor = require("@wangeditor/editor");
|
|
13
|
-
var
|
|
13
|
+
var _getToken = _interopRequireDefault(require("../utils/getToken"));
|
|
14
14
|
var _antd = require("antd");
|
|
15
|
+
var _wangEditorUtil = require("./wangEditorUtil");
|
|
15
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
17
|
var _index = require("./style/index");
|
|
17
18
|
var _context2 = require("antd/es/form/context");
|
|
18
19
|
var _statusUtils = require("antd/es/_util/statusUtils");
|
|
19
20
|
var _vtxProvider = require("../vtx-provider");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "maxNumberOfFiles", "height", "status", "enableSanitization"];
|
|
22
|
+
var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "defaultMaxFileSize", "maxNumberOfFiles", "height", "status", "enableSanitization", "toolConfig", "editConfig"];
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
27
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
28
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
25
29
|
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; }
|
|
26
30
|
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; }
|
|
27
31
|
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; }
|
|
28
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
33
|
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); }
|
|
30
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
31
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
32
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
34
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
34
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
36
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -49,7 +50,6 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
49
50
|
var _useStyle = (0, _index.useStyle)(prefixCls),
|
|
50
51
|
wrapSSR = _useStyle.wrapSSR,
|
|
51
52
|
hashId = _useStyle.hashId;
|
|
52
|
-
|
|
53
53
|
// 添加加载状态管理
|
|
54
54
|
var _useState = (0, _react.useState)(false),
|
|
55
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -66,6 +66,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
66
66
|
setError(error.message);
|
|
67
67
|
// 可以在这里添加错误上报逻辑
|
|
68
68
|
}, []);
|
|
69
|
+
var valueRef = (0, _react.useRef)();
|
|
69
70
|
var _React$useContext = _react.default.useContext(_context2.FormItemInputContext),
|
|
70
71
|
contextStatus = _React$useContext.status,
|
|
71
72
|
hasFeedback = _React$useContext.hasFeedback,
|
|
@@ -81,6 +82,8 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
81
82
|
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
|
|
82
83
|
_props$maxFileSize = props.maxFileSize,
|
|
83
84
|
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
85
|
+
_props$defaultMaxFile = props.defaultMaxFileSize,
|
|
86
|
+
defaultMaxFileSize = _props$defaultMaxFile === void 0 ? 1024 * 1024 * 1024 : _props$defaultMaxFile,
|
|
84
87
|
_props$maxNumberOfFil = props.maxNumberOfFiles,
|
|
85
88
|
maxNumberOfFiles = _props$maxNumberOfFil === void 0 ? 5 : _props$maxNumberOfFil,
|
|
86
89
|
_props$height = props.height,
|
|
@@ -88,22 +91,45 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
88
91
|
customStatus = props.status,
|
|
89
92
|
_props$enableSanitiza = props.enableSanitization,
|
|
90
93
|
enableSanitization = _props$enableSanitiza === void 0 ? true : _props$enableSanitiza,
|
|
94
|
+
_props$toolConfig = props.toolConfig,
|
|
95
|
+
toolConfig = _props$toolConfig === void 0 ? {} : _props$toolConfig,
|
|
96
|
+
_props$editConfig = props.editConfig,
|
|
97
|
+
editConfig = _props$editConfig === void 0 ? {} : _props$editConfig,
|
|
91
98
|
rest = _objectWithoutProperties(props, _excluded);
|
|
99
|
+
var language = props !== null && props !== void 0 && props.language || (intl === null || intl === void 0 ? void 0 : intl.locale) == 'en_US' ? 'en' : 'zh-CN' || 'zh-CN'; // en || zh-CN
|
|
100
|
+
var TextEnum = _objectSpread({
|
|
101
|
+
messageOverSizeText: intl.getMessage('wangEditor.messageOverSizeText', '超过文件大小限制,最大文件大小为'),
|
|
102
|
+
messageUploadFailText: intl.getMessage('wangEditor.imageUploadFailed', '上传出错'),
|
|
103
|
+
messageInsertImgFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入图片失败'),
|
|
104
|
+
messageInsertVideoFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入视频失败'),
|
|
105
|
+
messageInsertAttachmentFailText: ('wangEditor.imageUploadFailed', '插入附件失败')
|
|
106
|
+
}, props.customEnumText);
|
|
92
107
|
var mergedStatus = (0, _statusUtils.getMergedStatus)(contextStatus, customStatus);
|
|
93
108
|
var _useState5 = (0, _react.useState)(null),
|
|
94
109
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
95
110
|
editor = _useState6[0],
|
|
96
111
|
setEditor = _useState6[1];
|
|
112
|
+
(0, _react.useEffect)(function () {
|
|
113
|
+
if (language) {
|
|
114
|
+
console.log('language', language);
|
|
115
|
+
(0, _editor.i18nChangeLanguage)(language);
|
|
116
|
+
}
|
|
117
|
+
}, [language]);
|
|
97
118
|
|
|
98
119
|
// 及时销毁 editor ,重要!
|
|
99
120
|
(0, _react.useEffect)(function () {
|
|
100
121
|
return function () {
|
|
122
|
+
window.REGISTRY_UPLOAD_FILE = false;
|
|
123
|
+
if (editor == null) return;
|
|
101
124
|
if (editor) {
|
|
102
125
|
editor.destroy();
|
|
103
126
|
setEditor(null);
|
|
104
127
|
}
|
|
105
128
|
};
|
|
106
129
|
}, []);
|
|
130
|
+
(0, _react.useEffect)(function () {
|
|
131
|
+
valueRef.current = value;
|
|
132
|
+
}, [value]);
|
|
107
133
|
|
|
108
134
|
// 修改安全的粘贴处理函数
|
|
109
135
|
var handleSafePaste = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
@@ -226,10 +252,14 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
226
252
|
var newValue = editor.getHtml() || undefined;
|
|
227
253
|
// 对输出内容也进行安全过滤
|
|
228
254
|
var processedValue = enableSanitization && newValue !== undefined ? (0, _wangEditorUtil.sanitizeHtml)(newValue) : newValue;
|
|
229
|
-
console.log('编辑器内容变化,处理前内容:', newValue);
|
|
230
|
-
console.log('编辑器内容变化,处理后内容:', processedValue);
|
|
231
|
-
if (processedValue !==
|
|
232
|
-
|
|
255
|
+
// console.log('编辑器内容变化,处理前内容:', newValue);
|
|
256
|
+
// console.log('编辑器内容变化,处理后内容:', processedValue);
|
|
257
|
+
if (processedValue !== valueRef.current) {
|
|
258
|
+
if (processedValue === undefined) {
|
|
259
|
+
onChange('');
|
|
260
|
+
} else {
|
|
261
|
+
onChange(processedValue);
|
|
262
|
+
}
|
|
233
263
|
}
|
|
234
264
|
} catch (error) {
|
|
235
265
|
handleError(new Error('编辑器内容处理失败: ' + error.message));
|
|
@@ -237,21 +267,33 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
237
267
|
}, [value, onChange, enableSanitization, handleError]);
|
|
238
268
|
|
|
239
269
|
// 编辑器配置
|
|
240
|
-
var editorConfig = {
|
|
270
|
+
var editorConfig = _objectSpread(_objectSpread({}, editConfig), {}, {
|
|
241
271
|
MENU_CONF: {
|
|
242
272
|
// 插入图片
|
|
243
273
|
uploadImage: {
|
|
244
274
|
server: uploadUrl,
|
|
245
|
-
maxFileSize:
|
|
275
|
+
maxFileSize: defaultMaxFileSize,
|
|
246
276
|
maxNumberOfFiles: maxNumberOfFiles,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
277
|
+
headers: {
|
|
278
|
+
access_token: (0, _getToken.default)(),
|
|
279
|
+
Authorization: 'Bearer ' + (0, _getToken.default)()
|
|
250
280
|
},
|
|
251
281
|
// onSuccess(file, res) {},
|
|
282
|
+
onBeforeUpload: function onBeforeUpload(file) {
|
|
283
|
+
for (var key in file) {
|
|
284
|
+
if (file[key].size > maxFileSize) {
|
|
285
|
+
_antd.message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
|
|
286
|
+
// return { [key]: false };
|
|
287
|
+
return {};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return file;
|
|
291
|
+
},
|
|
292
|
+
onError: function onError(file, err, res) {
|
|
293
|
+
console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
|
|
294
|
+
},
|
|
252
295
|
customInsert: function customInsert(res, insertFn) {
|
|
253
296
|
try {
|
|
254
|
-
console.log(res, insertFn);
|
|
255
297
|
// res 即服务端的返回结果
|
|
256
298
|
// 从 res 中找到 url alt href ,然后插入图片
|
|
257
299
|
if (res.result == 0) {
|
|
@@ -259,7 +301,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
259
301
|
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
260
302
|
});
|
|
261
303
|
} else {
|
|
262
|
-
throw new Error(
|
|
304
|
+
throw new Error("".concat(TextEnum.messageInsertImgFailText));
|
|
263
305
|
}
|
|
264
306
|
} catch (error) {
|
|
265
307
|
handleError(error);
|
|
@@ -269,8 +311,24 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
269
311
|
// 插入视频
|
|
270
312
|
uploadVideo: {
|
|
271
313
|
server: uploadUrl,
|
|
314
|
+
maxFileSize: defaultMaxFileSize,
|
|
315
|
+
headers: {
|
|
316
|
+
access_token: (0, _getToken.default)(),
|
|
317
|
+
Authorization: 'Bearer ' + (0, _getToken.default)()
|
|
318
|
+
},
|
|
272
319
|
onError: function onError(file, err, res) {
|
|
273
|
-
|
|
320
|
+
console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
|
|
321
|
+
},
|
|
322
|
+
onBeforeUpload: function onBeforeUpload(file) {
|
|
323
|
+
for (var key in file) {
|
|
324
|
+
if (file[key].size > maxFileSize) {
|
|
325
|
+
_antd.message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
|
|
326
|
+
|
|
327
|
+
// return { [key]: false };
|
|
328
|
+
return {};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return file;
|
|
274
332
|
},
|
|
275
333
|
// onSuccess(file, res) {},
|
|
276
334
|
// 上传成功后,用户自定义插入文件
|
|
@@ -281,7 +339,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
281
339
|
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
282
340
|
});
|
|
283
341
|
} else {
|
|
284
|
-
throw new Error(
|
|
342
|
+
throw new Error("".concat(TextEnum.messageInsertVideoFailText));
|
|
285
343
|
}
|
|
286
344
|
} catch (error) {
|
|
287
345
|
handleError(error);
|
|
@@ -291,8 +349,12 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
291
349
|
// 插入附件
|
|
292
350
|
uploadAttachment: {
|
|
293
351
|
server: uploadUrl,
|
|
352
|
+
headers: {
|
|
353
|
+
access_token: (0, _getToken.default)(),
|
|
354
|
+
Authorization: 'Bearer ' + (0, _getToken.default)()
|
|
355
|
+
},
|
|
294
356
|
onError: function onError(file, err, res) {
|
|
295
|
-
|
|
357
|
+
console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
|
|
296
358
|
},
|
|
297
359
|
// onSuccess(file, res) {},
|
|
298
360
|
// 上传成功后,用户自定义插入文件
|
|
@@ -300,11 +362,10 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
300
362
|
try {
|
|
301
363
|
if (res.result == 0) {
|
|
302
364
|
res.data.map(function (item) {
|
|
303
|
-
console.log('插入附件:', item, insertFn);
|
|
304
365
|
insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
|
|
305
366
|
});
|
|
306
367
|
} else {
|
|
307
|
-
throw new Error(
|
|
368
|
+
throw new Error("".concat(TextEnum.messageInsertAttachmentFailText));
|
|
308
369
|
}
|
|
309
370
|
} catch (error) {
|
|
310
371
|
handleError(error);
|
|
@@ -321,16 +382,17 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
321
382
|
},
|
|
322
383
|
// 使用安全的粘贴处理函数
|
|
323
384
|
customPaste: handleSafePaste
|
|
324
|
-
};
|
|
385
|
+
});
|
|
325
386
|
// 工具栏配置
|
|
326
|
-
var toolbarConfig = {
|
|
387
|
+
var toolbarConfig = _objectSpread(_objectSpread({}, toolConfig), {}, {
|
|
388
|
+
// 自定义工具栏
|
|
327
389
|
insertKeys: {
|
|
328
390
|
// 自定义插入的位置
|
|
329
391
|
index: 24,
|
|
330
392
|
// “上传附件”菜单
|
|
331
393
|
keys: ['uploadAttachment']
|
|
332
394
|
}
|
|
333
|
-
};
|
|
395
|
+
});
|
|
334
396
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
335
397
|
className: (0, _classnames.default)(prefixCls, (0, _statusUtils.getStatusClassNames)(prefixCls, mergedStatus, hasFeedback), props.prefixCls),
|
|
336
398
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editorForReact.Toolbar, {
|
|
@@ -343,7 +405,10 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
|
|
|
343
405
|
onCreated: setEditor,
|
|
344
406
|
onChange: handleEditorChange,
|
|
345
407
|
mode: "default",
|
|
346
|
-
className: (0, _classnames.default)("".concat(prefixCls, "-content"), hashId)
|
|
408
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-content"), hashId),
|
|
409
|
+
style: {
|
|
410
|
+
height: height
|
|
411
|
+
}
|
|
347
412
|
}, rest))]
|
|
348
413
|
});
|
|
349
414
|
};
|
|
@@ -360,15 +425,4 @@ VtxWangEditor.propTypes = {
|
|
|
360
425
|
status: _propTypes.default.string,
|
|
361
426
|
prefixCls: _propTypes.default.string,
|
|
362
427
|
enableSanitization: _propTypes.default.bool // 是否启用HTML过滤
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// 添加默认属性
|
|
366
|
-
VtxWangEditor.defaultProps = {
|
|
367
|
-
enableSanitization: true,
|
|
368
|
-
maxFileSize: 5 * 1024 * 1024,
|
|
369
|
-
maxNumberOfFiles: 5,
|
|
370
|
-
height: 350,
|
|
371
|
-
placeholder: '',
|
|
372
|
-
downloadUrl: '/cloudFile/common/downloadFile?id=',
|
|
373
|
-
uploadUrl: '/cloudFile/common/uploadFile'
|
|
374
428
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.vtx-wang-editor {
|
|
4
|
-
border: @border-width-base @border-style-base @border-color-base;
|
|
5
|
-
&.w-e-full-screen-container {
|
|
6
|
-
z-index: 999999;
|
|
7
|
-
}
|
|
8
|
-
&-content {
|
|
9
|
-
height: 350px;
|
|
10
|
-
border-top: @border-width-base @border-style-base @border-color-base;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.vtx-wang-editor {
|
|
4
|
+
border: @border-width-base @border-style-base @border-color-base;
|
|
5
|
+
&.w-e-full-screen-container {
|
|
6
|
+
z-index: 999999;
|
|
7
|
+
}
|
|
8
|
+
&-content {
|
|
9
|
+
height: 350px;
|
|
10
|
+
border-top: @border-width-base @border-style-base @border-color-base;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -220,6 +220,10 @@ function _replaceImagesFileSourceWithInlineRepresentation() {
|
|
|
220
220
|
_context.next = 21;
|
|
221
221
|
return window.fetch(uploadUrl, {
|
|
222
222
|
method: 'POST',
|
|
223
|
+
headers: {
|
|
224
|
+
access_token: getToken(),
|
|
225
|
+
Authorization: 'Bearer ' + getToken()
|
|
226
|
+
},
|
|
223
227
|
body: formData
|
|
224
228
|
}).then(function (response) {
|
|
225
229
|
return response.json();
|