@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.2 → 1.0.0-alpha.3
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/lib/LcdpUeditor.d.ts +76 -0
- package/lib/LcdpUeditor.js +247 -0
- package/lib/const.d.ts +12 -0
- package/lib/const.js +39 -0
- package/lib/defaultConfig.json +77 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +41 -0
- package/lib/tools/UeditorResourceLoader.d.ts +21 -0
- package/lib/tools/UeditorResourceLoader.js +90 -0
- package/lib/tools/loadScript.d.ts +5 -0
- package/lib/tools/loadScript.js +39 -0
- package/lib/type.d.ts +142 -0
- package/lib/type.js +17 -0
- package/package.json +4 -3
- 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
| @@ -0,0 +1,76 @@ | |
| 1 | 
            +
            import React from 'react';
         | 
| 2 | 
            +
            import type { ILcdpUeditorProps } from './type';
         | 
| 3 | 
            +
            declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
         | 
| 4 | 
            +
                /**
         | 
| 5 | 
            +
                 * 静态资源地址
         | 
| 6 | 
            +
                 */
         | 
| 7 | 
            +
                ueditorPath: string;
         | 
| 8 | 
            +
                /**
         | 
| 9 | 
            +
                 * 文件上传inputRef
         | 
| 10 | 
            +
                 */
         | 
| 11 | 
            +
                private inputRef;
         | 
| 12 | 
            +
                /**
         | 
| 13 | 
            +
                 * 编辑器容器ref
         | 
| 14 | 
            +
                 */
         | 
| 15 | 
            +
                private containerRef;
         | 
| 16 | 
            +
                /**
         | 
| 17 | 
            +
                 * 编辑器容器id
         | 
| 18 | 
            +
                 */
         | 
| 19 | 
            +
                private containerId;
         | 
| 20 | 
            +
                /**
         | 
| 21 | 
            +
                 * 编辑器实例
         | 
| 22 | 
            +
                 */
         | 
| 23 | 
            +
                private ueditorInst;
         | 
| 24 | 
            +
                /**
         | 
| 25 | 
            +
                 * 是否上报
         | 
| 26 | 
            +
                 */
         | 
| 27 | 
            +
                private isReportFlag;
         | 
| 28 | 
            +
                /**
         | 
| 29 | 
            +
                 * 值变化节流函数
         | 
| 30 | 
            +
                 */
         | 
| 31 | 
            +
                private debounceContentChange;
         | 
| 32 | 
            +
                /**
         | 
| 33 | 
            +
                 * 当前值
         | 
| 34 | 
            +
                 */
         | 
| 35 | 
            +
                private currentContent;
         | 
| 36 | 
            +
                /**
         | 
| 37 | 
            +
                 * 上传文件函数
         | 
| 38 | 
            +
                 */
         | 
| 39 | 
            +
                private uploadFunction;
         | 
| 40 | 
            +
                /**
         | 
| 41 | 
            +
                 * 初始加载失败
         | 
| 42 | 
            +
                 */
         | 
| 43 | 
            +
                state: Readonly<{
         | 
| 44 | 
            +
                    initError: boolean;
         | 
| 45 | 
            +
                }>;
         | 
| 46 | 
            +
                /**
         | 
| 47 | 
            +
                 * 编辑器配置项
         | 
| 48 | 
            +
                 */
         | 
| 49 | 
            +
                editorConfig: any;
         | 
| 50 | 
            +
                constructor(props: ILcdpUeditorProps);
         | 
| 51 | 
            +
                componentDidMount(): void;
         | 
| 52 | 
            +
                componentWillReceiveProps(nextProps: ILcdpUeditorProps): void;
         | 
| 53 | 
            +
                componentWillUnmount(): void;
         | 
| 54 | 
            +
                private onContentChange;
         | 
| 55 | 
            +
                private getExtString;
         | 
| 56 | 
            +
                /**
         | 
| 57 | 
            +
                 * 文件选择
         | 
| 58 | 
            +
                 * @param cb 回调给编辑器
         | 
| 59 | 
            +
                 * @param type 类型
         | 
| 60 | 
            +
                 */
         | 
| 61 | 
            +
                private fileSelect;
         | 
| 62 | 
            +
                /**
         | 
| 63 | 
            +
                 * 对外暴露编辑器实例
         | 
| 64 | 
            +
                 */
         | 
| 65 | 
            +
                private mountRef;
         | 
| 66 | 
            +
                /**
         | 
| 67 | 
            +
                 * 初始化样式
         | 
| 68 | 
            +
                 */
         | 
| 69 | 
            +
                private initStyle;
         | 
| 70 | 
            +
                /**
         | 
| 71 | 
            +
                 * 初始化编辑器实例
         | 
| 72 | 
            +
                 */
         | 
| 73 | 
            +
                initUeditor(): Promise<void>;
         | 
| 74 | 
            +
                render(): React.ReactNode;
         | 
| 75 | 
            +
            }
         | 
| 76 | 
            +
            export default LcdpUeditor;
         | 
| @@ -0,0 +1,247 @@ | |
| 1 | 
            +
            var __create = Object.create;
         | 
| 2 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 3 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 4 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 5 | 
            +
            var __getProtoOf = Object.getPrototypeOf;
         | 
| 6 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 7 | 
            +
            var __export = (target, all) => {
         | 
| 8 | 
            +
              for (var name in all)
         | 
| 9 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 10 | 
            +
            };
         | 
| 11 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 12 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 13 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 14 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 15 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 16 | 
            +
              }
         | 
| 17 | 
            +
              return to;
         | 
| 18 | 
            +
            };
         | 
| 19 | 
            +
            var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
         | 
