UNPKG

wysiwyg-editor-convert

Version:
139 lines (126 loc) 9.05 kB
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("React"), require("DraftConvert")); else if(typeof define === 'function' && define.amd) define(["React", "DraftConvert"], factory); else if(typeof exports === 'object') exports["wysiwyg-editor-convert"] = factory(require("React"), require("DraftConvert")); else root["wysiwyg-editor-convert"] = factory(root["React"], root["DraftConvert"]); })(self, function(__WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_draft_convert__) { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./src/index.js": /*!**********************!*\ !*** ./src/index.js ***! \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var draft_convert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! draft-convert */ \"draft-convert\");\n/* harmony import */ var draft_convert__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(draft_convert__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ \"./src/types.js\");\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,draft_convert__WEBPACK_IMPORTED_MODULE_1__.convertToHTML)({\n blockToHTML: function blockToHTML(_ref) {\n var type = _ref.type;\n\n if (type === _types__WEBPACK_IMPORTED_MODULE_2__.BLOCK_TYPE.PARAGRAPH) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"p\", null);\n }\n\n if (type === _types__WEBPACK_IMPORTED_MODULE_2__.BLOCK_TYPE.HEADER_ONE) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h1\", null);\n }\n },\n styleToHTML: function styleToHTML(style) {\n if (style.includes(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.BACKGROUND_COLOR)) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n backgroundColor: style.replace(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.BACKGROUND_COLOR, \"\")\n }\n });\n }\n\n if (style.includes(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.COLOR)) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n color: style.replace(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.COLOR, \"\")\n }\n });\n }\n\n if (style.includes(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.FONTS_SIZE)) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n fontSize: parseInt(style.replace(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.FONTS_SIZE, \"\"), 10)\n }\n });\n }\n\n if (style.includes(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.FONT_FAMILY)) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n fontFamily: style.replace(_types__WEBPACK_IMPORTED_MODULE_2__.STYLE_TYPE.FONT_FAMILY, \"\")\n }\n });\n }\n },\n entityToHTML: function entityToHTML(_ref2, originalText) {\n var type = _ref2.type,\n data = _ref2.data;\n\n if (type === _types__WEBPACK_IMPORTED_MODULE_2__.BLOCK_TYPE.LINK) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n target: data.targetOption,\n href: data.url\n }, originalText);\n }\n\n return originalText;\n }\n}));\n\n//# sourceURL=webpack://wysiwyg-editor-convert/./src/index.js?"); /***/ }), /***/ "./src/types.js": /*!**********************!*\ !*** ./src/types.js ***! \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BLOCK_TYPE\": () => (/* binding */ BLOCK_TYPE),\n/* harmony export */ \"STYLE_TYPE\": () => (/* binding */ STYLE_TYPE)\n/* harmony export */ });\nvar BLOCK_TYPE = {\n PARAGRAPH: \"PARAGRAPH\",\n LINK: \"LINK\",\n HEADER_ONE: \"header-one\"\n};\nvar STYLE_TYPE = {\n COLOR: \"color-\",\n FONTS_SIZE: \"fontsize-\",\n FONT_FAMILY: \"fontfamily-\",\n BACKGROUND_COLOR: \"bgcolor-\"\n};\n\n//# sourceURL=webpack://wysiwyg-editor-convert/./src/types.js?"); /***/ }), /***/ "draft-convert": /*!*******************************!*\ !*** external "DraftConvert" ***! \*******************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_draft_convert__; /***/ }), /***/ "react": /*!************************!*\ !*** external "React" ***! \************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_react__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./src/index.js"); /******/ /******/ return __webpack_exports__; /******/ })() ; });