@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LcdpUeditor.js +64 -61
- package/es/const.js +4 -4
- package/es/defaultConfig.json +76 -76
- package/es/tools/UeditorResourceLoader.js +11 -16
- package/es/tools/filterHtmlNode.d.ts +5 -0
- package/es/tools/filterHtmlNode.js +41 -0
- package/es/tools/loadScript.js +5 -7
- package/es/type.d.ts +6 -0
- package/lib/LcdpUeditor.js +18 -8
- package/lib/defaultConfig.json +76 -76
- package/lib/tools/filterHtmlNode.d.ts +5 -0
- package/lib/tools/filterHtmlNode.js +61 -0
- package/lib/type.d.ts +6 -0
- package/package.json +35 -34
- package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
- package/ueditor-resource/dialogs/attachment/attachment.css +716 -716
- package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
- package/ueditor-resource/dialogs/attachment/attachment.js +803 -803
- package/ueditor-resource/dialogs/audio/audio.css +879 -879
- package/ueditor-resource/dialogs/audio/audio.html +93 -93
- package/ueditor-resource/dialogs/audio/audio.js +815 -815
- package/ueditor-resource/dialogs/background/background.css +193 -193
- package/ueditor-resource/dialogs/background/background.html +59 -59
- package/ueditor-resource/dialogs/background/background.js +370 -370
- package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
- package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -91
- package/ueditor-resource/dialogs/emotion/emotion.css +129 -129
- package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
- package/ueditor-resource/dialogs/emotion/emotion.js +186 -186
- package/ueditor-resource/dialogs/formula/formula.html +98 -98
- package/ueditor-resource/dialogs/formula/formula.js +147 -147
- package/ueditor-resource/dialogs/help/help.css +37 -37
- package/ueditor-resource/dialogs/help/help.html +82 -82
- package/ueditor-resource/dialogs/help/help.js +57 -57
- package/ueditor-resource/dialogs/image/image.css +768 -768
- package/ueditor-resource/dialogs/image/image.html +144 -144
- package/ueditor-resource/dialogs/image/image.js +1060 -1060
- package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
- package/ueditor-resource/dialogs/internal.js +81 -81
- package/ueditor-resource/dialogs/link/link.html +148 -148
- package/ueditor-resource/dialogs/preview/preview.html +45 -45
- package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -324
- package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
- package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -682
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
- package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -174
- package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
- package/ueditor-resource/dialogs/spechars/spechars.js +86 -86
- package/ueditor-resource/dialogs/table/edittable.css +85 -85
- package/ueditor-resource/dialogs/table/edittable.html +69 -69
- package/ueditor-resource/dialogs/table/edittable.js +241 -241
- package/ueditor-resource/dialogs/table/edittd.html +62 -62
- package/ueditor-resource/dialogs/table/edittip.html +33 -33
- package/ueditor-resource/dialogs/template/config.js +42 -42
- package/ueditor-resource/dialogs/template/template.css +99 -99
- package/ueditor-resource/dialogs/template/template.html +26 -26
- package/ueditor-resource/dialogs/template/template.js +53 -53
- package/ueditor-resource/dialogs/video/video.css +909 -909
- package/ueditor-resource/dialogs/video/video.html +114 -114
- package/ueditor-resource/dialogs/video/video.js +867 -867
- package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
- package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -93
- package/ueditor-resource/lang/en/en.js +686 -686
- package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -748
- package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -748
- package/ueditor-resource/plugins/demo/demo.js +3 -3
- package/ueditor-resource/themes/default/css/ueditor.css +2148 -2148
- package/ueditor-resource/themes/default/dialog.css +17 -17
- package/ueditor-resource/themes/default/dialogbase.css +132 -132
- package/ueditor-resource/themes/default/exts/ai.svg +12 -12
- package/ueditor-resource/themes/default/exts/apk.svg +12 -12
- package/ueditor-resource/themes/default/exts/chm.svg +12 -12
- package/ueditor-resource/themes/default/exts/css.svg +12 -12
- package/ueditor-resource/themes/default/exts/doc.svg +22 -22
- package/ueditor-resource/themes/default/exts/docx.svg +22 -22
- package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
- package/ueditor-resource/themes/default/exts/folder.svg +3 -3
- package/ueditor-resource/themes/default/exts/gif.svg +14 -14
- package/ueditor-resource/themes/default/exts/html.svg +12 -12
- package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
- package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
- package/ueditor-resource/themes/default/exts/log.svg +12 -12
- package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
- package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
- package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
- package/ueditor-resource/themes/default/exts/png.svg +14 -14
- package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
- package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
- package/ueditor-resource/themes/default/exts/psd.svg +12 -12
- package/ueditor-resource/themes/default/exts/rar.svg +12 -12
- package/ueditor-resource/themes/default/exts/svg.svg +12 -12
- package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
- package/ueditor-resource/themes/default/exts/txt.svg +14 -14
- package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
- package/ueditor-resource/themes/default/exts/xls.svg +25 -25
- package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
- package/ueditor-resource/themes/default/exts/zip.svg +12 -12
- package/ueditor-resource/themes/iframe.css +63 -63
- package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -3655
- package/ueditor-resource/third-party/clipboard/clipboard.js +752 -752
- package/ueditor-resource/third-party/codemirror/codemirror.css +106 -106
- package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -3581
- package/ueditor-resource/third-party/jquery-3.5.1.js +1 -1
- package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -4314
- package/ueditor-resource/third-party/webuploader/webuploader.css +88 -88
- package/ueditor-resource/third-party/webuploader/webuploader.js +3 -3
- package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
- package/ueditor-resource/ueditor.all.js +5271 -5270
- package/ueditor-resource/ueditor.config.js +655 -656
- package/ueditor-resource/ueditor.parse.js +13 -13
- package/es/LcdpUeditor.d.ts.map +0 -1
- package/es/const.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/tools/UeditorResourceLoader.d.ts.map +0 -1
- package/es/tools/loadScript.d.ts.map +0 -1
- package/es/type.d.ts.map +0 -1
- package/ueditor-resource/index.html +0 -146
    
        package/es/LcdpUeditor.js
    CHANGED
    
    | @@ -1,27 +1,18 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
            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); }
         | 