| 20 | 
            +
              // If the importer is in node compatibility mode or this is not an ESM
         | 
| 21 | 
            +
              // file that has been converted to a CommonJS file using a Babel-
         | 
| 22 | 
            +
              // compatible transform (i.e. "__esModule" has not been set), then set
         | 
| 23 | 
            +
              // "default" to the CommonJS "module.exports" for node compatibility.
         | 
| 24 | 
            +
              isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
         | 
| 25 | 
            +
              mod
         | 
| 26 | 
            +
            ));
         | 
| 27 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            // src/LcdpUeditor.tsx
         | 
| 30 | 
            +
            var LcdpUeditor_exports = {};
         | 
| 31 | 
            +
            __export(LcdpUeditor_exports, {
         | 
| 32 | 
            +
              default: () => LcdpUeditor_default
         | 
| 33 | 
            +
            });
         | 
| 34 | 
            +
            module.exports = __toCommonJS(LcdpUeditor_exports);
         | 
| 35 | 
            +
            var import_react = __toESM(require("react"));
         | 
| 36 | 
            +
            var import_const = require("./const");
         | 
| 37 | 
            +
            var import_defaultConfig = __toESM(require("./defaultConfig.json"));
         | 
| 38 | 
            +
            var import_UeditorResourceLoader = __toESM(require("./tools/UeditorResourceLoader"));
         | 
| 39 | 
            +
            var import_lodash = require("lodash");
         | 
| 40 | 
            +
            var LcdpUeditor = class extends import_react.default.Component {
         | 
| 41 | 
            +
              constructor(props) {
         | 
| 42 | 
            +
                super(props);
         | 
| 43 | 
            +
                /**
         | 
| 44 | 
            +
                 * 静态资源地址
         | 
| 45 | 
            +
                 */
         | 
| 46 | 
            +
                this.ueditorPath = import_const.DEFAULT_UEDITOR_PATH;
         | 
| 47 | 
            +
                /**
         | 
| 48 | 
            +
                 * 文件上传inputRef
         | 
| 49 | 
            +
                 */
         | 
| 50 | 
            +
                this.inputRef = import_react.default.createRef();
         | 
| 51 | 
            +
                /**
         | 
| 52 | 
            +
                 * 编辑器容器ref
         | 
| 53 | 
            +
                 */
         | 
| 54 | 
            +
                this.containerRef = import_react.default.createRef();
         | 
| 55 | 
            +
                /**
         | 
| 56 | 
            +
                 * 编辑器实例
         | 
| 57 | 
            +
                 */
         | 
| 58 | 
            +
                this.ueditorInst = null;
         | 
| 59 | 
            +
                /**
         | 
| 60 | 
            +
                 * 是否上报
         | 
| 61 | 
            +
                 */
         | 
| 62 | 
            +
                this.isReportFlag = true;
         | 
| 63 | 
            +
                /**
         | 
| 64 | 
            +
                 * 当前值
         | 
| 65 | 
            +
                 */
         | 
| 66 | 
            +
                this.currentContent = "";
         | 
| 67 | 
            +
                /**
         | 
| 68 | 
            +
                 * 初始加载失败
         | 
| 69 | 
            +
                 */
         | 
| 70 | 
            +
                this.state = {
         | 
| 71 | 
            +
                  initError: false
         | 
| 72 | 
            +
                };
         | 
| 73 | 
            +
                /**
         | 
| 74 | 
            +
                 * 编辑器配置项
         | 
| 75 | 
            +
                 */
         | 
| 76 | 
            +
                this.editorConfig = {};
         | 
| 77 | 
            +
                const { config } = props;
         | 
| 78 | 
            +
                this.containerId = `ueditor_${Date.now()}_${String(Math.random()).slice(2, 6)}`;
         | 
| 79 | 
            +
                if (this.props.ueditorPath) {
         | 
| 80 | 
            +
                  this.ueditorPath = this.props.ueditorPath;
         | 
| 81 | 
            +
                }
         | 
| 82 | 
            +
                this.currentContent = this.props.value;
         | 
| 83 | 
            +
                this.uploadFunction = (file, type) => {
         | 
| 84 | 
            +
                  var _a;
         | 
| 85 | 
            +
                  if (type === "image" && ((_a = this.props.config) == null ? void 0 : _a.imageType) === "base64") {
         | 
| 86 | 
            +
                    const reader = new FileReader();
         | 
| 87 | 
            +
                    reader.readAsDataURL(file);
         | 
| 88 | 
            +
                    return new Promise((resolve, reject) => {
         | 
| 89 | 
            +
                      reader.onload = ({ target }) => resolve({
         | 
| 90 | 
            +
                        state: "SUCCESS",
         | 
| 91 | 
            +
                        url: target == null ? void 0 : target.result,
         | 
| 92 | 
            +
                        title: file.name,
         | 
| 93 | 
            +
                        original: file.name
         | 
| 94 | 
            +
                      });
         | 
| 95 | 
            +
                    });
         | 
| 96 | 
            +
                  }
         | 
| 97 | 
            +
                  if (this.props.uploadFunction) {
         | 
| 98 | 
            +
                    return this.props.uploadFunction(file);
         | 
| 99 | 
            +
                  }
         | 
| 100 | 
            +
                  return null;
         | 
| 101 | 
            +
                };
         | 
| 102 | 
            +
                this.editorConfig = {
         | 
| 103 | 
            +
                  ...import_defaultConfig.default,
         | 
| 104 | 
            +
                  initialFrameHeight: (config == null ? void 0 : config.height) || 300,
         | 
| 105 | 
            +
                  autoHeightEnabled: false,
         | 
| 106 | 
            +
                  selectCallback: (cb, type) => {
         | 
| 107 | 
            +
                    this.fileSelect(cb, type);
         | 
| 108 | 
            +
                  },
         | 
| 109 | 
            +
                  uploadFunction: this.uploadFunction
         | 
| 110 | 
            +
                };
         | 
| 111 | 
            +
                this.debounceContentChange = (0, import_lodash.debounce)(this.onContentChange.bind(this), 300);
         | 
| 112 | 
            +
              }
         | 
| 113 | 
            +
              componentDidMount() {
         | 
| 114 | 
            +
                this.initUeditor();
         | 
| 115 | 
            +
              }
         | 
| 116 | 
            +
              componentWillReceiveProps(nextProps) {
         | 
| 117 | 
            +
                if ("value" in nextProps && this.currentContent !== nextProps.value) {
         | 
| 118 | 
            +
                  this.isReportFlag = false;
         | 
| 119 | 
            +
                  if (this.ueditorInst) {
         | 
| 120 | 
            +
                    this.ueditorInst.setContent(nextProps.value);
         | 
| 121 | 
            +
                  }
         | 
| 122 | 
            +
                }
         | 
| 123 | 
            +
                if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
         | 
| 124 | 
            +
                  if (nextProps.disabled) {
         | 
| 125 | 
            +
                    this.ueditorInst.setDisabled();
         | 
| 126 | 
            +
                  } else {
         | 
| 127 | 
            +
                    this.ueditorInst.setEnabled();
         | 
| 128 | 
            +
                  }
         | 
| 129 | 
            +
                }
         | 
| 130 | 
            +
              }
         | 
