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.

72 lines (71 loc) 3.25 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"); require("./types/index.cjs.js"); function inputFile(type, accept) { if (accept.length <= 0) return; let fileInput = this.container.querySelector(`input.ql-${type}[type=file]`); if (editor_utils.isNullOrUndefined(fileInput)) { fileInput = document.createElement("input"); fileInput.style.display = "none"; fileInput.classList.add(`ql-${type}`); fileInput.setAttribute("type", "file"); fileInput.setAttribute("accept", accept.map((mime) => mime === "*" ? `${type}/*` : mime).join(",")); const multiple = this.quill.uploader.getMultiple(type); if (multiple) { fileInput.setAttribute("multiple", ""); } fileInput.addEventListener("change", () => { const range = this.quill.getSelection(true); this.quill.uploader.upload(range, fileInput.files, type); 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.isInside = editor_utils.isInside; exports.isNullOrUndefined = editor_utils.isNullOrUndefined; exports.omit = editor_utils.omit; exports.replaceDeltaImage = editor_utils.replaceDeltaImage; exports.replaceStrWhiteSpace = editor_utils.replaceStrWhiteSpace; exports.sanitize = editor_utils.sanitize; exports.shouldInsertNbspOnSpace = editor_utils.shouldInsertNbspOnSpace; 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.DEFAULT_TOOLBAR = editor_config.DEFAULT_TOOLBAR; exports.DOC_UPLOADER_MIME_TYPES = editor_config.DOC_UPLOADER_MIME_TYPES; exports.FILE_UPLOADER_MIME_TYPES = editor_config.FILE_UPLOADER_MIME_TYPES; exports.FULL_TOOLBAR = editor_config.FULL_TOOLBAR; exports.IMAGE_UPLOADER_MIME_TYPES = editor_config.IMAGE_UPLOADER_MIME_TYPES; 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