| 11 | 
            -
            function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
         | 
| 12 | 
            -
            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); }; }
         | 
| 13 | 
            -
            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); }
         | 
| 14 | 
            -
            function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
         | 
| 15 | 
            -
            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; } }
         | 
| 16 | 
            -
            function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
         | 
| 17 | 
            -
            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; }
         | 
| 18 | 
            -
            function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
         | 
| 19 | 
            -
            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); }
         | 
| 1 | 
            +
            import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
         | 
| 2 | 
            +
            import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
         | 
| 3 | 
            +
            import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
         | 
| 4 | 
            +
            import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
         | 
| 5 | 
            +
            import _createClass from "@babel/runtime/helpers/esm/createClass";
         | 
| 6 | 
            +
            import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
         | 
| 7 | 
            +
            import _inherits from "@babel/runtime/helpers/esm/inherits";
         | 
| 8 | 
            +
            import _createSuper from "@babel/runtime/helpers/esm/createSuper";
         | 
| 9 | 
            +
            import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
         | 
| 20 10 | 
             
            import React from 'react';
         | 
| 21 11 | 
             
            import { DEFAULT_UEDITOR_CONFIG, DEFAULT_UEDITOR_PATH } from "./const";
         | 
| 22 12 | 
             
            import DefaultConfig from "./defaultConfig.json";
         | 
| 23 13 | 
             
            import UeditorResourceLoader from "./tools/UeditorResourceLoader";
         | 
| 24 | 
            -
            import  | 
| 14 | 
            +
            import debounce from 'lodash/debounce';
         | 
| 15 | 
            +
            import { filterHtmlNode } from "./tools/filterHtmlNode";
         | 
| 25 16 | 
             
            var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
         | 
| 26 17 | 
             
              _inherits(LcdpUeditor, _React$Component);
         | 
| 27 18 | 
             
              var _super = _createSuper(LcdpUeditor);
         | 
| @@ -29,54 +20,54 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 29 20 | 
             
                var _this;
         | 
| 30 21 | 
             
                _classCallCheck(this, LcdpUeditor);
         | 
| 31 22 | 
             
                _this = _super.call(this, props);
         | 
| 32 | 
            -
                /**
         | 
| 33 | 
            -
                 * 静态资源地址
         | 
| 23 | 
            +
                /**
         | 
| 24 | 
            +
                 * 静态资源地址
         | 
| 34 25 | 
             
                 */
         | 
| 35 26 | 
             
                _defineProperty(_assertThisInitialized(_this), "ueditorPath", DEFAULT_UEDITOR_PATH);
         | 
| 36 | 
            -
                /**
         | 
| 37 | 
            -
                 * 文件上传inputRef
         | 
| 27 | 
            +
                /**
         | 
| 28 | 
            +
                 * 文件上传inputRef
         | 
| 38 29 | 
             
                 */
         | 
| 39 30 | 
             
                _defineProperty(_assertThisInitialized(_this), "inputRef", /*#__PURE__*/React.createRef());
         | 
| 40 | 
            -
                /**
         | 
| 41 | 
            -
                 * 编辑器容器ref
         | 
| 31 | 
            +
                /**
         | 
| 32 | 
            +
                 * 编辑器容器ref
         | 
| 42 33 | 
             
                 */
         | 
| 43 34 | 
             
                _defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/React.createRef());
         | 