| 131 | 
            +
              componentWillUnmount() {
         | 
| 132 | 
            +
                var _a, _b;
         | 
| 133 | 
            +
                (_b = (_a = this.ueditorInst) == null ? void 0 : _a.destroy) == null ? void 0 : _b.call(_a);
         | 
| 134 | 
            +
              }
         | 
| 135 | 
            +
              onContentChange() {
         | 
| 136 | 
            +
                if (!this.isReportFlag) {
         | 
| 137 | 
            +
                  this.isReportFlag = true;
         | 
| 138 | 
            +
                } else if (this.props.onChange) {
         | 
| 139 | 
            +
                  this.currentContent = this.ueditorInst.getContent();
         | 
| 140 | 
            +
                  this.props.onChange(this.currentContent);
         | 
| 141 | 
            +
                }
         | 
| 142 | 
            +
              }
         | 
| 143 | 
            +
              getExtString(str) {
         | 
| 144 | 
            +
                if (Array.isArray(str)) {
         | 
| 145 | 
            +
                  return str.join(",");
         | 
| 146 | 
            +
                }
         | 
| 147 | 
            +
                return str || "";
         | 
| 148 | 
            +
              }
         | 
| 149 | 
            +
              /**
         | 
| 150 | 
            +
               * 文件选择
         | 
| 151 | 
            +
               * @param cb 回调给编辑器
         | 
| 152 | 
            +
               * @param type 类型
         | 
| 153 | 
            +
               */
         | 
| 154 | 
            +
              async fileSelect(cb, type) {
         | 
| 155 | 
            +
                if (this.inputRef.current) {
         | 
| 156 | 
            +
                  let accept = "";
         | 
| 157 | 
            +
                  switch (type) {
         | 
| 158 | 
            +
                    case "image":
         | 
| 159 | 
            +
                      accept = this.getExtString(this.editorConfig.imageAllowFiles);
         | 
| 160 | 
            +
                      break;
         | 
| 161 | 
            +
                    case "audio":
         | 
| 162 | 
            +
                      accept = this.getExtString(this.editorConfig.audioAllowFiles);
         | 
| 163 | 
            +
                      break;
         | 
| 164 | 
            +
                    case "video":
         | 
| 165 | 
            +
                      accept = this.getExtString(this.editorConfig.videoAllowFiles);
         | 
| 166 | 
            +
                      break;
         | 
| 167 | 
            +
                    default:
         | 
| 168 | 
            +
                      break;
         | 
| 169 | 
            +
                  }
         | 
| 170 | 
            +
                  this.inputRef.current.accept = accept || "";
         | 
| 171 | 
            +
                  this.inputRef.current.click();
         | 
| 172 | 
            +
                  this.inputRef.current.onchange = async (e) => {
         | 
| 173 | 
            +
                    let file;
         | 
| 174 | 
            +
                    const fileList = e.target.files;
         | 
| 175 | 
            +
                    if ((fileList == null ? void 0 : fileList.length) > 0) {
         | 
| 176 | 
            +
                      file = fileList[0];
         | 
| 177 | 
            +
                    }
         | 
| 178 | 
            +
                    if (file) {
         | 
| 179 | 
            +
                      const res = await this.uploadFunction(file, type);
         | 
| 180 | 
            +
                      if (res.state === "SUCCESS" && res.url) {
         | 
| 181 | 
            +
                        cb(res);
         | 
| 182 | 
            +
                      }
         | 
| 183 | 
            +
                    }
         | 
| 184 | 
            +
                    this.inputRef.current.value = "";
         | 
| 185 | 
            +
                  };
         | 
| 186 | 
            +
                }
         | 
| 187 | 
            +
              }
         | 
| 188 | 
            +
              /**
         | 
| 189 | 
            +
               * 对外暴露编辑器实例
         | 
| 190 | 
            +
               */
         | 
| 191 | 
            +
              mountRef() {
         | 
| 192 | 
            +
                if (this.props.onMount) {
         | 
| 193 | 
            +
                  this.props.onMount(this.ueditorInst);
         | 
| 194 | 
            +
                }
         | 
| 195 | 
            +
              }
         | 
