UNPKG

@opentiny/fluent-editor

Version:

A rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It's powerful and out-of-the-box.

71 lines (70 loc) 3.45 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const editor_utils = require("./editor.utils.cjs.js"); const editor_config = require("./editor.config.cjs.js"); function inputFile(type, accept) { var _a, _b, _c; const defaultMIMETypes = this.quill.uploader.options[type].join(", "); const mimeTypes = accept || defaultMIMETypes; let fileInput = this.container.querySelector(`input.ql-${type}[type=file]`); this.quill.uploader.options.enableMultiUpload = (_a = this.quill.options.uploadOption) == null ? void 0 : _a.multiple; if (editor_utils.isNullOrUndefined(fileInput)) { fileInput = document.createElement("input"); fileInput.classList.add(`ql-${type}`); fileInput.setAttribute("type", "file"); fileInput.setAttribute("accept", mimeTypes); if (this.quill.uploader.options.enableMultiUpload === true || ((_b = this.quill.uploader.options.enableMultiUpload) == null ? void 0 : _b.file) && type === "file" || ((_c = this.quill.uploader.options.enableMultiUpload) == null ? void 0 : _c.image) && type === "image") { fileInput.setAttribute("multiple", ""); } fileInput.addEventListener("change", () => { const range = this.quill.getSelection(true); this.quill.uploader.upload(range, fileInput.files, type === "file"); fileInput.value = ""; }); this.container.appendChild(fileInput); } fileInput.click(); } function getListValue(value, preListValue) { let curListValue = value; if (preListValue && preListValue === value) { curListValue = false; } else if (value === "check") { if (preListValue === "checked" || preListValue === "unchecked") { curListValue = false; } else { curListValue = "unchecked"; } } return curListValue; } const namespace = "fe"; exports.getEventComposedPath = editor_utils.getEventComposedPath; exports.hadProtocol = editor_utils.hadProtocol; exports.hexToRgbA = editor_utils.hexToRgbA; exports.imageFileToUrl = editor_utils.imageFileToUrl; exports.imageUrlToFile = editor_utils.imageUrlToFile; exports.insideTable = editor_utils.insideTable; exports.isInside = editor_utils.isInside; exports.isNullOrUndefined = editor_utils.isNullOrUndefined; exports.isPureIE = editor_utils.isPureIE; exports.omit = editor_utils.omit; exports.replaceDeltaImage = editor_utils.replaceDeltaImage; exports.sanitize = editor_utils.sanitize; exports.splitWithBreak = editor_utils.splitWithBreak; exports.AUDIO_VIDEO_UPLOADER_MIME_TYPES = editor_config.AUDIO_VIDEO_UPLOADER_MIME_TYPES; exports.BIG_DELTA_LIMIT = editor_config.BIG_DELTA_LIMIT; exports.CHANGE_LANGUAGE_EVENT = editor_config.CHANGE_LANGUAGE_EVENT; exports.COMPRESSED_UPLOADER_MIME_TYPES = editor_config.COMPRESSED_UPLOADER_MIME_TYPES; exports.DOC_UPLOADER_MIME_TYPES = editor_config.DOC_UPLOADER_MIME_TYPES; exports.FILE_UPLOADER_MIME_TYPES = editor_config.FILE_UPLOADER_MIME_TYPES; exports.IMAGE_UPLOADER_MIME_TYPES = editor_config.IMAGE_UPLOADER_MIME_TYPES; exports.LANG_CONF = editor_config.LANG_CONF; exports.OTHER_FILE_UPLOADER_MIME_TYPES = editor_config.OTHER_FILE_UPLOADER_MIME_TYPES; exports.PPT_UPLOADER_MIME_TYPES = editor_config.PPT_UPLOADER_MIME_TYPES; exports.XSL_UPLOADER_MIME_TYPES = editor_config.XSL_UPLOADER_MIME_TYPES; exports.defaultLanguage = editor_config.defaultLanguage; exports.getListValue = getListValue; exports.inputFile = inputFile; exports.namespace = namespace; //# sourceMappingURL=index.cjs.js.map