| 44 | 
            -
                /**
         | 
| 45 | 
            -
                 * 编辑器容器id
         | 
| 35 | 
            +
                /**
         | 
| 36 | 
            +
                 * 编辑器容器id
         | 
| 46 37 | 
             
                 */
         | 
| 47 38 | 
             
                _defineProperty(_assertThisInitialized(_this), "containerId", void 0);
         | 
| 48 | 
            -
                /**
         | 
| 49 | 
            -
                 * 编辑器实例
         | 
| 39 | 
            +
                /**
         | 
| 40 | 
            +
                 * 编辑器实例
         | 
| 50 41 | 
             
                 */
         | 
| 51 42 | 
             
                _defineProperty(_assertThisInitialized(_this), "ueditorInst", null);
         | 
| 52 | 
            -
                /**
         | 
| 53 | 
            -
                 * 是否上报
         | 
| 43 | 
            +
                /**
         | 
| 44 | 
            +
                 * 是否上报
         | 
| 54 45 | 
             
                 */
         | 
| 55 46 | 
             
                _defineProperty(_assertThisInitialized(_this), "isReportFlag", true);
         | 
| 56 | 
            -
                /**
         | 
| 57 | 
            -
                 * 值变化节流函数
         | 
| 47 | 
            +
                /**
         | 
| 48 | 
            +
                 * 值变化节流函数
         | 
| 58 49 | 
             
                 */
         | 
| 59 50 | 
             
                _defineProperty(_assertThisInitialized(_this), "debounceContentChange", void 0);
         | 
| 60 | 
            -
                /**
         | 
| 61 | 
            -
                 * 当前值
         | 
| 51 | 
            +
                /**
         | 
| 52 | 
            +
                 * 当前值
         | 
| 62 53 | 
             
                 */
         | 
| 63 54 | 
             
                _defineProperty(_assertThisInitialized(_this), "currentContent", '');
         | 
| 64 | 
            -
                /**
         | 
| 65 | 
            -
                 * 上传文件函数
         | 
| 55 | 
            +
                /**
         | 
| 56 | 
            +
                 * 上传文件函数
         | 
| 66 57 | 
             
                 */
         | 
| 67 58 | 
             
                _defineProperty(_assertThisInitialized(_this), "uploadFunction", void 0);
         | 
| 68 | 
            -
                /**
         | 
| 69 | 
            -
                 * 是否加载完成
         | 
| 59 | 
            +
                /**
         | 
| 60 | 
            +
                 * 是否加载完成
         | 
| 70 61 | 
             
                 */
         | 
| 71 62 | 
             
                _defineProperty(_assertThisInitialized(_this), "isReady", false);
         | 
| 72 | 
            -
                /**
         | 
| 73 | 
            -
                 * 初始加载失败
         | 
| 63 | 
            +
                /**
         | 
| 64 | 
            +
                 * 初始加载失败
         | 
| 74 65 | 
             
                 */
         | 
| 75 66 | 
             
                _defineProperty(_assertThisInitialized(_this), "state", {
         | 
| 76 67 | 
             
                  initError: false
         | 
| 77 68 | 
             
                });
         | 
| 78 | 
            -
                /**
         | 
| 79 | 
            -
                 * 编辑器配置项
         | 
| 69 | 
            +
                /**
         | 
| 70 | 
            +
                 * 编辑器配置项
         | 
| 80 71 | 
             
                 */
         | 
| 81 72 | 
             
                _defineProperty(_assertThisInitialized(_this), "editorConfig", {});
         | 
| 82 73 | 
             
                var config = props.config;
         | 
| @@ -84,7 +75,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 84 75 | 
             
                if (_this.props.ueditorPath) {
         | 
| 85 76 | 
             
                  _this.ueditorPath = _this.props.ueditorPath;
         | 
| 86 77 | 
             
                }
         | 
| 87 | 
            -
                 | 
| 78 | 
            +
                var nextValue = filterHtmlNode(_this.props.value || '').str;
         | 
| 79 | 
            +
                _this.currentContent = nextValue;
         | 
| 88 80 | 
             
                _this.uploadFunction = function (file, type) {
         | 
| 89 81 | 
             
                  var _this$props$config;
         | 
| 90 82 | 
             
                  // TODO 内置上传 图片base64
         | 
| @@ -109,13 +101,15 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 109 101 | 
             
                  return null;
         | 
| 110 102 | 
             
                };
         | 