| 196 | 
            +
              /**
         | 
| 197 | 
            +
               * 初始化样式
         | 
| 198 | 
            +
               */
         | 
| 199 | 
            +
              initStyle() {
         | 
| 200 | 
            +
                var _a, _b;
         | 
| 201 | 
            +
                const { toolbarColor, backgroundColor } = this.props.style || {};
         | 
| 202 | 
            +
                if (this.containerRef.current) {
         | 
| 203 | 
            +
                  if (backgroundColor) {
         | 
| 204 | 
            +
                    const editor = this.containerRef.current.querySelector(".edui-editor");
         | 
| 205 | 
            +
                    (_a = editor.style) == null ? void 0 : _a.setProperty("background-color", backgroundColor);
         | 
| 206 | 
            +
                  }
         | 
| 207 | 
            +
                  if (toolbarColor) {
         | 
| 208 | 
            +
                    const toolBox = this.containerRef.current.querySelector(".edui-editor-toolbarboxouter");
         | 
| 209 | 
            +
                    (_b = toolBox.style) == null ? void 0 : _b.setProperty("background-color", toolbarColor);
         | 
| 210 | 
            +
                  }
         | 
| 211 | 
            +
                }
         | 
| 212 | 
            +
              }
         | 
| 213 | 
            +
              /**
         | 
| 214 | 
            +
               * 初始化编辑器实例
         | 
| 215 | 
            +
               */
         | 
| 216 | 
            +
              async initUeditor() {
         | 
| 217 | 
            +
                import_UeditorResourceLoader.default.onReady(() => {
         | 
| 218 | 
            +
                  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
         | 
| 219 | 
            +
                  this.ueditorInst.ready(() => {
         | 
| 220 | 
            +
                    this.ueditorInst.addListener("contentChange", () => {
         | 
| 221 | 
            +
                      this.debounceContentChange();
         | 
| 222 | 
            +
                    });
         | 
| 223 | 
            +
                    this.initStyle();
         | 
| 224 | 
            +
                  });
         | 
| 225 | 
            +
                  this.mountRef();
         | 
| 226 | 
            +
                });
         | 
| 227 | 
            +
                const jsList = [
         | 
| 228 | 
            +
                  `${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_CONFIG}`,
         | 
| 229 | 
            +
                  `${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL}`,
         | 
| 230 | 
            +
                  `${this.ueditorPath}/${import_const.DEFAULT_UEDITOR_CONFIG.GET_UEDITOR_LANG()}`
         | 
| 231 | 
            +
                ];
         | 
| 232 | 
            +
                import_UeditorResourceLoader.default.onLoadError(() => {
         | 
| 233 | 
            +
                  this.setState({
         | 
| 234 | 
            +
                    initError: true
         | 
| 235 | 
            +
                  });
         | 
| 236 | 
            +
                });
         | 
| 237 | 
            +
                import_UeditorResourceLoader.default.startLoad(jsList);
         | 
| 238 | 
            +
              }
         | 
| 239 | 
            +
              render() {
         | 
| 240 | 
            +
                const { initError } = this.state;
         | 
| 241 | 
            +
                if (initError) {
         | 
| 242 | 
            +
                  throw new Error("Load Ueditor Resource Fail");
         | 
| 243 | 
            +
                }
         | 
| 244 | 
            +
                return /* @__PURE__ */ import_react.default.createElement("div", { ref: this.containerRef, style: this.props.style, className: this.props.className }, /* @__PURE__ */ import_react.default.createElement("script", { id: this.containerId, type: "text/plain" }), /* @__PURE__ */ import_react.default.createElement("input", { hidden: true, ref: this.inputRef, type: "file" }));
         | 
| 245 | 
            +
              }
         | 
| 246 | 
            +
            };
         | 
| 247 | 
            +
            var LcdpUeditor_default = LcdpUeditor;
         | 
    
        package/lib/const.d.ts
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            /**
         | 
| 2 | 
            +
             * 默认的ueditor资源路径
         | 
| 3 | 
            +
             */
         | 
| 4 | 
            +
            export declare const DEFAULT_UEDITOR_PATH = "./ueditor-resource";
         | 
| 5 | 
            +
            /**
         | 
| 6 | 
            +
             * ueditor 资源文件名
         | 
| 7 | 
            +
             */
         | 
| 8 | 
            +
            export declare const DEFAULT_UEDITOR_CONFIG: {
         | 
| 9 | 
            +
                UEDITOR_CONFIG: string;
         | 
| 10 | 
            +
                UEDITOR_ALL: string;
         | 
| 11 | 
            +
                GET_UEDITOR_LANG: (lang?: string) => string;
         | 
| 12 | 
            +
            };
         | 
    
        package/lib/const.js
    ADDED
    
    | @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            // src/const.ts
         | 
| 20 | 
            +
            var const_exports = {};
         | 
| 21 | 
            +
            __export(const_exports, {
         | 
| 22 | 
            +
              DEFAULT_UEDITOR_CONFIG: () => DEFAULT_UEDITOR_CONFIG,
         | 
| 23 | 
            +
              DEFAULT_UEDITOR_PATH: () => DEFAULT_UEDITOR_PATH
         | 
| 24 | 
            +
            });
         | 
| 25 | 
            +
            module.exports = __toCommonJS(const_exports);
         | 
| 26 | 
            +
            var DEFAULT_UEDITOR_PATH = "./ueditor-resource";
         | 
