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.

73 lines (72 loc) 2.58 kB
import { isNullOrUndefined } from "./editor.utils.es.js"; import { getEventComposedPath, hadProtocol, hexToRgbA, imageFileToUrl, imageUrlToFile, isInside, omit, replaceDeltaImage, replaceStrWhiteSpace, sanitize, shouldInsertNbspOnSpace, splitWithBreak } from "./editor.utils.es.js"; import { AUDIO_VIDEO_UPLOADER_MIME_TYPES, BIG_DELTA_LIMIT, CHANGE_LANGUAGE_EVENT, COMPRESSED_UPLOADER_MIME_TYPES, DEFAULT_TOOLBAR, DOC_UPLOADER_MIME_TYPES, FILE_UPLOADER_MIME_TYPES, FULL_TOOLBAR, IMAGE_UPLOADER_MIME_TYPES, OTHER_FILE_UPLOADER_MIME_TYPES, PPT_UPLOADER_MIME_TYPES, XSL_UPLOADER_MIME_TYPES, defaultLanguage } from "./editor.config.es.js"; import "./types/index.es.js"; function inputFile(type, accept) { if (accept.length <= 0) return; let fileInput = this.container.querySelector(`input.ql-${type}[type=file]`); if (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"; export { AUDIO_VIDEO_UPLOADER_MIME_TYPES, BIG_DELTA_LIMIT, CHANGE_LANGUAGE_EVENT, COMPRESSED_UPLOADER_MIME_TYPES, DEFAULT_TOOLBAR, DOC_UPLOADER_MIME_TYPES, FILE_UPLOADER_MIME_TYPES, FULL_TOOLBAR, IMAGE_UPLOADER_MIME_TYPES, OTHER_FILE_UPLOADER_MIME_TYPES, PPT_UPLOADER_MIME_TYPES, XSL_UPLOADER_MIME_TYPES, defaultLanguage, getEventComposedPath, getListValue, hadProtocol, hexToRgbA, imageFileToUrl, imageUrlToFile, inputFile, isInside, isNullOrUndefined, namespace, omit, replaceDeltaImage, replaceStrWhiteSpace, sanitize, shouldInsertNbspOnSpace, splitWithBreak }; //# sourceMappingURL=index.es.js.map