| 111 103 | 
             
                _this.editorConfig = _objectSpread(_objectSpread({}, DefaultConfig), {}, {
         | 
| 104 | 
            +
                  maximumWords: (config === null || config === void 0 ? void 0 : config.maximumWords) || 10000,
         | 
| 112 105 | 
             
                  initialFrameHeight: (config === null || config === void 0 ? void 0 : config.height) || 300,
         | 
| 113 106 | 
             
                  autoHeightEnabled: false,
         | 
| 114 107 | 
             
                  selectCallback: function selectCallback(cb, type) {
         | 
| 115 108 | 
             
                    _this.fileSelect(cb, type);
         | 
| 116 109 | 
             
                  },
         | 
| 117 110 | 
             
                  uploadFunction: _this.uploadFunction,
         | 
| 118 | 
            -
                  initialContent:  | 
| 111 | 
            +
                  initialContent: nextValue || '',
         | 
| 112 | 
            +
                  pasteplain: (config === null || config === void 0 ? void 0 : config.pasteplain) === true
         | 
| 119 113 | 
             
                });
         | 
| 120 114 | 
             
                _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
         | 
| 121 115 | 
             
                return _this;
         | 
| @@ -131,7 +125,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 131 125 | 
             
                  if (this.isReady) {
         | 
| 132 126 | 
             
                    if ('value' in nextProps && this.currentContent !== nextProps.value) {
         | 
| 133 127 | 
             
                      this.isReportFlag = false;
         | 
| 134 | 
            -
                      this.ueditorInst.setContent(nextProps.value);
         | 
| 128 | 
            +
                      this.ueditorInst.setContent(filterHtmlNode(nextProps.value || '').str);
         | 
| 135 129 | 
             
                    }
         | 
| 136 130 | 
             
                    // 禁用操作需要调用指定的api进行操作
         | 
| 137 131 | 
             
                    if (nextProps.disabled !== this.props.disabled) {
         | 
| @@ -146,8 +140,10 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 146 140 | 
             
              }, {
         | 
| 147 141 | 
             
                key: "componentWillUnmount",
         | 
| 148 142 | 
             
                value: function componentWillUnmount() {
         | 
| 149 | 
            -
                   | 
| 150 | 
            -
             | 
| 143 | 
            +
                  if (this.isReady) {
         | 
| 144 | 
            +
                    var _this$ueditorInst, _this$ueditorInst$des;
         | 
| 145 | 
            +
                    (_this$ueditorInst = this.ueditorInst) === null || _this$ueditorInst === void 0 || (_this$ueditorInst$des = _this$ueditorInst.destroy) === null || _this$ueditorInst$des === void 0 || _this$ueditorInst$des.call(_this$ueditorInst);
         | 
| 146 | 
            +
                  }
         | 
| 151 147 | 
             
                }
         | 
| 152 148 | 
             
              }, {
         | 
| 153 149 | 
             
                key: "onContentChange",
         | 
| @@ -155,8 +151,12 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 155 151 | 
             
                  if (!this.isReportFlag) {
         | 
| 156 152 | 
             
                    this.isReportFlag = true;
         | 
| 157 153 | 
             
                  } else if (this.props.onChange) {
         | 
| 158 | 
            -
                    this.currentContent = this.ueditorInst.getContent();
         | 
| 159 | 
            -
                     | 
| 154 | 
            +
                    this.currentContent = this.ueditorInst.getContent() || '';
         | 
| 155 | 
            +
                    var _filterHtmlNode = filterHtmlNode(this.currentContent),
         | 
| 156 | 
            +
                      str = _filterHtmlNode.str,
         | 
| 157 | 
            +
                      flag = _filterHtmlNode.flag,
         | 
| 158 | 
            +
                      source = _filterHtmlNode.source;
         | 
| 159 | 
            +
                    this.props.onChange(flag ? str : source);
         | 
| 160 160 | 
             
                  }
         | 
| 161 161 | 
             
                }
         | 
| 162 162 | 
             
              }, {
         | 
| @@ -168,10 +168,10 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 168 168 | 
             
                  return str || '';
         | 
| 169 169 | 
             
                }
         | 
| 170 170 |  | 
| 171 | 
            -
                /**
         | 
| 172 | 
            -
                 * 文件选择
         | 
| 173 | 
            -
                 * @param cb 回调给编辑器
         | 
| 174 | 
            -
                 * @param type 类型
         | 
| 171 | 
            +
                /**
         | 
| 172 | 
            +
                 * 文件选择
         | 
| 173 | 
            +
                 * @param cb 回调给编辑器
         | 
| 174 | 
            +
                 * @param type 类型
         | 
| 175 175 | 
             
                 */
         | 
| 176 176 | 
             
              }, {
         | 
| 177 177 | 
             
                key: "fileSelect",
         | 
| @@ -249,8 +249,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 249 249 | 
             
                  }
         | 
| 250 250 | 
             
                  return fileSelect;
         | 
| 251 251 | 
             
                }()
         | 