| 27 | 
            +
            var DEFAULT_UEDITOR_CONFIG = {
         | 
| 28 | 
            +
              // 配置文件
         | 
| 29 | 
            +
              UEDITOR_CONFIG: "ueditor.config.js",
         | 
| 30 | 
            +
              // 主文件
         | 
| 31 | 
            +
              UEDITOR_ALL: "ueditor.all.js",
         | 
| 32 | 
            +
              // 语言文件
         | 
| 33 | 
            +
              GET_UEDITOR_LANG: (lang = "zh-cn") => `lang/${lang}/${lang}.js`
         | 
| 34 | 
            +
            };
         | 
| 35 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 36 | 
            +
            0 && (module.exports = {
         | 
| 37 | 
            +
              DEFAULT_UEDITOR_CONFIG,
         | 
| 38 | 
            +
              DEFAULT_UEDITOR_PATH
         | 
| 39 | 
            +
            });
         | 
| @@ -0,0 +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 | 
            +
                ]
         | 
| 77 | 
            +
            }
         | 
    
        package/lib/index.d.ts
    ADDED
    
    
    
        package/lib/index.js
    ADDED
    
    | @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            var __create = Object.create;
         | 
| 2 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 3 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 4 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 5 | 
            +
            var __getProtoOf = Object.getPrototypeOf;
         | 
| 6 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 7 | 
            +
            var __export = (target, all) => {
         | 
| 8 | 
            +
              for (var name in all)
         | 
| 9 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 10 | 
            +
            };
         | 
| 11 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 12 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 13 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 14 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 15 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 16 | 
            +
              }
         | 
| 17 | 
            +
              return to;
         | 
| 18 | 
            +
            };
         | 
| 19 | 
            +
            var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
         | 
| 20 | 
            +
              // If the importer is in node compatibility mode or this is not an ESM
         | 
| 21 | 
            +
              // file that has been converted to a CommonJS file using a Babel-
         | 
| 22 | 
            +
              // compatible transform (i.e. "__esModule" has not been set), then set
         | 
| 23 | 
            +
              // "default" to the CommonJS "module.exports" for node compatibility.
         | 
| 24 | 
            +
              isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
         | 
| 25 | 
            +
              mod
         | 
| 26 | 
            +
            ));
         | 
| 27 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            // src/index.tsx
         | 
| 30 | 
            +
            var src_exports = {};
         | 
| 31 | 
            +
            __export(src_exports, {
         | 
| 32 | 
            +
              LcdpUeditor: () => import_LcdpUeditor.default,
         | 
| 33 | 
            +
              default: () => src_default
         | 
| 34 | 
            +
            });
         | 
| 35 | 
            +
            module.exports = __toCommonJS(src_exports);
         | 
| 36 | 
            +
            var import_LcdpUeditor = __toESM(require("./LcdpUeditor"));
         | 
| 37 | 
            +
            var src_default = import_LcdpUeditor.default;
         | 
| 38 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 39 | 
            +
            0 && (module.exports = {
         | 
| 40 | 
            +
              LcdpUeditor
         | 
| 41 | 
            +
            });
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            declare class UeditorResourceLoader {
         | 
| 2 | 
            +
                private static instance;
         | 
| 3 | 
            +
                private callbackList;
         | 
| 4 | 
            +
                private errorCallbackList;
         | 
| 5 | 
            +
                private isReady;
         | 
| 6 | 
            +
                private loading;
         | 
| 7 | 
            +
                private initError;
         | 
| 8 | 
            +
                static startLoad(jsList: string[]): Promise<void>;
         | 
| 9 | 
            +
                static getInstance(): UeditorResourceLoader;
         | 
| 10 | 
            +
                /**
         | 
| 11 | 
            +
                 * 加载完成执行
         | 
| 12 | 
            +
                 * @param callback 回调函数
         | 
| 13 | 
            +
                 */
         | 
| 14 | 
            +
                static onReady(callback: Function): void;
         | 
| 15 | 
            +
                /**
         | 
| 16 | 
            +
                 * 资源加载失败执行
         | 
| 17 | 
            +
                 * @param callback
         | 
| 18 | 
            +
                 */
         | 
| 19 | 
            +
                static onLoadError(callback: Function): void;
         | 
| 20 | 
            +
            }
         | 
| 21 | 
            +
            export default UeditorResourceLoader;
         | 
| @@ -0,0 +1,90 @@ | |
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            // src/tools/UeditorResourceLoader.ts
         | 
| 20 | 
            +
            var UeditorResourceLoader_exports = {};
         | 
| 21 | 
            +
            __export(UeditorResourceLoader_exports, {
         | 
| 22 | 
            +
              default: () => UeditorResourceLoader_default
         | 
| 23 | 
            +
            });
         | 
| 24 | 
            +
            module.exports = __toCommonJS(UeditorResourceLoader_exports);
         | 
| 25 | 
            +
            var import_loadScript = require("./loadScript");
         | 
