@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) • 2.8 kB
JavaScript
import { isNullOrUndefined } from "./editor.utils.es.js";
import { getEventComposedPath, hadProtocol, hexToRgbA, imageFileToUrl, imageUrlToFile, insideTable, isInside, isPureIE, omit, replaceDeltaImage, sanitize, splitWithBreak } from "./editor.utils.es.js";
import { AUDIO_VIDEO_UPLOADER_MIME_TYPES, BIG_DELTA_LIMIT, CHANGE_LANGUAGE_EVENT, COMPRESSED_UPLOADER_MIME_TYPES, DOC_UPLOADER_MIME_TYPES, FILE_UPLOADER_MIME_TYPES, IMAGE_UPLOADER_MIME_TYPES, LANG_CONF, OTHER_FILE_UPLOADER_MIME_TYPES, PPT_UPLOADER_MIME_TYPES, XSL_UPLOADER_MIME_TYPES, defaultLanguage } from "./editor.config.es.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 (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";
export {
AUDIO_VIDEO_UPLOADER_MIME_TYPES,
BIG_DELTA_LIMIT,
CHANGE_LANGUAGE_EVENT,
COMPRESSED_UPLOADER_MIME_TYPES,
DOC_UPLOADER_MIME_TYPES,
FILE_UPLOADER_MIME_TYPES,
IMAGE_UPLOADER_MIME_TYPES,
LANG_CONF,
OTHER_FILE_UPLOADER_MIME_TYPES,
PPT_UPLOADER_MIME_TYPES,
XSL_UPLOADER_MIME_TYPES,
defaultLanguage,
getEventComposedPath,
getListValue,
hadProtocol,
hexToRgbA,
imageFileToUrl,
imageUrlToFile,
inputFile,
insideTable,
isInside,
isNullOrUndefined,
isPureIE,
namespace,
omit,
replaceDeltaImage,
sanitize,
splitWithBreak
};
//# sourceMappingURL=index.es.js.map