| 252 | 
            -
                /**
         | 
| 253 | 
            -
                 * 对外暴露编辑器实例
         | 
| 252 | 
            +
                /**
         | 
| 253 | 
            +
                 * 对外暴露编辑器实例
         | 
| 254 254 | 
             
                 */
         | 
| 255 255 | 
             
                )
         | 
| 256 256 | 
             
              }, {
         | 
| @@ -261,8 +261,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 261 261 | 
             
                  }
         | 
| 262 262 | 
             
                }
         | 
| 263 263 |  | 
| 264 | 
            -
                /**
         | 
| 265 | 
            -
                 * 初始化样式
         | 
| 264 | 
            +
                /**
         | 
| 265 | 
            +
                 * 初始化样式
         | 
| 266 266 | 
             
                 */
         | 
| 267 267 | 
             
              }, {
         | 
| 268 268 | 
             
                key: "initStyle",
         | 
| @@ -284,8 +284,8 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 284 284 | 
             
                  }
         | 
| 285 285 | 
             
                }
         | 
| 286 286 |  | 
| 287 | 
            -
                /**
         | 
| 288 | 
            -
                 * 初始化编辑器实例
         | 
| 287 | 
            +
                /**
         | 
| 288 | 
            +
                 * 初始化编辑器实例
         | 
| 289 289 | 
             
                 */
         | 