| 26 | 
            +
            var UeditorResourceLoader = class {
         | 
| 27 | 
            +
              constructor() {
         | 
| 28 | 
            +
                this.callbackList = [];
         | 
| 29 | 
            +
                this.errorCallbackList = [];
         | 
| 30 | 
            +
                this.isReady = false;
         | 
| 31 | 
            +
                this.loading = false;
         | 
| 32 | 
            +
                this.initError = false;
         | 
| 33 | 
            +
              }
         | 
| 34 | 
            +
              static async startLoad(jsList) {
         | 
| 35 | 
            +
                const inst = this.getInstance();
         | 
| 36 | 
            +
                if (!inst.loading && !inst.isReady || inst.initError) {
         | 
| 37 | 
            +
                  inst.loading = true;
         | 
| 38 | 
            +
                  inst.initError = false;
         | 
| 39 | 
            +
                  try {
         | 
| 40 | 
            +
                    await (0, import_loadScript.loadScriptSync)(jsList);
         | 
| 41 | 
            +
                    if (window.UE) {
         | 
| 42 | 
            +
                      inst.isReady = true;
         | 
| 43 | 
            +
                      inst.loading = false;
         | 
| 44 | 
            +
                      while (inst.callbackList.length) {
         | 
| 45 | 
            +
                        const cb = inst.callbackList.pop();
         | 
| 46 | 
            +
                        cb && cb();
         | 
| 47 | 
            +
                      }
         | 
| 48 | 
            +
                    } else {
         | 
| 49 | 
            +
                      inst.loading = false;
         | 
| 50 | 
            +
                      inst.isReady = false;
         | 
| 51 | 
            +
                      inst.initError = true;
         | 
| 52 | 
            +
                      while (inst.errorCallbackList.length) {
         | 
| 53 | 
            +
                        const cb = inst.errorCallbackList.pop();
         | 
| 54 | 
            +
                        cb && cb();
         | 
| 55 | 
            +
                      }
         | 
| 56 | 
            +
                    }
         | 
| 57 | 
            +
                  } catch (error) {
         | 
| 58 | 
            +
                    inst.loading = false;
         | 
| 59 | 
            +
                    inst.isReady = false;
         | 
| 60 | 
            +
                  }
         | 
| 61 | 
            +
                }
         | 
| 62 | 
            +
              }
         | 
| 63 | 
            +
              static getInstance() {
         | 
| 64 | 
            +
                if (!this.instance) {
         | 
| 65 | 
            +
                  this.instance = new UeditorResourceLoader();
         | 
| 66 | 
            +
                }
         | 
| 67 | 
            +
                return this.instance;
         | 
| 68 | 
            +
              }
         | 
| 69 | 
            +
              /**
         | 
| 70 | 
            +
               * 加载完成执行
         | 
| 71 | 
            +
               * @param callback 回调函数
         | 
| 72 | 
            +
               */
         | 
| 73 | 
            +
              static onReady(callback) {
         | 
| 74 | 
            +
                const inst = this.getInstance();
         | 
| 75 | 
            +
                if (inst.isReady) {
         | 
| 76 | 
            +
                  callback();
         | 
| 77 | 
            +
                } else {
         | 
| 78 | 
            +
                  inst.callbackList.push(callback);
         | 
| 79 | 
            +
                }
         | 
| 80 | 
            +
              }
         | 
| 81 | 
            +
              /**
         | 
| 82 | 
            +
               * 资源加载失败执行
         | 
| 83 | 
            +
               * @param callback
         | 
| 84 | 
            +
               */
         | 
| 85 | 
            +
              static onLoadError(callback) {
         | 
| 86 | 
            +
                const inst = this.getInstance();
         | 
| 87 | 
            +
                inst.errorCallbackList.push(callback);
         | 
| 88 | 
            +
              }
         | 
| 89 | 
            +
            };
         | 
| 90 | 
            +
            var UeditorResourceLoader_default = UeditorResourceLoader;
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            // src/tools/loadScript.ts
         | 
| 20 | 
            +
            var loadScript_exports = {};
         | 
| 21 | 
            +
            __export(loadScript_exports, {
         | 
| 22 | 
            +
              loadScriptSync: () => loadScriptSync
         | 
| 23 | 
            +
            });
         | 
| 24 | 
            +
            module.exports = __toCommonJS(loadScript_exports);
         | 
| 25 | 
            +
            var loadScriptSync = async (strs) => {
         | 
| 26 | 
            +
              for (let i = 0; i < strs.length; i += 1) {
         | 
| 27 | 
            +
                const script = document.createElement("script");
         | 
| 28 | 
            +
                script.src = strs[i];
         | 
| 29 | 
            +
                script.async = false;
         | 
| 30 | 
            +
                document.body.appendChild(script);
         | 
| 31 | 
            +
                await new Promise((resolve) => {
         | 
| 32 | 
            +
                  script.onload = resolve;
         | 
| 33 | 
            +
                });
         | 
| 34 | 
            +
              }
         | 
| 35 | 
            +
            };
         | 
| 36 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 37 | 
            +
            0 && (module.exports = {
         | 
| 38 | 
            +
              loadScriptSync
         | 
| 39 | 
            +
            });
         | 
    
        package/lib/type.d.ts
    ADDED
    
    | @@ -0,0 +1,142 @@ | |
| 1 | 
            +
            import React from 'react';
         | 
| 2 | 
            +
            interface IUeditorStype extends React.CSSProperties {
         | 
| 3 | 
            +
                toolbarColor?: string;
         | 
| 4 | 
            +
            }
         | 
