@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
167 lines • 4.86 kB
JavaScript
"use strict";
// // import { beginUpload as BEGIN_UPLOAD } from "api/mutations/common";
// import axios from "axios";
// import RichEditor from "molecules/RichEditor";
// import React from "react";
// import { client } from "./../../index";
//
// const getToolbarConfig = (toolbarType) => {
// if (toolbarType && toolbarType === "mini") {
// return {
// items: [
// "undo",
// "redo",
// "|",
// "bold",
// "italic",
// "underline",
// "fontColor",
// "|",
// "insertStaticLink",
// "|",
// "alignment:left",
// "alignment:center",
// "alignment:right",
// "alignment:justify",
// "|",
// "numberedList",
// "bulletedList"
// ]
// };
// } else {
// return {
// items: [
// "undo",
// "redo",
// "|",
// "heading",
// "|",
// // "fontFamily",
// "fontFamilyDropdown",
// "|",
// // "fontSize",
// "fontSizeDropdown",
// "|",
// "bold",
// "italic",
// "underline",
// "fontColor",
// "fontBackgroundColor",
// "|",
// "link",
// "imageUpload",
// "|",
// "alignment:left",
// "alignment:center",
// "alignment:right",
// "alignment:justify",
// "|",
// "numberedList",
// "bulletedList"
// ]
// };
// }
// };
//
// const beginUploadMutation = async({ filename, type }) => {
// try {
// const result = await client.mutate({
// mutation: BEGIN_UPLOAD,
// variables: { input: { filename, type } }
// });
// if (result && result.data.beginUpload) {return result.data.beginUpload; } else {throw new Error("No upload result available"); }
// } catch (err) {
// console.log(err);
// throw err;
// }
// };
//
// const getEditorConfig = (editorConfig, toolbarType) => {
// return {
// toolbar: getToolbarConfig(toolbarType),
// customUpload: {
// uploadUrl: "https://home.amazon.com",
// headers: {
// "Content-Type": "multipart/form-data"
// },
// prepareRequest: async(file) => {
// return new Promise(
// (resolve) => {
// const { name: filename, type } = file;
// beginUploadMutation({ filename, type }).then((result) => {
// console.log("The return from beginupload is");
// console.log(result);
// const fields = {};
// for (const [key, value] of Object.entries(result.fields)) {
// fields[key] = value;
// }
// const newOpts = {
// uploadUrl: result.url,
// fields,
// resultingUrl: result.resultingUrl
// };
// resolve(newOpts);
// });
// },
// (reject) => {
// console.log("Promise being rejected");
// }
// );
// },
// handleUpload: (file, options, loader, resolve, reject) => {
// const formData = new FormData();
// for (const [key, value] of Object.entries(options.fields)) {
// formData.append(key, value);
// }
//
// formData.append("file", file);
// axios
// .post(options.uploadUrl, formData, {
// headers: { "Content-Type": "multipart/form-data" },
// onUploadProgress(progressEvent) {
// loader.uploadTotal = progressEvent.total;
// loader.uploaded = progressEvent.loaded;
// }
// })
// .then(() => {
// const resultingUrl = options.resultingUrl;
// resolve({ default: `${resultingUrl}` });
// })
// .catch((err) => {
// reject(err);
// });
// }
// },
// insertStaticLink: {
// url: "https://amazon.com",
// textResolver: async() => {
// return new Promise(
// (resolve) => {
// setTimeout(() => resolve("Learn More"), 0);
// },
// (reject) => {
// console.log("Couldn't Add Link");
// }
// );
// }
// },
// ...editorConfig
// };
// };
//
// const SettingsEditor = ({ config, toolbarType, ...rest }) => {
// return (
// // <ExplorerEditor
// // toolbarType={toolbarType || "full"}
// // config={config ? getEditorConfig(config, toolbarType) : {}}
// // {...rest}
// // />
// <RichEditor
// toolbarType={toolbarType || "full"}
// config={config ? getEditorConfig(config, toolbarType) : {}}
// {...rest}/>
// );
// };
//
// export default SettingsEditor;
//# sourceMappingURL=SettingsEditor.js.map