| 290 290 | 
             
              }, {
         | 
| 291 291 | 
             
                key: "initUeditor",
         | 
| @@ -297,6 +297,9 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) { | |
| 297 297 | 
             
                      while (1) switch (_context3.prev = _context3.next) {
         | 
| 298 298 | 
             
                        case 0:
         | 
| 299 299 | 
             
                          UeditorResourceLoader.onReady(function () {
         | 
| 300 | 
            +
                            if (_this3.props.toolbars) {
         | 
| 301 | 
            +
                              _this3.editorConfig.toolbars = _this3.props.toolbars;
         | 
| 302 | 
            +
                            }
         | 
| 300 303 | 
             
                            _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
         | 
| 301 304 | 
             
                            _this3.ueditorInst.ready(function () {
         | 
| 302 305 | 
             
                              _this3.isReady = true;
         | 
    
        package/es/const.js
    CHANGED
    
    
    
        package/es/defaultConfig.json
    CHANGED
    
    | @@ -1,77 +1,77 @@ | |
| 1 | 
            -
            {
         | 
| 2 | 
            -
                "imageActionName": "image",
         | 
| 3 | 
            -
                "imageFieldName": "file",
         | 
| 4 | 
            -
                "imageMaxSize": 10485760,
         | 
| 5 | 
            -
                "imageAllowFiles": [
         | 
| 6 | 
            -
                    ".jpg",
         | 
| 7 | 
            -
                    ".png",
         | 
| 8 | 
            -
                    ".jpeg"
         | 
| 9 | 
            -
                ],
         | 
| 10 | 
            -
                "imageCompressEnable": true,
         | 
| 11 | 
            -
                "imageCompressBorder": 5000,
         | 
| 12 | 
            -
                "imageInsertAlign": "none",
         | 
| 13 | 
            -
                "imageUrlPrefix": "",
         | 
| 14 | 
            -
                "scrawlActionName": "crawl",
         | 
| 15 | 
            -
                "scrawlFieldName": "file",
         | 
| 16 | 
            -
                "scrawlMaxSize": 10485760,
         | 
| 17 | 
            -
                "scrawlUrlPrefix": "",
         | 
| 18 | 
            -
                "scrawlInsertAlign": "none",
         | 
| 19 | 
            -
                "snapscreenActionName": "snap",
         | 
| 20 | 
            -
                "snapscreenUrlPrefix": "",
         | 
| 21 | 
            -
                "snapscreenInsertAlign": "none",
         | 
| 22 | 
            -
                "catcherLocalDomain": [
         | 
| 23 | 
            -
                    "127.0.0.1",
         | 
| 24 | 
            -
                    "localhost"
         | 
| 25 | 
            -
                ],
         | 
| 26 | 
            -
                "catcherActionName": "catch",
         | 
| 27 | 
            -
                "catcherFieldName": "source",
         | 
| 28 | 
            -
                "catcherUrlPrefix": "",
         | 
| 29 | 
            -
                "catcherMaxSize": 10485760,
         | 
| 30 | 
            -
                "catcherAllowFiles": [
         | 
| 31 | 
            -
                    ".jpg",
         | 
| 32 | 
            -
                    ".png",
         | 
| 33 | 
            -
                    ".jpeg"
         | 
| 34 | 
            -
                ],
         | 
| 35 | 
            -
                "videoActionName": "video",
         | 
| 36 | 
            -
                "videoFieldName": "file",
         | 
| 37 | 
            -
                "videoUrlPrefix": "",
         | 
| 38 | 
            -
                "videoMaxSize": 104857600,
         | 
| 39 | 
            -
                "videoAllowFiles": [
         | 
| 40 | 
            -
                    ".mp4",
         | 
| 41 | 
            -
                    ".webm",
         | 
| 42 | 
            -
                    ".mkv"
         | 
| 43 | 
            -
                ],
         | 
| 44 | 
            -
                "audioActionName": "audio",
         | 
| 45 | 
            -
                "audioFieldName": "file",
         | 
| 46 | 
            -
                "audioUrlPrefix": "",
         | 
| 47 | 
            -
                "audioMaxSize": 104857600,
         | 
| 48 | 
            -
                "audioAllowFiles": [
         | 
| 49 | 
            -
                    ".mp3"
         | 
| 50 | 
            -
                ],
         | 
| 51 | 
            -
                "fileActionName": "file",
         | 
| 52 | 
            -
                "fileFieldName": "file",
         | 
| 53 | 
            -
                "fileUrlPrefix": "",
         | 
| 54 | 
            -
                "fileMaxSize": 104857600,
         | 
| 55 | 
            -
                "fileAllowFiles": [
         | 
| 56 | 
            -
                    ".zip",
         | 
| 57 | 
            -
                    ".pdf",
         | 
| 58 | 
            -
                    ".doc"
         | 
| 59 | 
            -
                ],
         | 
| 60 | 
            -
                "imageManagerActionName": "listImage",
         | 
| 61 | 
            -
                "imageManagerListSize": 20,
         | 
| 62 | 
            -
                "imageManagerUrlPrefix": "",
         | 
| 63 | 
            -
                "imageManagerInsertAlign": "none",
         | 
| 64 | 
            -
                "imageManagerAllowFiles": [
         | 
| 65 | 
            -
                    ".jpg",
         | 
| 66 | 
            -
                    ".png",
         | 
| 67 | 
            -
                    ".jpeg"
         | 
| 68 | 
            -
                ],
         | 
| 69 | 
            -
                "fileManagerActionName": "listFile",
         | 
| 70 | 
            -
                "fileManagerUrlPrefix": "",
         | 
| 71 | 
            -
                "fileManagerListSize": 20,
         | 
| 72 | 
            -
                "fileManagerAllowFiles": [
         | 
| 73 | 
            -
                    ".zip",
         | 
| 74 | 
            -
                    ".pdf",
         | 
| 75 | 
            -
                    ".doc"
         | 
| 76 | 
            -
                ]
         | 
| 1 | 
            +
            {
         | 
| 2 | 
            +
                "imageActionName": "image",
         | 
| 3 | 
            +
                "imageFieldName": "file",
         | 
| 4 | 
            +
                "imageMaxSize": 10485760,
         | 
| 5 | 
            +
                "imageAllowFiles": [
         | 
| 6 | 
            +
                    ".jpg",
         | 
| 7 | 
            +
                    ".png",
         | 
| 8 | 
            +
                    ".jpeg"
         | 
| 9 | 
            +
                ],
         | 
| 10 | 
            +
                "imageCompressEnable": true,
         | 
| 11 | 
            +
                "imageCompressBorder": 5000,
         | 
| 12 | 
            +
                "imageInsertAlign": "none",
         | 
| 13 | 
            +
                "imageUrlPrefix": "",
         | 
| 14 | 
            +
                "scrawlActionName": "crawl",
         | 
| 15 | 
            +
                "scrawlFieldName": "file",
         | 
| 16 | 
            +
                "scrawlMaxSize": 10485760,
         | 
| 17 | 
            +
                "scrawlUrlPrefix": "",
         | 
| 18 | 
            +
                "scrawlInsertAlign": "none",
         | 
| 19 | 
            +
                "snapscreenActionName": "snap",
         | 
| 20 | 
            +
                "snapscreenUrlPrefix": "",
         | 
| 21 | 
            +
                "snapscreenInsertAlign": "none",
         | 
| 22 | 
            +
                "catcherLocalDomain": [
         | 
| 23 | 
            +
                    "127.0.0.1",
         | 
| 24 | 
            +
                    "localhost"
         | 
| 25 | 
            +
                ],
         | 
| 26 | 
            +
                "catcherActionName": "catch",
         | 
| 27 | 
            +
                "catcherFieldName": "source",
         | 
| 28 | 
            +
                "catcherUrlPrefix": "",
         | 
| 29 | 
            +
                "catcherMaxSize": 10485760,
         | 
| 30 | 
            +
                "catcherAllowFiles": [
         | 
| 31 | 
            +
                    ".jpg",
         | 
| 32 | 
            +
                    ".png",
         | 
| 33 | 
            +
                    ".jpeg"
         | 
| 34 | 
            +
                ],
         | 
| 35 | 
            +
                "videoActionName": "video",
         | 
| 36 | 
            +
                "videoFieldName": "file",
         | 
| 37 | 
            +
                "videoUrlPrefix": "",
         | 
| 38 | 
            +
                "videoMaxSize": 104857600,
         | 
| 39 | 
            +
                "videoAllowFiles": [
         | 
| 40 | 
            +
                    ".mp4",
         | 
| 41 | 
            +
                    ".webm",
         | 
| 42 | 
            +
                    ".mkv"
         | 
| 43 | 
            +
                ],
         | 
| 44 | 
            +
                "audioActionName": "audio",
         | 
| 45 | 
            +
                "audioFieldName": "file",
         | 
| 46 | 
            +
                "audioUrlPrefix": "",
         | 
| 47 | 
            +
                "audioMaxSize": 104857600,
         | 
| 48 | 
            +
                "audioAllowFiles": [
         | 
| 49 | 
            +
                    ".mp3"
         | 
| 50 | 
            +
                ],
         | 
| 51 | 
            +
                "fileActionName": "file",
         | 
| 52 | 
            +
                "fileFieldName": "file",
         | 
| 53 | 
            +
                "fileUrlPrefix": "",
         | 
| 54 | 
            +
                "fileMaxSize": 104857600,
         | 
| 55 | 
            +
                "fileAllowFiles": [
         | 
| 56 | 
            +
                    ".zip",
         | 
| 57 | 
            +
                    ".pdf",
         | 
| 58 | 
            +
                    ".doc"
         | 
| 59 | 
            +
                ],
         | 
| 60 | 
            +
                "imageManagerActionName": "listImage",
         | 
| 61 | 
            +
                "imageManagerListSize": 20,
         | 
| 62 | 
            +
                "imageManagerUrlPrefix": "",
         | 
| 63 | 
            +
                "imageManagerInsertAlign": "none",
         | 
| 64 | 
            +
                "imageManagerAllowFiles": [
         | 
| 65 | 
            +
                    ".jpg",
         | 
| 66 | 
            +
                    ".png",
         | 
| 67 | 
            +
                    ".jpeg"
         | 
| 68 | 
            +
                ],
         | 
| 69 | 
            +
                "fileManagerActionName": "listFile",
         | 
| 70 | 
            +
                "fileManagerUrlPrefix": "",
         | 
| 71 | 
            +
                "fileManagerListSize": 20,
         | 
| 72 | 
            +
                "fileManagerAllowFiles": [
         | 
| 73 | 
            +
                    ".zip",
         | 
| 74 | 
            +
                    ".pdf",
         | 
| 75 | 
            +
                    ".doc"
         | 
| 76 | 
            +
                ]
         | 
| 77 77 | 
             
            }
         | 
| @@ -1,13 +1,8 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
            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); } }
         | 
| 7 | 
            -
            function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
         | 
| 8 | 
            -
            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; }
         | 
| 9 | 
            -
            function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
         | 
| 10 | 
            -
            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); }
         | 
| 1 | 
            +
            import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
         | 
| 2 | 
            +
            import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
         | 
| 3 | 
            +
            import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
         | 
| 4 | 
            +
            import _createClass from "@babel/runtime/helpers/esm/createClass";
         | 
| 5 | 
            +
            import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
         | 
| 11 6 | 
             
            import { loadScriptSync } from "./loadScript";
         | 
| 12 7 | 
             
            var UeditorResourceLoader = /*#__PURE__*/function () {
         | 
| 13 8 | 
             
              function UeditorResourceLoader() {
         | 
| @@ -82,9 +77,9 @@ var UeditorResourceLoader = /*#__PURE__*/function () { | |
| 82 77 | 
             
                  return this.instance;
         | 
| 83 78 | 
             
                }
         | 
| 84 79 |  | 
| 85 | 
            -
                /**
         | 
| 86 | 
            -
                 * 加载完成执行
         | 
| 87 | 
            -
                 * @param callback 回调函数
         | 
| 80 | 
            +
                /**
         | 
| 81 | 
            +
                 * 加载完成执行
         | 
| 82 | 
            +
                 * @param callback 回调函数
         | 
| 88 83 | 
             
                 */
         | 
| 89 84 | 
             
              }, {
         | 
| 90 85 | 
             
                key: "onReady",
         | 
| @@ -97,9 +92,9 @@ var UeditorResourceLoader = /*#__PURE__*/function () { | |
| 97 92 | 
             
                  }
         | 
| 98 93 | 
             
                }
         | 
| 99 94 |  | 
| 100 | 
            -
                /**
         | 
| 101 | 
            -
                 * 资源加载失败执行
         | 
| 102 | 
            -
                 * @param callback
         | 
| 95 | 
            +
                /**
         | 
| 96 | 
            +
                 * 资源加载失败执行
         | 
| 97 | 
            +
                 * @param callback
         | 
| 103 98 | 
             
                 */
         | 
| 104 99 | 
             
              }, {
         | 
| 105 100 | 
             
                key: "onLoadError",
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            export var filterHtmlNode = function filterHtmlNode(str) {
         | 
| 2 | 
            +
              var flag = false;
         | 
| 3 | 
            +
              if (typeof str !== 'string') return str || '';
         | 
| 4 | 
            +
              var blacklist = ['script', 'style', 'iframe'];
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              // 创建一个新的 DOM 解析器对象
         | 
| 7 | 
            +
              var parser = new DOMParser();
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              // 使用 parseFromString 方法将 HTML 片段转换为 DOM 对象
         | 
| 10 | 
            +
              var doc = parser.parseFromString(str, 'text/html');
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              // 遍历 DOM 树并删除恶意节点
         | 
| 13 | 
            +
              function cleanNode(node) {
         | 
| 14 | 
            +
                if (node.nodeType === 1) {
         | 
| 15 | 
            +
                  // 元素节点
         | 
| 16 | 
            +
                  if (blacklist.indexOf(node.nodeName.toLowerCase()) !== -1) {
         | 
| 17 | 
            +
                    var _node$parentNode;
         | 
| 18 | 
            +
                    (_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 || _node$parentNode.removeChild(node);
         | 
| 19 | 
            +
                    return;
         | 
| 20 | 
            +
                  }
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  // 移除元素节点上所有事件属性
         | 
| 23 | 
            +
                  for (var i = node.attributes.length - 1; i >= 0; i -= 1) {
         | 
| 24 | 
            +
                    var attr = node.attributes[i];
         | 
| 25 | 
            +
                    if (attr.name.startsWith('on') || String(node.getAttribute(attr.name)).toLowerCase().indexOf('javascript:') !== -1) {
         | 
| 26 | 
            +
                      node.removeAttribute(attr.name);
         | 
| 27 | 
            +
                      flag = true;
         | 
| 28 | 
            +
                    }
         | 
| 29 | 
            +
                  }
         | 
| 30 | 
            +
                }
         | 
| 31 | 
            +
                for (var _i = 0; _i < node.childNodes.length; _i += 1) {
         | 
| 32 | 
            +
                  cleanNode(node.childNodes[_i]);
         | 
| 33 | 
            +
                }
         | 
| 34 | 
            +
              }
         | 
| 35 | 
            +
              cleanNode(doc.body);
         | 
| 36 | 
            +
              return {
         | 
| 37 | 
            +
                str: doc.body.innerHTML,
         | 
| 38 | 
            +
                flag: flag,
         | 
| 39 | 
            +
                source: str
         | 
| 40 | 
            +
              };
         | 
| 41 | 
            +
            };
         | 
    
        package/es/tools/loadScript.js
    CHANGED
    
    | @@ -1,10 +1,8 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             * 同步加载js
         | 
| 7 | 
            -
             * @param strs 路径地址
         | 
| 1 | 
            +
            import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
         | 
| 2 | 
            +
            import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
         | 
| 3 | 
            +
            /**
         | 
| 4 | 
            +
             * 同步加载js
         | 
| 5 | 
            +
             * @param strs 路径地址
         | 
| 8 6 | 
             
             */
         | 
| 9 7 | 
             
            export var loadScriptSync = /*#__PURE__*/function () {
         | 
| 10 8 | 
             
              var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(strs) {
         | 
    
        package/es/type.d.ts
    CHANGED
    
    | @@ -23,6 +23,10 @@ export interface ILcdpUeditorProps { | |
| 23 23 | 
             
                 * 富文本配置
         | 
| 24 24 | 
             
                 */
         | 
| 25 25 | 
             
                config?: {
         | 
| 26 | 
            +
                    /**
         | 
| 27 | 
            +
                     * 是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴 默认false
         | 
| 28 | 
            +
                     */
         | 
| 29 | 
            +
                    pasteplain?: boolean;
         | 
| 26 30 | 
             
                    /**
         | 
| 27 31 | 
             
                     * 编辑器高度 默认300px
         | 
| 28 32 | 
             
                     */
         | 
| @@ -63,7 +67,9 @@ export interface ILcdpUeditorProps { | |
| 63 67 | 
             
                     * 上传视频格式限制
         | 
| 64 68 | 
             
                     */
         | 
| 65 69 | 
             
                    videoAllowFiles?: string[];
         | 
| 70 | 
            +
                    maximumWords?: number;
         | 
| 66 71 | 
             
                };
         | 
| 72 | 
            +
                toolbars?: string[][];
         | 
| 67 73 | 
             
                /**
         | 
| 68 74 | 
             
                 * 语言 默认 zh-cn
         | 
| 69 75 | 
             
                 * zh-cn 中文 en 英文
         |