| 5 | 
            +
            export interface ILcdpUeditorProps {
         | 
| 6 | 
            +
                /**
         | 
| 7 | 
            +
                 * ueditor产物路径 默认 ./ueditor-resource
         | 
| 8 | 
            +
                 */
         | 
| 9 | 
            +
                ueditorPath?: string;
         | 
| 10 | 
            +
                /**
         | 
| 11 | 
            +
                 * 样式类名
         | 
| 12 | 
            +
                 */
         | 
| 13 | 
            +
                className?: string;
         | 
| 14 | 
            +
                /**
         | 
| 15 | 
            +
                 * 编辑器样式
         | 
| 16 | 
            +
                 */
         | 
| 17 | 
            +
                style?: IUeditorStype;
         | 
| 18 | 
            +
                /**
         | 
| 19 | 
            +
                 * 禁用
         | 
| 20 | 
            +
                 */
         | 
| 21 | 
            +
                disabled?: boolean;
         | 
| 22 | 
            +
                /**
         | 
| 23 | 
            +
                 * 富文本配置
         | 
| 24 | 
            +
                 */
         | 
| 25 | 
            +
                config?: {
         | 
| 26 | 
            +
                    /**
         | 
| 27 | 
            +
                     * 编辑器高度 默认300px
         | 
| 28 | 
            +
                     */
         | 
| 29 | 
            +
                    height?: number;
         | 
| 30 | 
            +
                    /**
         | 
| 31 | 
            +
                     * 图片类型
         | 
| 32 | 
            +
                     */
         | 
| 33 | 
            +
                    imageType: 'file' | 'base64';
         | 
| 34 | 
            +
                    /**
         | 
| 35 | 
            +
                     * 上传大小限制,单位B,默认值:10485760
         | 
| 36 | 
            +
                     */
         | 
| 37 | 
            +
                    imageMaxSize?: number;
         | 
| 38 | 
            +
                    /**
         | 
| 39 | 
            +
                     * 上传图片格式显示 [".png", ".jpg", ".jpeg", ".gif", ".bmp"]
         | 
| 40 | 
            +
                     */
         | 
| 41 | 
            +
                    imageAllowFiles?: string[];
         | 
| 42 | 
            +
                    /**
         | 
| 43 | 
            +
                     * 上传大小限制,单位B,默认值:104857600
         | 
| 44 | 
            +
                     */
         | 
| 45 | 
            +
                    fileMaxSize?: number;
         | 
| 46 | 
            +
                    /**
         | 
| 47 | 
            +
                     * 上传文件格式限制
         | 
| 48 | 
            +
                     */
         | 
| 49 | 
            +
                    fileAllowFiles?: string[];
         | 
| 50 | 
            +
                    /**
         | 
| 51 | 
            +
                     * 上传音频大小限制,单位B,默认值:104857600
         | 
| 52 | 
            +
                     */
         | 
| 53 | 
            +
                    audioMaxSize?: number;
         | 
| 54 | 
            +
                    /**
         | 
| 55 | 
            +
                     * 上传音频格式限制
         | 
| 56 | 
            +
                     */
         | 
| 57 | 
            +
                    audioAllowFiles?: string[];
         | 
| 58 | 
            +
                    /**
         | 
| 59 | 
            +
                     * 上传视频大小限制,单位B,默认值:104857600
         | 
| 60 | 
            +
                     */
         | 
| 61 | 
            +
                    videoMaxSize?: number;
         | 
| 62 | 
            +
                    /**
         | 
| 63 | 
            +
                     * 上传视频格式限制
         | 
| 64 | 
            +
                     */
         | 
| 65 | 
            +
                    videoAllowFiles?: string[];
         | 
| 66 | 
            +
                };
         | 
| 67 | 
            +
                /**
         | 
| 68 | 
            +
                 * 语言 默认 zh-cn
         | 
| 69 | 
            +
                 * zh-cn 中文 en 英文
         | 
| 70 | 
            +
                 */
         | 
| 71 | 
            +
                lang?: 'zh-cn' | 'en';
         | 
| 72 | 
            +
                /**
         | 
| 73 | 
            +
                 * 上传方法
         | 
| 74 | 
            +
                 * @param file 文件
         | 
| 75 | 
            +
                 * @param fileType 文件类型
         | 
| 76 | 
            +
                 */
         | 
| 77 | 
            +
                uploadFunction(file: File): Promise<{
         | 
| 78 | 
            +
                    state: 'SUCCESS' | 'FAIL';
         | 
| 79 | 
            +
                    url?: string;
         | 
| 80 | 
            +
                    title?: string;
         | 
| 81 | 
            +
                    original?: string;
         | 
| 82 | 
            +
                }>;
         | 
| 83 | 
            +
                /**
         | 
| 84 | 
            +
                 *  编辑器挂载
         | 
| 85 | 
            +
                 * @param inst
         | 
| 86 | 
            +
                 */
         | 
| 87 | 
            +
                onMount?(inst: ILcdpUeditorInst): void;
         | 
| 88 | 
            +
                /**
         | 
| 89 | 
            +
                 * 内容
         | 
| 90 | 
            +
                 */
         | 
| 91 | 
            +
                value?: string;
         | 
| 92 | 
            +
                /**
         | 
| 93 | 
            +
                 * 内容改变事件
         | 
| 94 | 
            +
                 * @param val 编辑器内容
         | 
| 95 | 
            +
                 */
         | 
| 96 | 
            +
                onChange?(val: string): void;
         | 
| 97 | 
            +
            }
         | 
| 98 | 
            +
            export interface ILcdpUeditorInst {
         | 
| 99 | 
            +
                /**
         | 
| 100 | 
            +
                 * 获取整个html内容
         | 
| 101 | 
            +
                 */
         | 
| 102 | 
            +
                getAllHtml(): string;
         | 
| 103 | 
            +
                /**
         | 
| 104 | 
            +
                 * 获取内容
         | 
| 105 | 
            +
                 */
         | 
| 106 | 
            +
                getContent(): string;
         | 
| 107 | 
            +
                /**
         | 
| 108 | 
            +
                 * 设置内容
         | 
| 109 | 
            +
                 * @param content 内容
         | 
| 110 | 
            +
                 * @param isAppend 是否追加
         | 
| 111 | 
            +
                 */
         | 
| 112 | 
            +
                setContent(content: string, isAppend?: boolean): void;
         | 
| 113 | 
            +
                /**
         | 
| 114 | 
            +
                 * 获取纯文本内容
         | 
| 115 | 
            +
                 */
         | 
| 116 | 
            +
                getContentTxt(): string;
         | 
| 117 | 
            +
                /**
         | 
| 118 | 
            +
                 * 获得带格式的纯文本
         | 
| 119 | 
            +
                 */
         | 
| 120 | 
            +
                getPlainTxt(): string;
         | 
| 121 | 
            +
                /**
         | 
| 122 | 
            +
                 * 判断是否有内容
         | 
| 123 | 
            +
                 */
         | 
| 124 | 
            +
                hasContents(): boolean;
         | 
| 125 | 
            +
                /**
         | 
| 126 | 
            +
                 * 使编辑器获得焦点
         | 
| 127 | 
            +
                 */
         | 
| 128 | 
            +
                focus(): void;
         | 
| 129 | 
            +
                /**
         | 
| 130 | 
            +
                 * 编辑器是否获得焦点
         | 
| 131 | 
            +
                 */
         | 
| 132 | 
            +
                isFocus(): boolean;
         | 
| 133 | 
            +
                /**
         | 
| 134 | 
            +
                 * 编辑器失去焦点
         | 
| 135 | 
            +
                 */
         | 
| 136 | 
            +
                setBlur(): void;
         | 
| 137 | 
            +
                /**
         | 
| 138 | 
            +
                 * 获得当前选中的文本
         | 
| 139 | 
            +
                 */
         | 
| 140 | 
            +
                getSelectText(): string;
         | 
| 141 | 
            +
            }
         | 
| 142 | 
            +
            export {};
         | 
    
        package/lib/type.js
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 6 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 7 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 8 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 9 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 10 | 
            +
              }
         | 
| 11 | 
            +
              return to;
         | 
| 12 | 
            +
            };
         | 
| 13 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            // src/type.ts
         | 
| 16 | 
            +
            var type_exports = {};
         | 
| 17 | 
            +
            module.exports = __toCommonJS(type_exports);
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1,11 +1,12 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "@lingxiteam/lcdp-ueditor-react",
         | 
| 3 | 
            -
              "version": "1.0.0-alpha. | 
| 3 | 
            +
              "version": "1.0.0-alpha.3",
         | 
| 4 4 | 
             
              "module": "es/index.js",
         | 
| 5 5 | 
             
              "license": "MIT",
         | 
| 6 6 | 
             
              "files": [
         | 
| 7 7 | 
             
                "ueditor-resource",
         | 
| 8 | 
            -
                "es"
         | 
| 8 | 
            +
                "es",
         | 
| 9 | 
            +
                "lib"
         | 
| 9 10 | 
             
              ],
         | 
| 10 11 | 
             
              "publishConfig": {
         | 
| 11 12 | 
             
                "access": "public",
         | 
| @@ -16,7 +17,7 @@ | |
| 16 17 | 
             
              "scripts": {
         | 
| 17 18 | 
             
                "build": "father build",
         | 
| 18 19 | 
             
                "dev": "father dev",
         | 
| 19 | 
            -
                "prepublishOnly": "npm run build"
         | 
| 20 | 
            +
                "prepublishOnly": "npm run build && cd ../../ueditor-plus && npm run prepublish"
         | 
| 20 21 | 
             
              },
         | 
| 21 22 | 
             
              "peerDependencies": {
         | 
| 22 23 | 
             
                "react": "^16.12.0 || ^17.0.0"
         | 
    
        package/es/LcdpUeditor.d.ts.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"LcdpUeditor.d.ts","sourceRoot":"","sources":["LcdpUeditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAOhD,cAAM,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,CAAC;IAC9D;;OAEG;IACH,WAAW,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAwD;IAExE;;OAEG;IACH,OAAO,CAAC,YAAY,CAAwD;IAE5E;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;OAEG;IACH,OAAO,CAAC,WAAW,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAiB;IAErC;;OAEG;IACH,OAAO,CAAC,qBAAqB,CAAW;IAExC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAc;IAEpC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAM;IAE5B;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAC,CAAC,CAEnC;IAEF;;OAEG;IACH,YAAY,EAAE,GAAG,CAAM;gBAEX,KAAK,EAAE,iBAAiB;IAyCpC,iBAAiB,IAAI,IAAI;IAIzB,yBAAyB,CAAC,SAAS,EAAE,iBAAiB;IAiBtD,oBAAoB,IAAI,IAAI;IAI5B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,YAAY;IAOpB;;;;OAIG;YACW,UAAU;IAqCxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAMhB;;OAEG;IACH,OAAO,CAAC,SAAS;IAcjB;;OAEG;IACG,WAAW;IA0BjB,MAAM,IAAI,KAAK,CAAC,SAAS;CAY1B;AAED,eAAe,WAAW,CAAC"}
         | 
    
        package/es/const.d.ts.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;8BAMR,MAAM;CAChC,CAAC"}
         | 
    
        package/es/index.d.ts.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"UeditorResourceLoader.d.ts","sourceRoot":"","sources":["UeditorResourceLoader.ts"],"names":[],"mappings":"AAGA,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAE/C,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,SAAS,CAAkB;WAEf,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE;WAgCjC,WAAW;IAOzB;;;OAGG;WACW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IASxC;;;OAGG;WACW,WAAW,CAAC,QAAQ,EAAE,QAAQ;CAI7C;AAED,eAAe,qBAAqB,CAAC"}
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["loadScript.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAgB,MAAM,EAAE,kBAUlD,CAAC"}
         | 
    
        package/es/type.d.ts.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,aAAc,SAAQ,KAAK,CAAC,aAAa;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,iBAAiB;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE;QAEL;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;QAE7B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAE1B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IAEF;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtB;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAChC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAC;IAEH;;;OAGG;IACH,OAAO,CAAC,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAGD,MAAM,WAAW,gBAAgB;IAE7B;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;CAC3B"}
         |