commit eca4599a64e2d82d837eb7187293c54a1845cc81
parent fc4f0a39c0e774d94788c5ca4c7dbe36c5ceebd3
Author: hunite <hunite@striven.com>
Date: Thu, 19 Sep 2019 09:02:07 -0400
editor contents
Diffstat:
3 files changed, 25 insertions(+), 1218 deletions(-)
diff --git a/dist/index.js b/dist/index.js
@@ -91,1230 +91,32 @@ return /******/ (function(modules) { // webpackBootstrap
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 1);
+/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
/******/ })
/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
-})(this, function (_exports) {
- "use strict";
-
- Object.defineProperty(_exports, "__esModule", {
- value: true
- });
- _exports["default"] = void 0;
-
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
-
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
-
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
-
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
-
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
- // Font Awesome Imports
- // import { dom } from '@fortawesome/fontawesome-svg-core';
- // import { library as faLib } from "@fortawesome/fontawesome-svg-core";
- // import { faFont } from "@fortawesome/free-solid-svg-icons/faFont";
- // import { faBold } from "@fortawesome/free-solid-svg-icons/faBold";
- // import { faItalic } from "@fortawesome/free-solid-svg-icons/faItalic";
- // import { faUnderline } from "@fortawesome/free-solid-svg-icons/faUnderline";
- // import { faStrikethrough } from "@fortawesome/free-solid-svg-icons/faStrikethrough";
- // import { faList } from "@fortawesome/free-solid-svg-icons/faList";
- // import { faListOl } from "@fortawesome/free-solid-svg-icons/faListOl";
- // import { faListUl } from "@fortawesome/free-solid-svg-icons/faListUl";
- // import { faAlignJustify } from "@fortawesome/free-solid-svg-icons/faAlignJustify";
- // import { faIndent } from "@fortawesome/free-solid-svg-icons/faIndent";
- // import { faAlignLeft } from "@fortawesome/free-solid-svg-icons/faAlignLeft";
- // import { faAlignCenter } from "@fortawesome/free-solid-svg-icons/faAlignCenter";
- // import { faAlignRight } from "@fortawesome/free-solid-svg-icons/faAlignRight";
- // import { faPaperclip } from "@fortawesome/free-solid-svg-icons/faPaperclip";
- // import { faLink } from "@fortawesome/free-solid-svg-icons/faLink";
- // import { faImage } from "@fortawesome/free-solid-svg-icons/faImage";
- // import { faPaperPlane } from "@fortawesome/free-solid-svg-icons/faPaperPlane";
- // faLib.add(faFont);
- // faLib.add(faBold);
- // faLib.add(faItalic);
- // faLib.add(faUnderline);
- // faLib.add(faStrikethrough);
- // faLib.add(faList);
- // faLib.add(faListOl);
- // faLib.add(faListUl);
- // faLib.add(faAlignJustify);
- // faLib.add(faIndent);
- // faLib.add(faAlignLeft);
- // faLib.add(faAlignCenter);
- // faLib.add(faAlignRight);
- // faLib.add(faPaperclip);
- // faLib.add(faLink);
- // faLib.add(faImage);
- // faLib.add(faPaperPlane);
- // dom.watch();
- var EXTENSIONS = [".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".tif", ".jpeg", ".jpg", ".gif", ".bmp", ".txt", ".csv", ".png", ".msg", ".wav", ".mp3", ".mp4", ".zip", ".rtf", ".eps", ".ai", ".psd", ".avi", ".mov", ".wmv", ".cfg", ".wss", ".vsd", ".vsdx", ".tsd", ".lic"];
- var FONTPACK = "fas";
- var OPTIONGROUPS = {
- textDecoration: {
- menu: {
- viewBox: "0 0 1792 1792",
- d: "M789 559l-170 450q33 0 136.5 2t160.5 2q19 0 57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29 31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15 34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5 13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0 12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11 2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0 22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58 0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z"
- },
- group: [{
- bold: {
- viewBox: "0 0 1792 1792",
- d: "M747 1521q74 32 140 32 376 0 376-335 0-114-41-180-27-44-61.5-74t-67.5-46.5-80.5-25-84-10.5-94.5-2q-73 0-101 10 0 53-.5 159t-.5 158q0 8-1 67.5t-.5 96.5 4.5 83.5 12 66.5zm-14-746q42 7 109 7 82 0 143-13t110-44.5 74.5-89.5 25.5-142q0-70-29-122.5t-79-82-108-43.5-124-14q-50 0-130 13 0 50 4 151t4 152q0 27-.5 80t-.5 79q0 46 1 69zm-541 889l2-94q15-4 85-16t106-27q7-12 12.5-27t8.5-33.5 5.5-32.5 3-37.5.5-34v-65.5q0-982-22-1025-4-8-22-14.5t-44.5-11-49.5-7-48.5-4.5-30.5-3l-4-83q98-2 340-11.5t373-9.5q23 0 68 .5t68 .5q70 0 136.5 13t128.5 42 108 71 74 104.5 28 137.5q0 52-16.5 95.5t-39 72-64.5 57.5-73 45-84 40q154 35 256.5 134t102.5 248q0 100-35 179.5t-93.5 130.5-138 85.5-163.5 48.5-176 14q-44 0-132-3t-132-3q-106 0-307 11t-231 12z"
- }
- }, {
- italic: {
- viewBox: "0 0 1792 1792",
- d: "M384 1662l17-85q22-7 61.5-16.5t72-19 59.5-23.5q28-35 41-101 1-7 62-289t114-543.5 52-296.5v-25q-24-13-54.5-18.5t-69.5-8-58-5.5l19-103q33 2 120 6.5t149.5 7 120.5 2.5q48 0 98.5-2.5t121-7 98.5-6.5q-5 39-19 89-30 10-101.5 28.5t-108.5 33.5q-8 19-14 42.5t-9 40-7.5 45.5-6.5 42q-27 148-87.5 419.5t-77.5 355.5q-2 9-13 58t-20 90-16 83.5-6 57.5l1 18q17 4 185 31-3 44-16 99-11 0-32.5 1.5t-32.5 1.5q-29 0-87-10t-86-10q-138-2-206-2-51 0-143 9t-121 11z"
- }
- }, {
- underline: {
- viewBox: "0 0 1792 1792",
- d: "M176 223q-37-2-45-4l-3-88q13-1 40-1 60 0 112 4 132 7 166 7 86 0 168-3 116-4 146-5 56 0 86-2l-1 14 2 64v9q-60 9-124 9-60 0-79 25-13 14-13 132 0 13 .5 32.5t.5 25.5l1 229 14 280q6 124 51 202 35 59 96 92 88 47 177 47 104 0 191-28 56-18 99-51 48-36 65-64 36-56 53-114 21-73 21-229 0-79-3.5-128t-11-122.5-13.5-159.5l-4-59q-5-67-24-88-34-35-77-34l-100 2-14-3 2-86h84l205 10q76 3 196-10l18 2q6 38 6 51 0 7-4 31-45 12-84 13-73 11-79 17-15 15-15 41 0 7 1.5 27t1.5 31q8 19 22 396 6 195-15 304-15 76-41 122-38 65-112 123-75 57-182 89-109 33-255 33-167 0-284-46-119-47-179-122-61-76-83-195-16-80-16-237v-333q0-188-17-213-25-36-147-39zm1488 1409v-64q0-14-9-23t-23-9h-1472q-14 0-23 9t-9 23v64q0 14 9 23t23 9h1472q14 0 23-9t9-23z"
- }
- }, {
- strikethrough: {
- viewBox: "0 0 1792 1792",
- d: "M1760 896q14 0 23 9t9 23v64q0 14-9 23t-23 9h-1728q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h1728zm-1277-64q-28-35-51-80-48-98-48-188 0-181 134-309 133-127 393-127 50 0 167 19 66 12 177 48 10 38 21 118 14 123 14 183 0 18-5 45l-12 3-84-6-14-2q-50-149-103-205-88-91-210-91-114 0-182 59-67 58-67 146 0 73 66 140t279 129q69 20 173 66 58 28 95 52h-743zm507 256h411q7 39 7 92 0 111-41 212-23 56-71 104-37 35-109 81-80 48-153 66-80 21-203 21-114 0-195-23l-140-40q-57-16-72-28-8-8-8-22v-13q0-108-2-156-1-30 0-68l2-37v-44l102-2q15 34 30 71t22.5 56 12.5 27q35 57 80 94 43 36 105 57 59 22 132 22 64 0 139-27 77-26 122-86 47-61 47-129 0-84-81-157-34-29-137-71z"
- }
- }]
- },
- listOptions: {
- menu: {
- viewBox: "0 0 1792 1792",
- d: "M256 1312v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm-1536-1152v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5z"
- },
- group: [{
- insertOrderedList: {
- viewBox: "0 0 1792 1792",
- d: "M381 1620q0 80-54.5 126t-135.5 46q-106 0-172-66l57-88q49 45 106 45 29 0 50.5-14.5t21.5-42.5q0-64-105-56l-26-56q8-10 32.5-43.5t42.5-54 37-38.5v-1q-16 0-48.5 1t-48.5 1v53h-106v-152h333v88l-95 115q51 12 81 49t30 88zm2-627v159h-362q-6-36-6-54 0-51 23.5-93t56.5-68 66-47.5 56.5-43.5 23.5-45q0-25-14.5-38.5t-39.5-13.5q-46 0-81 58l-85-59q24-51 71.5-79.5t105.5-28.5q73 0 123 41.5t50 112.5q0 50-34 91.5t-75 64.5-75.5 50.5-35.5 52.5h127v-60h105zm1409 319v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm-1408-899v99h-335v-99h107q0-41 .5-121.5t.5-121.5v-12h-2q-8 17-50 54l-71-76 136-127h106v404h108zm1408 387v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5z"
- }
- }, {
- insertUnorderedList: {
- viewBox: "0 0 1792 1792",
- d: "M384 1408q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm0-512q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm-1408-928q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5"
- }
- }]
- },
- textAlign: {
- menu: {
- viewBox: "0 0 1792 1792",
- d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45z"
- },
- group: [{
- indent: {
- viewBox: "0 0 1792 1792",
- d: "M352 832q0 14-9 23l-288 288q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-576q0-13 9.5-22.5t22.5-9.5q14 0 23 9l288 288q9 9 9 23zm1440 480v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5z"
- }
- }, {
- justifyLeft: {
- viewBox: "0 0 1792 1792",
- d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"
- }
- }, {
- justifyCenter: {
- viewBox: "0 0 1792 1792",
- d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h896q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-640q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h640q26 0 45 19t19 45z"
- }
- }, {
- justifyRight: {
- viewBox: "0 0 1792 1792",
- d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"
- }
- }]
- },
- attachments: {
- menu: {
- viewBox: "0 0 1792 1792",
- d: "M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"
- },
- group: [{
- attachment: {
- viewBox: "0 0 1792 1792",
- d: "M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"
- }
- }, {
- link: {
- viewBox: "0 0 1792 1792",
- d: "M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"
- }
- }, {
- image: {
- viewBox: "0 0 2048 1792",
- d: "M704 576q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1024 384v448h-1408v-192l320-320 160 160 512-512zm96-704h-1600q-13 0-22.5 9.5t-9.5 22.5v1216q0 13 9.5 22.5t22.5 9.5h1600q13 0 22.5-9.5t9.5-22.5v-1216q0-13-9.5-22.5t-22.5-9.5zm160 32v1216q0 66-47 113t-113 47h-1600q-66 0-113-47t-47-113v-1216q0-66 47-113t113-47h1600q66 0 113 47t47 113z"
- }
- }]
- }
- };
- var DEFAULTOPTIONS = ["bold", "italic", "underline", "strikethrough", "insertOrderedList", "insertUnorderedList", "indent", "justifyLeft", "justifyCenter", "justifyRight", "attachment", "link", "image"];
-
- var StrivenEditor =
- /*#__PURE__*/
- function () {
- function StrivenEditor(el, options) {
- _classCallCheck(this, StrivenEditor);
-
- this.range = new Range();
- this.files = [];
- this.optionGroups = OPTIONGROUPS;
-
- if (options) {
- this.options = options;
- options.fontPack || (this.options.fontPack = FONTPACK);
- options.extensions || (this.options.extensions = EXTENSIONS);
- options.toolbarOptions || (this.options.toolbarOptions = DEFAULTOPTIONS);
- } else {
- this.options = {
- fontPack: FONTPACK,
- extensions: EXTENSIONS,
- DEFAULTOPTIONS: DEFAULTOPTIONS
- };
- }
-
- this.initEditor(el);
- this.initResponsive();
- this.initOverflow();
- }
-
- _createClass(StrivenEditor, [{
- key: "initEditor",
- value: function initEditor(el) {
- var _this = this;
-
- this.editor = el;
- this.toolbar = this.initToolbar();
- this.body = this.initBody();
- this.linkMenu = this.initLinkMenu();
- this.imageMenu = this.initImageMenu();
- this.metaDataSection = this.initMetaDataSection();
- this.filesSection = this.initFilesSection();
- this.editor.style.border = "2px solid #ddd";
- this.editor.style.display = "flex";
- this.editor.style.position = "relative";
- this.editor.style.flexDirection = "column";
- this.editor.style.fontFamily = "Arial";
- this.editor.style.minHeight = "auto";
- this.editor.style.maxHeight = "auto";
- this.editor.style.maxWidth = "100%"; // Toolbar Hide
-
- if (this.options.toolbarHide) {
- this.toolbarSend.style.display = "none";
- this.toolbarOptionsGroup.style.display = "none";
-
- this.body.onfocus = function () {
- _this.overflow();
-
- _this.toolbarSlideUp();
- };
-
- this.body.onblur = function () {
- _this.overflow();
-
- setTimeout(function () {
- if (document.activeElement !== _this.body && document.activeElement !== _this.linkMenu.querySelector('input') && document.activeElement !== _this.imageMenu.querySelectorAll('input')[0] && document.activeElement !== _this.imageMenu.querySelectorAll('input')[1] && document.activeElement !== _this.imageMenu.querySelectorAll('input')[2]) {
- _this.toolbarSlideDown();
- }
- }, 2000);
- };
- } // Toolbar Options
-
-
- this.toolbarOptions.forEach(function (optionEl) {
- // Assign Styles
- // optionEl.style.padding = "0 10px";
- optionEl.style.cursor = "pointer";
- optionEl.style.userSelect = "none"; // Execute Toolbar Commands
-
- var optionElClick = optionEl.onclick;
-
- optionEl.onclick = function (e) {
- _this.body.focus();
-
- var command = optionEl.id.split("-")[1];
-
- switch (command) {
- case "insertOrderedList":
- document.execCommand("indent", true);
- document.execCommand(command, true);
- break;
-
- case "insertUnorderedList":
- document.execCommand("indent", true);
- document.execCommand(command, true);
- break;
-
- case "attachment":
- var attachmentInput = document.createElement("input");
- attachmentInput.style.display = "none";
- attachmentInput.type = "file";
- attachmentInput.click();
-
- attachmentInput.onchange = function (e) {
- return _this.attachFile(attachmentInput.files[0]);
- };
-
- break;
-
- case "link":
- if (_this.linkMenu.dataset.active === "true") {
- _this.closeLinkMenu();
- } else {
- _this.openLinkMenu();
-
- _this.range = _this.getRange();
-
- _this.linkMenu.querySelector('input').focus();
- }
-
- break;
-
- case "image":
- if (_this.imageMenu.dataset.active === "true") {
- _this.closeImageMenu();
- } else {
- _this.openImageMenu();
-
- _this.range = _this.getRange();
-
- _this.imageMenu.querySelector('input').focus();
- }
-
- break;
-
- default:
- document.execCommand(command, true);
- break;
- }
-
- optionElClick && optionElClick();
- };
- }); // Get Content from Editor
-
- this.editor.getcontent = function () {
- return _this.getContent();
- }; // Get Editor Range
-
-
- this.editor.getrange = function () {
- return _this.getRange();
- };
-
- this.editor.appendChild(this.toolbar);
- this.editor.appendChild(this.body);
- this.editor.appendChild(this.linkMenu);
- this.editor.appendChild(this.imageMenu);
- this.editor.appendChild(this.metaDataSection);
- this.editor.appendChild(this.filesSection); // Reposition Toolbar
-
- if (this.options.toolbarBottom) {
- this.editor.removeChild(this.toolbar);
- this.editor.append(this.toolbar);
- }
- }
- }, {
- key: "toolbarSlideUp",
- value: function toolbarSlideUp() {
- var that = this;
- var height = this.toolbar.offsetHeight;
- var id = setInterval(frame, 5);
-
- function frame() {
- if (height >= 40) {
- that.options.onToolbarSend && (that.toolbarSend.style.display = "flex");
- that.toolbarOptionsGroup.style.display = "flex";
- clearInterval(id);
- } else {
- height++;
- that.toolbar.style.minHeight = "".concat(height, "px");
- }
- }
- }
- }, {
- key: "toolbarSlideDown",
- value: function toolbarSlideDown() {
- var that = this;
- this.options.onToolbarSend && (this.toolbarSend.style.display = "none");
- this.toolbarOptionsGroup.style.display = "none";
- var height = 40;
- var id = setInterval(frame, 5);
-
- function frame() {
- if (height === 0) {
- clearInterval(id);
- } else {
- height--;
- that.toolbar.style.minHeight = "".concat(height, "px");
- }
- }
- }
- }, {
- key: "initToolbar",
- value: function initToolbar() {
- var _this2 = this;
-
- var toolbar = document.createElement("div");
- this.toolbarOptionsGroup = document.createElement("div");
- var groups = Object.keys(this.optionGroups);
- toolbar.classList.add("toolbar");
- toolbar.style.display = "flex";
- toolbar.style.justifyContent = "space-between";
- toolbar.style.alignItems = "center";
- toolbar.style.flexWrap = "wrap";
- toolbar.style.minHeight = this.options.toolbarHide ? "0" : "40px";
- toolbar.style.position = "relative";
- this.toolbarOptionsGroup.classList.add("toolbar-options");
- this.toolbarOptionsGroup.style.margin = "0 10px";
- this.toolbarOptionsGroup.style.display = this.options.toolbarHide ? "none" : "flex"; //iterate groups
-
- groups.forEach(function (group) {
- // add menu to toolbarOptions
- var toolbarMenu = document.createElement("div"); // const toolbarMenuIcon = document.createElement("i");
-
- toolbarMenu.classList.add("toolbar-menu");
- toolbarMenu.id = "menu-".concat(group); // toolbarMenuIcon.classList.add(this.options.fontPack);
- // toolbarMenuIcon.classList.add(this.optionGroups[group].menu);
-
- toolbarMenu.appendChild(_this2.constructSVG(_this2.optionGroups[group].menu));
-
- _this2.toolbarOptionsGroup.appendChild(toolbarMenu); // add group to toolbarOptions
-
-
- var toolbarGroup = document.createElement("div");
- toolbarGroup.classList.add("toolbar-group");
- toolbarGroup.id = "group-".concat(group);
-
- _this2.options.toolbarOptions.forEach(function (option) {
- var toolbarOption = _this2.optionGroups[group].group.filter(function (group) {
- return group[option];
- })[0];
-
- if (toolbarOption) {
- var svgData = toolbarOption[option];
-
- var optionSpan = _this2.constructSVG(svgData);
-
- optionSpan.id = "toolbar-".concat(option);
- optionSpan.style.margin = "0 10px";
- toolbarGroup.appendChild(optionSpan);
- }
- });
-
- _this2.toolbarOptionsGroup.appendChild(toolbarGroup); // this.optionGroups[group].group.forEach((option) => {
- // const toolbarCommand = Object.keys(option)[0];
- // if(this.options.toolbarOptions.includes(toolbarCommand)){
- // const optionSpan = this.constructSVG(option[toolbarCommand]);
- // // const optionIcon = document.createElement("i");
- // optionSpan.id = `toolbar-${toolbarCommand}`;
- // optionSpan.style.margin = "0 10px";
- // // optionIcon.classList.add(this.options.fontPack);
- // // optionIcon.classList.add(option[toolbarCommand]);
- // // optionSpan.appendChild(optionIcon);
- // toolbarGroup.appendChild(optionSpan);
- // }
- // })
- // this.toolbarOptionsGroup.appendChild(toolbarGroup);
-
- }); // toolbar group for custom options
-
- var customOptions = this.options.toolbarOptions.filter(function (option) {
- return _typeof(option) === "object";
- });
-
- if (customOptions.length > 0) {
- this.customToolbarMenu = document.createElement("div");
- this.customToolbarMenu.classList.add("toolbar-menu");
- this.customToolbarMenu.id = "menu-custom";
- var customSVGViewBox = "0 0 1792 1792";
- var customSVGD = "M1088 1248v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68z";
- this.customToolbarMenu.appendChild(this.constructSVG({
- viewBox: customSVGViewBox,
- d: customSVGD
- }));
- this.toolbarOptionsGroup.appendChild(this.customToolbarMenu);
- this.customToolbarGroup = document.createElement("div");
- this.customToolbarGroup.classList.add("toolbar-group");
- this.customToolbarGroup.id = "group-custom";
- customOptions.forEach(function (customOption) {
- var icon = customOption.icon,
- handler = customOption.handler;
-
- var optionSpan = _this2.constructSVG(icon);
-
- optionSpan.id = "toolbar-customOption";
- optionSpan.style.margin = "0 10px";
-
- optionSpan.onclick = function () {
- return handler();
- };
-
- _this2.customToolbarGroup.appendChild(optionSpan);
- });
- this.toolbarOptionsGroup.appendChild(this.customToolbarGroup);
- }
-
- toolbar.appendChild(this.toolbarOptionsGroup); //add toolbar-send
-
- var toolbarSend = document.createElement("div"); // const toolbarSendIcon = document.createElement("i");
-
- toolbarSend.id = "toolbar-send"; // toolbarSendIcon.classList.add(this.options.fontPack);
- // toolbarSendIcon.classList.add("fa-paper-plane");
-
- toolbarSend.style.display = "none";
- toolbarSend.style.color = "#fff";
- toolbarSend.style.backgroundColor = "#5cb85c";
- toolbarSend.style.minHeight = this.options.toolbarHide ? "40px" : this.toolbar.style.minHeight;
- toolbarSend.style.width = "50px";
- toolbarSend.style.textAlign = "center";
- toolbarSend.style.justifyContent = "center";
- toolbarSend.style.alignContent = "center";
- toolbarSend.style.alignItems = "center";
- toolbarSend.style.cursor = "pointer";
- toolbarSend.style.border = "1px solid #4cae4c";
- toolbarSend.style.alignSelf = "flex-end";
- this.options.onToolbarSend && (toolbarSend.onclick = function () {
- return _this2.options.onToolbarSend();
- });
- this.options.onToolbarSend && !this.options.toolbarHide && (toolbarSend.style.display = "flex");
-
- toolbarSend.onmouseenter = function () {
- return toolbarSend.style.backgroundColor = "#4cae4c";
- };
-
- toolbarSend.onmouseleave = function () {
- return toolbarSend.style.backgroundColor = "#5cb85c";
- };
-
- var toolbarSendSVG = this.constructSVG({
- viewBox: "0 0 1792 1792",
- d: "M1764 11q33 24 27 64l-256 1536q-5 29-32 45-14 8-31 8-11 0-24-5l-453-185-242 295q-18 23-49 23-13 0-22-4-19-7-30.5-23.5t-11.5-36.5v-349l864-1059-1069 925-395-162q-37-14-40-55-2-40 32-59l1664-960q15-9 32-9 20 0 36 11z"
- });
- toolbarSendSVG.querySelector('path').setAttribute("fill", "#fff");
- toolbarSend.appendChild(toolbarSendSVG);
- toolbar.appendChild(toolbarSend);
- this.toolbarOptions = toolbar.querySelectorAll("span");
- this.toolbarGroups = _toConsumableArray(toolbar.getElementsByClassName("toolbar-group"));
- this.toolbarMenus = _toConsumableArray(toolbar.getElementsByClassName("toolbar-menu"));
- this.toolbarSend = toolbar.querySelector("#toolbar-send");
- this.toolbarMenus.push(this.customToolbarMenu);
- this.toolbarGroups.push(this.customToolbarGroup); // Remove menu that has no options enabled
-
- this.toolbarGroups.forEach(function (group) {
- if (group.children.length < 1) {
- var groupName = group.id.split("-")[1];
-
- var menu = _this2.toolbarMenus.filter(function (menu) {
- return menu.id.split("-")[1] === groupName;
- })[0];
-
- menu.remove();
- }
- });
- return toolbar;
- }
- }, {
- key: "initBody",
- value: function initBody() {
- var _this3 = this;
+/******/ ({
- var body = document.createElement("div");
- body.classList.add("body");
- body.contentEditable = "true";
- body.style.outline = "none";
- body.style.padding = "10px 20px";
- body.style.height = this.editor.style.height;
- body.style.minHeight = this.editor.style.minHeight;
- body.style.maxHeight = this.editor.style.maxHeight; // Paste Handler
-
- body.onpaste = function (e) {
- function dataURLtoFile(dataurl, filename) {
- var arr = dataurl.split(','),
- mime = arr[0].match(/:(.*?);/)[1],
- bstr = atob(arr[1]),
- n = bstr.length,
- u8arr = new Uint8Array(n);
-
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n);
- }
-
- var file = new File([u8arr], filename, {
- type: mime
- });
- return new File([u8arr], "".concat(file.name, ".").concat(file.type.split('/').pop()), {
- type: file.type
- });
- }
-
- var convertImage = function convertImage(file) {
- return new Promise(function (resolve, reject) {
- var reader = new FileReader();
- reader.readAsDataURL(file);
-
- reader.onload = function () {
- return resolve(reader.result);
- };
-
- reader.onerror = function (error) {
- return reject(error);
- };
- });
- };
-
- if (e.clipboardData.files.length > 0 && e.clipboardData.files[0].type.includes("image")) {
- convertImage(e.clipboardData.files[0]).then(function (res) {
- document.execCommand("insertImage", true, res);
- _this3.options.uploadOnPaste && _this3.attachFile(dataURLtoFile(res, "pastedimage"));
-
- _this3.overflow();
- });
- }
-
- if (e.clipboardData.items.length > 0 && e.clipboardData.items[0].type === "text/plain") {
- e.clipboardData.items[0].getAsString(function (string) {
- if (_this3.options.metaUrl && _this3.validURL(string)) {
- _this3.getMeta(string).then(function (res) {
- var url = res.url,
- title = res.title,
- image = res.image,
- description = res.description;
- url && title && image && _this3.createMetaDataElement(url, image, title, description);
- });
- }
- });
- }
-
- _this3.overflow();
- };
-
- return body;
- }
- }, {
- key: "initLinkMenu",
- value: function initLinkMenu() {
- var _this4 = this;
-
- var linkMenu = document.createElement("div");
- var linkMenuForm = document.createElement("div");
- var linkMenuButton = document.createElement("button");
- var linkMenuFormLabel = document.createElement("p");
- var linkMenuFormInput = document.createElement("input");
- linkMenu.id = "link-menu";
- linkMenuButton.textContent = "Insert Link";
- linkMenuFormLabel.textContent = "Web Address";
- linkMenuFormInput.type = "text";
- linkMenuFormLabel.style.margin = "8px 10px 8px 0";
- linkMenuFormLabel.style.fontSize = "14px";
- linkMenuButton.style.cursor = "pointer";
- linkMenu.dataset.active = "false";
- linkMenu.style.display = "none";
- linkMenu.style.position = "absolute";
- linkMenu.style.right = "10px";
- linkMenu.style.bottom = "10px";
- linkMenu.style.backgroundColor = "#fff";
- linkMenu.style.border = "2px solid #ddd";
- linkMenu.style.padding = "10px 20px";
- linkMenu.style.zIndex = "1000";
- linkMenuFormLabel.style.width = "100%";
- linkMenuFormLabel.style.textAlign = "right";
- linkMenuFormLabel.style.marginRight = "10px";
- linkMenuFormInput.style.outline = "none";
- linkMenuFormInput.style.padding = "0 5px";
- linkMenuFormInput.placeholder = "Insert a Link";
- linkMenuForm.style.display = "flex";
- linkMenuForm.style.justifyContent = "space-between";
- linkMenuForm.style.margin = "5px 0";
- linkMenuButton.style["float"] = "right";
- linkMenuButton.style.padding = "6px 12px";
- linkMenuButton.style.border = "1px solid #4cae4c";
- linkMenuButton.style.backgroundColor = "#5cb85c";
- linkMenuButton.style.fontSize = "14px";
- linkMenuButton.style.color = "#fff";
- linkMenuButton.style.outline = "none";
-
- linkMenuButton.onmouseenter = function () {
- return linkMenuButton.style.backgroundColor = "#4cae4c";
- };
-
- linkMenuButton.onmouseleave = function () {
- return linkMenuButton.style.backgroundColor = "#5cb85c";
- };
-
- linkMenuButton.onclick = function (e) {
- var linkValue = linkMenuFormInput.value;
-
- if (linkValue) {
- window.getSelection().removeAllRanges();
- window.getSelection().addRange(_this4.range);
- document.execCommand("createLink", true, linkValue);
-
- if (_this4.options.metaUrl && _this4.validURL(linkValue)) {
- _this4.getMeta(linkValue).then(function (res) {
- var url = res.url,
- image = res.image,
- title = res.title,
- description = res.description;
- url && image && title && _this4.createMetaDataElement(url, image, title, description);
- });
- }
-
- var bodyLinks = _this4.body.querySelectorAll("a");
-
- bodyLinks[bodyLinks.length - 1].contentEditable = "false";
- linkMenuFormInput.value = "";
-
- _this4.toolbar.querySelector("#toolbar-link").onclick();
- } else {
- _this4.body.focus();
-
- _this4.closeLinkMenu();
- }
- };
-
- linkMenuForm.appendChild(linkMenuFormLabel);
- linkMenuForm.appendChild(linkMenuFormInput);
- linkMenu.appendChild(linkMenuForm);
- linkMenu.appendChild(linkMenuButton);
- return linkMenu;
- }
- }, {
- key: "initImageMenu",
- value: function initImageMenu() {
- var _this5 = this;
-
- var imageMenu = document.createElement("div");
- var imageMenuForm = document.createElement("div");
- var imageMenuButton = document.createElement("button");
- var imageMenuFormLabel = document.createElement("p");
- var imageMenuFormSourceInput = document.createElement("input");
- imageMenu.id = "image-menu";
- imageMenuButton.textContent = "Insert Image";
- imageMenuFormLabel.textContent = "Image URL";
- imageMenuFormSourceInput.type = "text";
- imageMenuFormLabel.style.margin = "8px 10px 8px 0";
- imageMenuFormLabel.style.fontSize = "14px";
- imageMenuButton.style.cursor = "pointer";
- imageMenu.dataset.active = "false";
- imageMenu.style.display = "none";
- imageMenu.style.position = "absolute";
- imageMenu.style.right = "10px";
- imageMenu.style.bottom = "10px";
- imageMenu.style.backgroundColor = "#fff";
- imageMenu.style.border = "2px solid #ddd";
- imageMenu.style.padding = "10px 20px";
- imageMenu.style.zIndex = "1000";
- imageMenuFormLabel.style.width = "100%";
- imageMenuFormLabel.style.textAlign = "right";
- imageMenuFormLabel.style.marginRight = "10px";
- imageMenuFormSourceInput.style.outline = "none";
- imageMenuFormSourceInput.style.padding = "0 5px";
- imageMenuFormSourceInput.placeholder = "Insert a Link";
- imageMenuForm.style.display = "flex";
- imageMenuForm.style.justifyContent = "space-between";
- imageMenuForm.style.margin = "5px 0";
- imageMenuButton.style["float"] = "right";
- imageMenuButton.style.padding = "6px 12px";
- imageMenuButton.style.border = "1px solid #4cae4c";
- imageMenuButton.style.backgroundColor = "#5cb85c";
- imageMenuButton.style.fontSize = "14px";
- imageMenuButton.style.color = "#fff";
- imageMenuButton.style.outline = "none";
-
- imageMenuButton.onmouseenter = function () {
- return imageMenuButton.style.backgroundColor = "#4cae4c";
- };
-
- imageMenuButton.onmouseleave = function () {
- return imageMenuButton.style.backgroundColor = "#5cb85c";
- };
-
- imageMenuForm.appendChild(imageMenuFormLabel);
- imageMenuForm.appendChild(imageMenuFormSourceInput); // Height Input Form
-
- var imageMenuHeightForm = imageMenuForm.cloneNode(true);
- var imageMenuHeightFormInput = imageMenuHeightForm.querySelector('input');
- var imageMenuHeightFormLabel = imageMenuHeightForm.querySelector('p');
- imageMenuHeightFormInput.placeholder = "Image Height";
- imageMenuHeightFormLabel.textContent = "Height"; // Width Input Form
-
- var imageMenuWidthForm = imageMenuForm.cloneNode(true);
- var imageMenuWidthFormInput = imageMenuWidthForm.querySelector('input');
- var imageMenuWidthFormLabel = imageMenuWidthForm.querySelector('p');
- imageMenuWidthFormInput.placeholder = "Image Height";
- imageMenuWidthFormLabel.textContent = "Width";
-
- imageMenuButton.onclick = function (e) {
- var linkValue = imageMenuFormSourceInput.value;
- var heightValue = imageMenuHeightFormInput.value;
- var widthValue = imageMenuWidthFormInput.value;
-
- if (linkValue) {
- window.getSelection().removeAllRanges();
- window.getSelection().addRange(_this5.range);
- document.execCommand("insertImage", true, linkValue);
-
- var imageTags = _this5.body.querySelectorAll("img");
-
- imageTags[imageTags.length - 1].style.height = "".concat(heightValue, "px");
- imageTags[imageTags.length - 1].style.width = "".concat(widthValue, "px");
- imageMenuHeightFormInput.value = "";
- imageMenuWidthFormInput.value = "";
- imageMenuFormSourceInput.value = "";
-
- _this5.toolbar.querySelector("#toolbar-image").onclick();
- } else {
- _this5.body.focus();
-
- _this5.closeImageMenu();
- }
- };
-
- imageMenu.appendChild(imageMenuHeightForm);
- imageMenu.appendChild(imageMenuWidthForm);
- imageMenu.appendChild(imageMenuForm);
- imageMenu.appendChild(imageMenuButton);
- return imageMenu;
- }
- }, {
- key: "initMetaDataSection",
- value: function initMetaDataSection() {
- var metaDataSection = document.createElement("div");
- metaDataSection.classList.add("metadata-section");
- metaDataSection.style.display = "flex";
- metaDataSection.style.flexWrap = "wrap";
- metaDataSection.style.zIndex = "500";
- return metaDataSection;
- }
- }, {
- key: "initFilesSection",
- value: function initFilesSection() {
- var _this6 = this;
-
- var filesSection = document.createElement("div");
- filesSection.classList.add("files-section");
- filesSection.style.display = "flex";
- filesSection.style.flexWrap = "wrap";
- filesSection.style.zIndex = "500";
-
- this.body.ondragenter = function (e) {
- _this6.body.style.backgroundColor = "#ddd";
- };
-
- this.body.ondragleave = function (e) {
- _this6.body.style.backgroundColor = "inherit";
- };
-
- this.body.ondrop = function (e) {
- _this6.body.style.backgroundColor = "inherit";
- e.preventDefault();
- var file = e.dataTransfer.files && e.dataTransfer.files[0];
-
- _this6.attachFile(file);
- };
-
- this.editor.getfiles = function () {
- return _this6.getFiles();
- };
-
- return filesSection;
- }
- }, {
- key: "createFileElement",
- value: function createFileElement(name, size) {
- var _this7 = this;
-
- var fileEl = document.createElement("div");
- var fileNameEl = document.createElement("h4");
- var fileSizeEl = document.createElement("p");
- var removeFileEl = document.createElement("p");
- fileNameEl.textContent = name;
- fileSizeEl.textContent = size;
- removeFileEl.textContent = "X";
- fileEl.dataset.fileindex = this.files.length - 1;
- fileEl.style.width = "100%";
- fileEl.style.display = "flex";
- fileEl.style.flexDirection = "column";
- fileEl.style.margin = "10px";
- fileEl.style.position = "relative";
- fileNameEl.style.fontWeight = "bold";
- fileNameEl.style.margin = "0";
- fileSizeEl.style.fontSize = "12px";
- fileSizeEl.style.margin = "2px 0";
- removeFileEl.style.margin = "0";
- removeFileEl.style.userSelect = "none";
- removeFileEl.style.color = "black";
- removeFileEl.style.position = "absolute";
- removeFileEl.style.right = "5px";
- removeFileEl.style.top = "-5px";
- removeFileEl.style.cursor = "pointer";
- removeFileEl.style.backgroundColor = "#fff";
-
- removeFileEl.onmouseenter = function () {
- return removeFileEl.style.color = "#ddd";
- };
-
- removeFileEl.onmouseleave = function () {
- return removeFileEl.style.color = "black";
- };
-
- removeFileEl.onclick = function (e) {
- _this7.files.splice(e.target.parentElement.dataset.fileindex, 1);
-
- e.target.parentElement.remove();
- };
-
- fileEl.appendChild(fileNameEl);
- fileEl.appendChild(fileSizeEl);
- fileEl.appendChild(removeFileEl);
- this.filesSection.appendChild(fileEl);
-
- this.editor.getfiles = function () {
- return _this7.getFiles();
- };
- }
- }, {
- key: "createMetaDataElement",
- value: function createMetaDataElement(url, img, title, description) {
- var metaItemEl = document.createElement("div");
- var metaLinkEl = document.createElement("a");
- var metaImageEl = document.createElement("img");
- var metaDataEl = document.createElement("div");
- var metaDataTitleEl = document.createElement("h4");
- var metaDataDescriptionEl = document.createElement("p");
- var removeMetaDataEl = document.createElement("span");
- metaLinkEl.href = url;
- metaImageEl.src = img;
- metaDataTitleEl.textContent = title;
- metaDataDescriptionEl.textContent = description;
- removeMetaDataEl.textContent = "X";
- metaLinkEl.target = "blank";
- metaItemEl.style.width = "100%";
- metaItemEl.style.display = "flex";
- metaItemEl.style.margin = "10px";
- metaItemEl.style.position = "relative";
- metaImageEl.style.marginRight = "10px";
- metaImageEl.style.height = "50px";
- metaImageEl.style.width = "75px";
- metaDataTitleEl.style.fontWeight = "bold";
- metaDataTitleEl.style.margin = "0";
- metaDataDescriptionEl.style.margin = "0";
- removeMetaDataEl.style.userSelect = "none";
- removeMetaDataEl.style.color = "black";
- removeMetaDataEl.style.position = "absolute";
- removeMetaDataEl.style.right = "5px";
- removeMetaDataEl.style.top = "-5px";
- removeMetaDataEl.style.cursor = "pointer";
- removeMetaDataEl.style.backgroundColor = "#fff";
-
- removeMetaDataEl.onmouseenter = function () {
- return removeMetaDataEl.style.color = "#ddd";
- };
-
- removeMetaDataEl.onmouseleave = function () {
- return removeMetaDataEl.style.color = "black";
- };
-
- removeMetaDataEl.onclick = function (e) {
- return e.target.parentElement.remove();
- };
-
- metaLinkEl.appendChild(metaImageEl);
- metaDataEl.appendChild(metaDataTitleEl);
- metaDataEl.appendChild(metaDataDescriptionEl);
- metaItemEl.appendChild(metaLinkEl);
- metaItemEl.appendChild(metaDataEl);
- metaItemEl.appendChild(removeMetaDataEl);
- this.metaDataSection.appendChild(metaItemEl);
- }
- }, {
- key: "constructSVG",
- value: function constructSVG(svgData) {
- var viewBox = svgData.viewBox,
- d = svgData.d;
- var fillColor = this.options.toolbarOptionFillColor ? this.options.toolbarOptionFillColor : "#333";
- var xmlns = "http://www.w3.org/2000/svg";
- var height = "16";
- var width = "16";
- var icon = document.createElement('span');
- var svg = "<svg width=\"".concat(width, "\" height=\"").concat(height, "\" viewBox=\"").concat(viewBox, "\" xmlns=\"").concat(xmlns, "\">");
- var path = "<path fill=\"".concat(fillColor, "\" d=\"").concat(d, "\"/>");
- icon.innerHTML = "".concat(svg).concat(path, "</svg>");
- return icon;
- }
- }, {
- key: "initResponsive",
- value: function initResponsive() {
- var _this8 = this;
-
- var that = this;
-
- if (!this.options.minimal) {
- var responsiveGroups = function responsiveGroups(isResponsive) {
- that.toolbarGroups.forEach(function (group) {
- group.dataset.open = "false";
- group.style.display = isResponsive ? "none" : "block";
- group.style.position = isResponsive ? "absolute" : "relative";
- group.style.bottom = isResponsive ? "5px" : "inherit";
- group.style.right = isResponsive ? "5px" : "inherit";
- group.style.backgroundColor = isResponsive ? "#fff" : "inherit";
- group.style.border = isResponsive ? "2px solid #ddd" : "none";
- });
- that.toolbarMenus.forEach(function (menu) {
- function toggleMenu() {
- var selectedGroup = that.toolbar.querySelector("#group-".concat(menu.id.split("-")[1]));
-
- if (selectedGroup.dataset.open === "false") {
- // close opened groups
- that.toolbarGroups.forEach(function (group) {
- if (group.dataset.open === "true") {
- group.style.display = "none";
- group.dataset.open = "false";
- }
- }); // open group
-
- selectedGroup.style.display = "block";
- selectedGroup.style.padding = "5px";
- selectedGroup.dataset.open = "true";
- } else {
- selectedGroup.style.display = "none";
- selectedGroup.dataset.open = "false";
- }
- }
-
- menu.style.padding = "0 10px";
- menu.style.cursor = "pointer";
- menu.style.userSelect = "none";
- menu.style.display = isResponsive ? "block" : "none";
-
- menu.onclick = function (e) {
- toggleMenu();
- that.body.focus();
- };
- });
- };
-
- var setResponsive = function setResponsive() {
- responsive = window.matchMedia("(max-width: 700px)").matches;
- responsiveGroups(responsive);
- };
-
- var responsive = window.matchMedia("(max-width: 700px)").matches;
- setResponsive();
-
- window.onresize = function () {
- _this8.toolbarGroups.forEach(function (group) {
- return group.style.padding = "0";
- });
-
- _this8.closeLinkMenu();
-
- _this8.closeImageMenu();
-
- setResponsive();
- };
- } else {
- this.toolbarMenus.forEach(function (menu) {
- return menu.style.display = "none";
- });
- this.toolbar.querySelector("#toolbar-strikethrough").style.display = "none";
- this.toolbar.querySelector("#toolbar-image").style.display = "none";
- this.toolbar.querySelector("#toolbar-insertOrderedList").style.display = "none";
- this.toolbar.querySelector("#group-textAlign").style.display = "none";
- }
- }
- }, {
- key: "initOverflow",
- value: function initOverflow() {
- var _this9 = this;
-
- var onFocus = this.body.onfocus;
-
- this.body.onfocus = function () {
- onFocus && onFocus();
-
- _this9.overflow();
- };
-
- var onBlur = this.body.onblur;
-
- this.body.onblur = function () {
- onBlur && onBlur();
-
- _this9.overflow();
- };
-
- this.body.onkeypress = function () {
- return _this9.overflow();
- };
- }
- }, {
- key: "getFiles",
- value: function getFiles() {
- return this.files;
- }
- }, {
- key: "getContent",
- value: function getContent() {
- return this.body.innerHTML;
- }
- }, {
- key: "getRange",
- value: function getRange() {
- return window.getSelection().getRangeAt(0);
- }
- }, {
- key: "getMeta",
- value: function getMeta(url) {
- return fetch(this.options.metaUrl, {
- method: "POST",
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- targetUrl: url
- })
- }).then(function (res) {
- return res.json();
- });
- }
- }, {
- key: "validURL",
- value: function validURL(str) {
- var pattern = new RegExp("^(https?:\\/\\/)?" + "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + "((\\d{1,3}\\.){3}\\d{1,3}))" + "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + "(\\?[;&a-z\\d%_.~+=-]*)?" + "(\\#[-a-z\\d_]*)?$", "i");
- return !!pattern.test(str);
- }
- }, {
- key: "overflow",
- value: function overflow() {
- var body = this.body;
- body.scrollHeight > body.clientHeight ? body.style.overflowY = "scroll" : body.style.overflowY = "hidden";
- body.scrollWidth > body.clientWidth ? body.style.overflowX = "scroll" : body.style.overflowX = "hidden";
- }
- }, {
- key: "formatBytes",
- value: function formatBytes(bytes) {
- var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
- if (bytes === 0) return '0 Bytes';
- var k = 1024;
- var dm = decimals < 0 ? 0 : decimals;
- var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
- var i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
- }
- }, {
- key: "validateFile",
- value: function validateFile(file) {
- var extension = file.type.split('/').pop();
- return this.options.extensions.includes(".".concat(extension));
- }
- }, {
- key: "attachFile",
- value: function attachFile(file) {
- if (this.validateFile(file)) {
- this.files.push(file);
- this.createFileElement(file.name, this.formatBytes(file.size));
- } else {
- this.fileInvalid();
- }
- }
- }, {
- key: "fileInvalid",
- value: function fileInvalid() {
- var _this10 = this;
-
- this.body.style.transition = "background-color .5s";
- this.body.style.backgroundColor = "#d9534f";
- setTimeout(function () {
- _this10.body.style.backgroundColor = "inherit";
- setTimeout(function () {
- return _this10.body.style.transition = "none";
- }, 500);
- }, 500);
- }
- }, {
- key: "openLinkMenu",
- value: function openLinkMenu() {
- this.closeImageMenu();
- this.linkMenu.dataset.active = "true";
- this.linkMenu.style.display = "block";
- }
- }, {
- key: "openImageMenu",
- value: function openImageMenu() {
- this.closeLinkMenu();
- this.imageMenu.dataset.active = "true";
- this.imageMenu.style.display = "block";
- }
- }, {
- key: "closeLinkMenu",
- value: function closeLinkMenu() {
- this.linkMenu.dataset.active = "false";
- this.linkMenu.style.display = "none";
- }
- }, {
- key: "closeImageMenu",
- value: function closeImageMenu() {
- this.imageMenu.dataset.active = "false";
- this.imageMenu.style.display = "none";
- }
- }, {
- key: "setContent",
- value: function setContent(html) {
- this.body.innerHTML = html;
- }
- }]);
-
- return StrivenEditor;
- }();
+/***/ "./src/index.js":
+/*!**********************!*\
+ !*** ./src/index.js ***!
+ \**********************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
- _exports["default"] = StrivenEditor;
-});
+eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! ./striveneditor */ \"./src/striveneditor.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else { var mod; }\n})(this, function (_exports, _striveneditor) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n Object.defineProperty(_exports, \"StrivenEditor\", {\n enumerable: true,\n get: function get() {\n return _striveneditor[\"default\"];\n }\n });\n _striveneditor = _interopRequireDefault(_striveneditor);\n\n function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n});\n\n//# sourceURL=webpack://striveneditor/./src/index.js?");
/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
-})(this, function (_exports, _striveneditor) {
- "use strict";
- Object.defineProperty(_exports, "__esModule", {
- value: true
- });
- Object.defineProperty(_exports, "StrivenEditor", {
- enumerable: true,
- get: function get() {
- return _striveneditor["default"];
- }
- });
- _striveneditor = _interopRequireDefault(_striveneditor);
+/***/ "./src/striveneditor.js":
+/*!******************************!*\
+ !*** ./src/striveneditor.js ***!
+ \******************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
-});
+eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else { var mod; }\n})(this, function (_exports) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n _exports[\"default\"] = void 0;\n\n function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\n function _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\n function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\n function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\n function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\n function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n // Font Awesome Imports\n // import { dom } from '@fortawesome/fontawesome-svg-core';\n // import { library as faLib } from \"@fortawesome/fontawesome-svg-core\";\n // import { faFont } from \"@fortawesome/free-solid-svg-icons/faFont\";\n // import { faBold } from \"@fortawesome/free-solid-svg-icons/faBold\";\n // import { faItalic } from \"@fortawesome/free-solid-svg-icons/faItalic\";\n // import { faUnderline } from \"@fortawesome/free-solid-svg-icons/faUnderline\";\n // import { faStrikethrough } from \"@fortawesome/free-solid-svg-icons/faStrikethrough\";\n // import { faList } from \"@fortawesome/free-solid-svg-icons/faList\";\n // import { faListOl } from \"@fortawesome/free-solid-svg-icons/faListOl\";\n // import { faListUl } from \"@fortawesome/free-solid-svg-icons/faListUl\";\n // import { faAlignJustify } from \"@fortawesome/free-solid-svg-icons/faAlignJustify\";\n // import { faIndent } from \"@fortawesome/free-solid-svg-icons/faIndent\";\n // import { faAlignLeft } from \"@fortawesome/free-solid-svg-icons/faAlignLeft\";\n // import { faAlignCenter } from \"@fortawesome/free-solid-svg-icons/faAlignCenter\";\n // import { faAlignRight } from \"@fortawesome/free-solid-svg-icons/faAlignRight\";\n // import { faPaperclip } from \"@fortawesome/free-solid-svg-icons/faPaperclip\";\n // import { faLink } from \"@fortawesome/free-solid-svg-icons/faLink\";\n // import { faImage } from \"@fortawesome/free-solid-svg-icons/faImage\";\n // import { faPaperPlane } from \"@fortawesome/free-solid-svg-icons/faPaperPlane\";\n // faLib.add(faFont);\n // faLib.add(faBold);\n // faLib.add(faItalic);\n // faLib.add(faUnderline);\n // faLib.add(faStrikethrough);\n // faLib.add(faList);\n // faLib.add(faListOl);\n // faLib.add(faListUl);\n // faLib.add(faAlignJustify);\n // faLib.add(faIndent);\n // faLib.add(faAlignLeft);\n // faLib.add(faAlignCenter);\n // faLib.add(faAlignRight);\n // faLib.add(faPaperclip);\n // faLib.add(faLink);\n // faLib.add(faImage);\n // faLib.add(faPaperPlane);\n // dom.watch();\n var EXTENSIONS = [\".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".pdf\", \".tif\", \".jpeg\", \".jpg\", \".gif\", \".bmp\", \".txt\", \".csv\", \".png\", \".msg\", \".wav\", \".mp3\", \".mp4\", \".zip\", \".rtf\", \".eps\", \".ai\", \".psd\", \".avi\", \".mov\", \".wmv\", \".cfg\", \".wss\", \".vsd\", \".vsdx\", \".tsd\", \".lic\"];\n var FONTPACK = \"fas\";\n var OPTIONGROUPS = {\n textDecoration: {\n menu: {\n viewBox: \"0 0 1792 1792\",\n d: \"M789 559l-170 450q33 0 136.5 2t160.5 2q19 0 57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29 31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15 34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5 13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0 12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11 2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0 22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58 0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z\"\n },\n group: [{\n bold: {\n viewBox: \"0 0 1792 1792\",\n d: \"M747 1521q74 32 140 32 376 0 376-335 0-114-41-180-27-44-61.5-74t-67.5-46.5-80.5-25-84-10.5-94.5-2q-73 0-101 10 0 53-.5 159t-.5 158q0 8-1 67.5t-.5 96.5 4.5 83.5 12 66.5zm-14-746q42 7 109 7 82 0 143-13t110-44.5 74.5-89.5 25.5-142q0-70-29-122.5t-79-82-108-43.5-124-14q-50 0-130 13 0 50 4 151t4 152q0 27-.5 80t-.5 79q0 46 1 69zm-541 889l2-94q15-4 85-16t106-27q7-12 12.5-27t8.5-33.5 5.5-32.5 3-37.5.5-34v-65.5q0-982-22-1025-4-8-22-14.5t-44.5-11-49.5-7-48.5-4.5-30.5-3l-4-83q98-2 340-11.5t373-9.5q23 0 68 .5t68 .5q70 0 136.5 13t128.5 42 108 71 74 104.5 28 137.5q0 52-16.5 95.5t-39 72-64.5 57.5-73 45-84 40q154 35 256.5 134t102.5 248q0 100-35 179.5t-93.5 130.5-138 85.5-163.5 48.5-176 14q-44 0-132-3t-132-3q-106 0-307 11t-231 12z\"\n }\n }, {\n italic: {\n viewBox: \"0 0 1792 1792\",\n d: \"M384 1662l17-85q22-7 61.5-16.5t72-19 59.5-23.5q28-35 41-101 1-7 62-289t114-543.5 52-296.5v-25q-24-13-54.5-18.5t-69.5-8-58-5.5l19-103q33 2 120 6.5t149.5 7 120.5 2.5q48 0 98.5-2.5t121-7 98.5-6.5q-5 39-19 89-30 10-101.5 28.5t-108.5 33.5q-8 19-14 42.5t-9 40-7.5 45.5-6.5 42q-27 148-87.5 419.5t-77.5 355.5q-2 9-13 58t-20 90-16 83.5-6 57.5l1 18q17 4 185 31-3 44-16 99-11 0-32.5 1.5t-32.5 1.5q-29 0-87-10t-86-10q-138-2-206-2-51 0-143 9t-121 11z\"\n }\n }, {\n underline: {\n viewBox: \"0 0 1792 1792\",\n d: \"M176 223q-37-2-45-4l-3-88q13-1 40-1 60 0 112 4 132 7 166 7 86 0 168-3 116-4 146-5 56 0 86-2l-1 14 2 64v9q-60 9-124 9-60 0-79 25-13 14-13 132 0 13 .5 32.5t.5 25.5l1 229 14 280q6 124 51 202 35 59 96 92 88 47 177 47 104 0 191-28 56-18 99-51 48-36 65-64 36-56 53-114 21-73 21-229 0-79-3.5-128t-11-122.5-13.5-159.5l-4-59q-5-67-24-88-34-35-77-34l-100 2-14-3 2-86h84l205 10q76 3 196-10l18 2q6 38 6 51 0 7-4 31-45 12-84 13-73 11-79 17-15 15-15 41 0 7 1.5 27t1.5 31q8 19 22 396 6 195-15 304-15 76-41 122-38 65-112 123-75 57-182 89-109 33-255 33-167 0-284-46-119-47-179-122-61-76-83-195-16-80-16-237v-333q0-188-17-213-25-36-147-39zm1488 1409v-64q0-14-9-23t-23-9h-1472q-14 0-23 9t-9 23v64q0 14 9 23t23 9h1472q14 0 23-9t9-23z\"\n }\n }, {\n strikethrough: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1760 896q14 0 23 9t9 23v64q0 14-9 23t-23 9h-1728q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h1728zm-1277-64q-28-35-51-80-48-98-48-188 0-181 134-309 133-127 393-127 50 0 167 19 66 12 177 48 10 38 21 118 14 123 14 183 0 18-5 45l-12 3-84-6-14-2q-50-149-103-205-88-91-210-91-114 0-182 59-67 58-67 146 0 73 66 140t279 129q69 20 173 66 58 28 95 52h-743zm507 256h411q7 39 7 92 0 111-41 212-23 56-71 104-37 35-109 81-80 48-153 66-80 21-203 21-114 0-195-23l-140-40q-57-16-72-28-8-8-8-22v-13q0-108-2-156-1-30 0-68l2-37v-44l102-2q15 34 30 71t22.5 56 12.5 27q35 57 80 94 43 36 105 57 59 22 132 22 64 0 139-27 77-26 122-86 47-61 47-129 0-84-81-157-34-29-137-71z\"\n }\n }]\n },\n listOptions: {\n menu: {\n viewBox: \"0 0 1792 1792\",\n d: \"M256 1312v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm-1536-1152v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5z\"\n },\n group: [{\n insertOrderedList: {\n viewBox: \"0 0 1792 1792\",\n d: \"M381 1620q0 80-54.5 126t-135.5 46q-106 0-172-66l57-88q49 45 106 45 29 0 50.5-14.5t21.5-42.5q0-64-105-56l-26-56q8-10 32.5-43.5t42.5-54 37-38.5v-1q-16 0-48.5 1t-48.5 1v53h-106v-152h333v88l-95 115q51 12 81 49t30 88zm2-627v159h-362q-6-36-6-54 0-51 23.5-93t56.5-68 66-47.5 56.5-43.5 23.5-45q0-25-14.5-38.5t-39.5-13.5q-46 0-81 58l-85-59q24-51 71.5-79.5t105.5-28.5q73 0 123 41.5t50 112.5q0 50-34 91.5t-75 64.5-75.5 50.5-35.5 52.5h127v-60h105zm1409 319v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm-1408-899v99h-335v-99h107q0-41 .5-121.5t.5-121.5v-12h-2q-8 17-50 54l-71-76 136-127h106v404h108zm1408 387v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5z\"\n }\n }, {\n insertUnorderedList: {\n viewBox: \"0 0 1792 1792\",\n d: \"M384 1408q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm0-512q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm-1408-928q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5\"\n }\n }]\n },\n textAlign: {\n menu: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45z\"\n },\n group: [{\n indent: {\n viewBox: \"0 0 1792 1792\",\n d: \"M352 832q0 14-9 23l-288 288q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-576q0-13 9.5-22.5t22.5-9.5q14 0 23 9l288 288q9 9 9 23zm1440 480v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5z\"\n }\n }, {\n justifyLeft: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z\"\n }\n }, {\n justifyCenter: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h896q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-640q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h640q26 0 45 19t19 45z\"\n }\n }, {\n justifyRight: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z\"\n }\n }]\n },\n attachments: {\n menu: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z\"\n },\n group: [{\n attachment: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z\"\n }\n }, {\n link: {\n viewBox: \"0 0 1792 1792\",\n d: \"M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z\"\n }\n }, {\n image: {\n viewBox: \"0 0 2048 1792\",\n d: \"M704 576q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1024 384v448h-1408v-192l320-320 160 160 512-512zm96-704h-1600q-13 0-22.5 9.5t-9.5 22.5v1216q0 13 9.5 22.5t22.5 9.5h1600q13 0 22.5-9.5t9.5-22.5v-1216q0-13-9.5-22.5t-22.5-9.5zm160 32v1216q0 66-47 113t-113 47h-1600q-66 0-113-47t-47-113v-1216q0-66 47-113t113-47h1600q66 0 113 47t47 113z\"\n }\n }]\n }\n };\n var DEFAULTOPTIONS = [\"bold\", \"italic\", \"underline\", \"strikethrough\", \"insertOrderedList\", \"insertUnorderedList\", \"indent\", \"justifyLeft\", \"justifyCenter\", \"justifyRight\", \"attachment\", \"link\", \"image\"];\n\n var StrivenEditor =\n /*#__PURE__*/\n function () {\n function StrivenEditor(el, options) {\n _classCallCheck(this, StrivenEditor);\n\n this.range = new Range();\n this.files = [];\n this.optionGroups = OPTIONGROUPS;\n\n if (options) {\n this.options = options;\n options.fontPack || (this.options.fontPack = FONTPACK);\n options.extensions || (this.options.extensions = EXTENSIONS);\n options.toolbarOptions || (this.options.toolbarOptions = DEFAULTOPTIONS);\n } else {\n this.options = {\n fontPack: FONTPACK,\n extensions: EXTENSIONS,\n DEFAULTOPTIONS: DEFAULTOPTIONS\n };\n }\n\n this.initEditor(el);\n this.initResponsive();\n this.initOverflow();\n }\n\n _createClass(StrivenEditor, [{\n key: \"initEditor\",\n value: function initEditor(el) {\n var _this = this;\n\n this.editor = el;\n this.toolbar = this.initToolbar();\n this.body = this.initBody();\n this.linkMenu = this.initLinkMenu();\n this.imageMenu = this.initImageMenu();\n this.metaDataSection = this.initMetaDataSection();\n this.filesSection = this.initFilesSection();\n this.editor.style.border = \"2px solid #ddd\";\n this.editor.style.display = \"flex\";\n this.editor.style.position = \"relative\";\n this.editor.style.flexDirection = \"column\";\n this.editor.style.fontFamily = \"Arial\";\n this.editor.style.minHeight = \"auto\";\n this.editor.style.maxHeight = \"auto\";\n this.editor.style.maxWidth = \"100%\"; // Toolbar Hide\n\n if (this.options.toolbarHide) {\n this.toolbarSend.style.display = \"none\";\n this.toolbarOptionsGroup.style.display = \"none\";\n\n this.body.onfocus = function () {\n _this.overflow();\n\n _this.toolbarSlideUp();\n };\n\n this.body.onblur = function () {\n _this.overflow();\n\n setTimeout(function () {\n if (document.activeElement !== _this.body && document.activeElement !== _this.linkMenu.querySelector('input') && document.activeElement !== _this.imageMenu.querySelectorAll('input')[0] && document.activeElement !== _this.imageMenu.querySelectorAll('input')[1] && document.activeElement !== _this.imageMenu.querySelectorAll('input')[2]) {\n _this.toolbarSlideDown();\n }\n }, 2000);\n };\n } // Toolbar Options\n\n\n this.toolbarOptions.forEach(function (optionEl) {\n // Assign Styles\n // optionEl.style.padding = \"0 10px\";\n optionEl.style.cursor = \"pointer\";\n optionEl.style.userSelect = \"none\"; // Execute Toolbar Commands\n\n var optionElClick = optionEl.onclick;\n\n optionEl.onclick = function (e) {\n _this.body.focus();\n\n var command = optionEl.id.split(\"-\")[1];\n\n switch (command) {\n case \"insertOrderedList\":\n document.execCommand(\"indent\", true);\n document.execCommand(command, true);\n break;\n\n case \"insertUnorderedList\":\n document.execCommand(\"indent\", true);\n document.execCommand(command, true);\n break;\n\n case \"attachment\":\n var attachmentInput = document.createElement(\"input\");\n attachmentInput.style.display = \"none\";\n attachmentInput.type = \"file\";\n attachmentInput.click();\n\n attachmentInput.onchange = function (e) {\n return _this.attachFile(attachmentInput.files[0]);\n };\n\n break;\n\n case \"link\":\n if (_this.linkMenu.dataset.active === \"true\") {\n _this.closeLinkMenu();\n } else {\n _this.openLinkMenu();\n\n _this.range = _this.getRange();\n\n _this.linkMenu.querySelector('input').focus();\n }\n\n break;\n\n case \"image\":\n if (_this.imageMenu.dataset.active === \"true\") {\n _this.closeImageMenu();\n } else {\n _this.openImageMenu();\n\n _this.range = _this.getRange();\n\n _this.imageMenu.querySelector('input').focus();\n }\n\n break;\n\n default:\n document.execCommand(command, true);\n break;\n }\n\n optionElClick && optionElClick();\n };\n }); // Get Content from Editor\n\n this.editor.getcontent = function () {\n return _this.getContent();\n }; // Get Editor Range\n\n\n this.editor.getrange = function () {\n return _this.getRange();\n };\n\n this.editor.appendChild(this.toolbar);\n this.editor.appendChild(this.body);\n this.editor.appendChild(this.linkMenu);\n this.editor.appendChild(this.imageMenu);\n this.editor.appendChild(this.metaDataSection);\n this.editor.appendChild(this.filesSection); // Reposition Toolbar\n\n if (this.options.toolbarBottom) {\n this.editor.removeChild(this.toolbar);\n this.editor.append(this.toolbar);\n }\n }\n }, {\n key: \"toolbarSlideUp\",\n value: function toolbarSlideUp() {\n var that = this;\n var height = this.toolbar.offsetHeight;\n var id = setInterval(frame, 5);\n\n function frame() {\n if (height >= 40) {\n that.options.onToolbarSend && (that.toolbarSend.style.display = \"flex\");\n that.toolbarOptionsGroup.style.display = \"flex\";\n clearInterval(id);\n } else {\n height++;\n that.toolbar.style.minHeight = \"\".concat(height, \"px\");\n }\n }\n }\n }, {\n key: \"toolbarSlideDown\",\n value: function toolbarSlideDown() {\n var that = this;\n this.options.onToolbarSend && (this.toolbarSend.style.display = \"none\");\n this.toolbarOptionsGroup.style.display = \"none\";\n var height = 40;\n var id = setInterval(frame, 5);\n\n function frame() {\n if (height === 0) {\n clearInterval(id);\n } else {\n height--;\n that.toolbar.style.minHeight = \"\".concat(height, \"px\");\n }\n }\n }\n }, {\n key: \"initToolbar\",\n value: function initToolbar() {\n var _this2 = this;\n\n var toolbar = document.createElement(\"div\");\n this.toolbarOptionsGroup = document.createElement(\"div\");\n var groups = Object.keys(this.optionGroups);\n toolbar.classList.add(\"toolbar\");\n toolbar.style.display = \"flex\";\n toolbar.style.justifyContent = \"space-between\";\n toolbar.style.alignItems = \"center\";\n toolbar.style.flexWrap = \"wrap\";\n toolbar.style.minHeight = this.options.toolbarHide ? \"0\" : \"40px\";\n toolbar.style.position = \"relative\";\n this.toolbarOptionsGroup.classList.add(\"toolbar-options\");\n this.toolbarOptionsGroup.style.margin = \"0 10px\";\n this.toolbarOptionsGroup.style.display = this.options.toolbarHide ? \"none\" : \"flex\"; //iterate groups\n\n groups.forEach(function (group) {\n // add menu to toolbarOptions\n var toolbarMenu = document.createElement(\"div\"); // const toolbarMenuIcon = document.createElement(\"i\");\n\n toolbarMenu.classList.add(\"toolbar-menu\");\n toolbarMenu.id = \"menu-\".concat(group); // toolbarMenuIcon.classList.add(this.options.fontPack);\n // toolbarMenuIcon.classList.add(this.optionGroups[group].menu);\n\n toolbarMenu.appendChild(_this2.constructSVG(_this2.optionGroups[group].menu));\n\n _this2.toolbarOptionsGroup.appendChild(toolbarMenu); // add group to toolbarOptions\n\n\n var toolbarGroup = document.createElement(\"div\");\n toolbarGroup.classList.add(\"toolbar-group\");\n toolbarGroup.id = \"group-\".concat(group);\n\n _this2.options.toolbarOptions.forEach(function (option) {\n var toolbarOption = _this2.optionGroups[group].group.filter(function (group) {\n return group[option];\n })[0];\n\n if (toolbarOption) {\n var svgData = toolbarOption[option];\n\n var optionSpan = _this2.constructSVG(svgData);\n\n optionSpan.id = \"toolbar-\".concat(option);\n optionSpan.style.margin = \"0 10px\";\n toolbarGroup.appendChild(optionSpan);\n }\n });\n\n _this2.toolbarOptionsGroup.appendChild(toolbarGroup); // this.optionGroups[group].group.forEach((option) => {\n // const toolbarCommand = Object.keys(option)[0];\n // if(this.options.toolbarOptions.includes(toolbarCommand)){\n // const optionSpan = this.constructSVG(option[toolbarCommand]);\n // // const optionIcon = document.createElement(\"i\");\n // optionSpan.id = `toolbar-${toolbarCommand}`;\n // optionSpan.style.margin = \"0 10px\";\n // // optionIcon.classList.add(this.options.fontPack);\n // // optionIcon.classList.add(option[toolbarCommand]);\n // // optionSpan.appendChild(optionIcon);\n // toolbarGroup.appendChild(optionSpan);\n // }\n // })\n // this.toolbarOptionsGroup.appendChild(toolbarGroup);\n\n }); // toolbar group for custom options\n\n var customOptions = this.options.toolbarOptions.filter(function (option) {\n return _typeof(option) === \"object\";\n });\n\n if (customOptions.length > 0) {\n this.customToolbarMenu = document.createElement(\"div\");\n this.customToolbarMenu.classList.add(\"toolbar-menu\");\n this.customToolbarMenu.id = \"menu-custom\";\n var customSVGViewBox = \"0 0 1792 1792\";\n var customSVGD = \"M1088 1248v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68z\";\n this.customToolbarMenu.appendChild(this.constructSVG({\n viewBox: customSVGViewBox,\n d: customSVGD\n }));\n this.toolbarOptionsGroup.appendChild(this.customToolbarMenu);\n this.customToolbarGroup = document.createElement(\"div\");\n this.customToolbarGroup.classList.add(\"toolbar-group\");\n this.customToolbarGroup.id = \"group-custom\";\n customOptions.forEach(function (customOption) {\n var icon = customOption.icon,\n handler = customOption.handler;\n\n var optionSpan = _this2.constructSVG(icon);\n\n optionSpan.id = \"toolbar-customOption\";\n optionSpan.style.margin = \"0 10px\";\n\n optionSpan.onclick = function () {\n return handler();\n };\n\n _this2.customToolbarGroup.appendChild(optionSpan);\n });\n this.toolbarOptionsGroup.appendChild(this.customToolbarGroup);\n }\n\n toolbar.appendChild(this.toolbarOptionsGroup); //add toolbar-send\n\n var toolbarSend = document.createElement(\"div\"); // const toolbarSendIcon = document.createElement(\"i\");\n\n toolbarSend.id = \"toolbar-send\"; // toolbarSendIcon.classList.add(this.options.fontPack);\n // toolbarSendIcon.classList.add(\"fa-paper-plane\");\n\n toolbarSend.style.display = \"none\";\n toolbarSend.style.color = \"#fff\";\n toolbarSend.style.backgroundColor = \"#5cb85c\";\n toolbarSend.style.minHeight = this.options.toolbarHide ? \"40px\" : this.toolbar.style.minHeight;\n toolbarSend.style.width = \"50px\";\n toolbarSend.style.textAlign = \"center\";\n toolbarSend.style.justifyContent = \"center\";\n toolbarSend.style.alignContent = \"center\";\n toolbarSend.style.alignItems = \"center\";\n toolbarSend.style.cursor = \"pointer\";\n toolbarSend.style.border = \"1px solid #4cae4c\";\n toolbarSend.style.alignSelf = \"flex-end\";\n this.options.onToolbarSend && (toolbarSend.onclick = function () {\n return _this2.options.onToolbarSend();\n });\n this.options.onToolbarSend && !this.options.toolbarHide && (toolbarSend.style.display = \"flex\");\n\n toolbarSend.onmouseenter = function () {\n return toolbarSend.style.backgroundColor = \"#4cae4c\";\n };\n\n toolbarSend.onmouseleave = function () {\n return toolbarSend.style.backgroundColor = \"#5cb85c\";\n };\n\n var toolbarSendSVG = this.constructSVG({\n viewBox: \"0 0 1792 1792\",\n d: \"M1764 11q33 24 27 64l-256 1536q-5 29-32 45-14 8-31 8-11 0-24-5l-453-185-242 295q-18 23-49 23-13 0-22-4-19-7-30.5-23.5t-11.5-36.5v-349l864-1059-1069 925-395-162q-37-14-40-55-2-40 32-59l1664-960q15-9 32-9 20 0 36 11z\"\n });\n toolbarSendSVG.querySelector('path').setAttribute(\"fill\", \"#fff\");\n toolbarSend.appendChild(toolbarSendSVG);\n toolbar.appendChild(toolbarSend);\n this.toolbarOptions = toolbar.querySelectorAll(\"span\");\n this.toolbarGroups = _toConsumableArray(toolbar.getElementsByClassName(\"toolbar-group\"));\n this.toolbarMenus = _toConsumableArray(toolbar.getElementsByClassName(\"toolbar-menu\"));\n this.toolbarSend = toolbar.querySelector(\"#toolbar-send\");\n this.toolbarMenus.push(this.customToolbarMenu);\n this.toolbarGroups.push(this.customToolbarGroup); // Remove menu that has no options enabled\n\n this.toolbarGroups.forEach(function (group) {\n if (group.children.length < 1) {\n var groupName = group.id.split(\"-\")[1];\n\n var menu = _this2.toolbarMenus.filter(function (menu) {\n return menu.id.split(\"-\")[1] === groupName;\n })[0];\n\n menu.remove();\n }\n });\n return toolbar;\n }\n }, {\n key: \"initBody\",\n value: function initBody() {\n var _this3 = this;\n\n var body = document.createElement(\"div\");\n body.classList.add(\"body\");\n body.contentEditable = \"true\";\n body.style.outline = \"none\";\n body.style.padding = \"10px 20px\";\n body.style.height = this.editor.style.height;\n body.style.minHeight = this.editor.style.minHeight;\n body.style.maxHeight = this.editor.style.maxHeight; // Paste Handler\n\n body.onpaste = function (e) {\n function dataURLtoFile(dataurl, filename) {\n var arr = dataurl.split(','),\n mime = arr[0].match(/:(.*?);/)[1],\n bstr = atob(arr[1]),\n n = bstr.length,\n u8arr = new Uint8Array(n);\n\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n\n var file = new File([u8arr], filename, {\n type: mime\n });\n return new File([u8arr], \"\".concat(file.name, \".\").concat(file.type.split('/').pop()), {\n type: file.type\n });\n }\n\n var convertImage = function convertImage(file) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.readAsDataURL(file);\n\n reader.onload = function () {\n return resolve(reader.result);\n };\n\n reader.onerror = function (error) {\n return reject(error);\n };\n });\n };\n\n if (e.clipboardData.files.length > 0 && e.clipboardData.files[0].type.includes(\"image\")) {\n convertImage(e.clipboardData.files[0]).then(function (res) {\n document.execCommand(\"insertImage\", true, res);\n _this3.options.uploadOnPaste && _this3.attachFile(dataURLtoFile(res, \"pastedimage\"));\n\n _this3.overflow();\n });\n }\n\n if (e.clipboardData.items.length > 0 && e.clipboardData.items[0].type === \"text/plain\") {\n e.clipboardData.items[0].getAsString(function (string) {\n if (_this3.options.metaUrl && _this3.validURL(string)) {\n _this3.getMeta(string).then(function (res) {\n var url = res.url,\n title = res.title,\n image = res.image,\n description = res.description;\n url && title && image && _this3.createMetaDataElement(url, image, title, description);\n });\n }\n });\n }\n\n _this3.overflow();\n };\n\n return body;\n }\n }, {\n key: \"initLinkMenu\",\n value: function initLinkMenu() {\n var _this4 = this;\n\n var linkMenu = document.createElement(\"div\");\n var linkMenuForm = document.createElement(\"div\");\n var linkMenuButton = document.createElement(\"button\");\n var linkMenuFormLabel = document.createElement(\"p\");\n var linkMenuFormInput = document.createElement(\"input\");\n linkMenu.id = \"link-menu\";\n linkMenuButton.textContent = \"Insert Link\";\n linkMenuFormLabel.textContent = \"Web Address\";\n linkMenuFormInput.type = \"text\";\n linkMenuFormLabel.style.margin = \"8px 10px 8px 0\";\n linkMenuFormLabel.style.fontSize = \"14px\";\n linkMenuButton.style.cursor = \"pointer\";\n linkMenu.dataset.active = \"false\";\n linkMenu.style.display = \"none\";\n linkMenu.style.position = \"absolute\";\n linkMenu.style.right = \"10px\";\n linkMenu.style.bottom = \"10px\";\n linkMenu.style.backgroundColor = \"#fff\";\n linkMenu.style.border = \"2px solid #ddd\";\n linkMenu.style.padding = \"10px 20px\";\n linkMenu.style.zIndex = \"1000\";\n linkMenuFormLabel.style.width = \"100%\";\n linkMenuFormLabel.style.textAlign = \"right\";\n linkMenuFormLabel.style.marginRight = \"10px\";\n linkMenuFormInput.style.outline = \"none\";\n linkMenuFormInput.style.padding = \"0 5px\";\n linkMenuFormInput.placeholder = \"Insert a Link\";\n linkMenuForm.style.display = \"flex\";\n linkMenuForm.style.justifyContent = \"space-between\";\n linkMenuForm.style.margin = \"5px 0\";\n linkMenuButton.style[\"float\"] = \"right\";\n linkMenuButton.style.padding = \"6px 12px\";\n linkMenuButton.style.border = \"1px solid #4cae4c\";\n linkMenuButton.style.backgroundColor = \"#5cb85c\";\n linkMenuButton.style.fontSize = \"14px\";\n linkMenuButton.style.color = \"#fff\";\n linkMenuButton.style.outline = \"none\";\n\n linkMenuButton.onmouseenter = function () {\n return linkMenuButton.style.backgroundColor = \"#4cae4c\";\n };\n\n linkMenuButton.onmouseleave = function () {\n return linkMenuButton.style.backgroundColor = \"#5cb85c\";\n };\n\n linkMenuButton.onclick = function (e) {\n var linkValue = linkMenuFormInput.value;\n\n if (linkValue) {\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(_this4.range);\n document.execCommand(\"createLink\", true, linkValue);\n\n if (_this4.options.metaUrl && _this4.validURL(linkValue)) {\n _this4.getMeta(linkValue).then(function (res) {\n var url = res.url,\n image = res.image,\n title = res.title,\n description = res.description;\n url && image && title && _this4.createMetaDataElement(url, image, title, description);\n });\n }\n\n var bodyLinks = _this4.body.querySelectorAll(\"a\");\n\n bodyLinks[bodyLinks.length - 1].contentEditable = \"false\";\n linkMenuFormInput.value = \"\";\n\n _this4.toolbar.querySelector(\"#toolbar-link\").onclick();\n } else {\n _this4.body.focus();\n\n _this4.closeLinkMenu();\n }\n };\n\n linkMenuForm.appendChild(linkMenuFormLabel);\n linkMenuForm.appendChild(linkMenuFormInput);\n linkMenu.appendChild(linkMenuForm);\n linkMenu.appendChild(linkMenuButton);\n return linkMenu;\n }\n }, {\n key: \"initImageMenu\",\n value: function initImageMenu() {\n var _this5 = this;\n\n var imageMenu = document.createElement(\"div\");\n var imageMenuForm = document.createElement(\"div\");\n var imageMenuButton = document.createElement(\"button\");\n var imageMenuFormLabel = document.createElement(\"p\");\n var imageMenuFormSourceInput = document.createElement(\"input\");\n imageMenu.id = \"image-menu\";\n imageMenuButton.textContent = \"Insert Image\";\n imageMenuFormLabel.textContent = \"Image URL\";\n imageMenuFormSourceInput.type = \"text\";\n imageMenuFormLabel.style.margin = \"8px 10px 8px 0\";\n imageMenuFormLabel.style.fontSize = \"14px\";\n imageMenuButton.style.cursor = \"pointer\";\n imageMenu.dataset.active = \"false\";\n imageMenu.style.display = \"none\";\n imageMenu.style.position = \"absolute\";\n imageMenu.style.right = \"10px\";\n imageMenu.style.bottom = \"10px\";\n imageMenu.style.backgroundColor = \"#fff\";\n imageMenu.style.border = \"2px solid #ddd\";\n imageMenu.style.padding = \"10px 20px\";\n imageMenu.style.zIndex = \"1000\";\n imageMenuFormLabel.style.width = \"100%\";\n imageMenuFormLabel.style.textAlign = \"right\";\n imageMenuFormLabel.style.marginRight = \"10px\";\n imageMenuFormSourceInput.style.outline = \"none\";\n imageMenuFormSourceInput.style.padding = \"0 5px\";\n imageMenuFormSourceInput.placeholder = \"Insert a Link\";\n imageMenuForm.style.display = \"flex\";\n imageMenuForm.style.justifyContent = \"space-between\";\n imageMenuForm.style.margin = \"5px 0\";\n imageMenuButton.style[\"float\"] = \"right\";\n imageMenuButton.style.padding = \"6px 12px\";\n imageMenuButton.style.border = \"1px solid #4cae4c\";\n imageMenuButton.style.backgroundColor = \"#5cb85c\";\n imageMenuButton.style.fontSize = \"14px\";\n imageMenuButton.style.color = \"#fff\";\n imageMenuButton.style.outline = \"none\";\n\n imageMenuButton.onmouseenter = function () {\n return imageMenuButton.style.backgroundColor = \"#4cae4c\";\n };\n\n imageMenuButton.onmouseleave = function () {\n return imageMenuButton.style.backgroundColor = \"#5cb85c\";\n };\n\n imageMenuForm.appendChild(imageMenuFormLabel);\n imageMenuForm.appendChild(imageMenuFormSourceInput); // Height Input Form\n\n var imageMenuHeightForm = imageMenuForm.cloneNode(true);\n var imageMenuHeightFormInput = imageMenuHeightForm.querySelector('input');\n var imageMenuHeightFormLabel = imageMenuHeightForm.querySelector('p');\n imageMenuHeightFormInput.placeholder = \"Image Height\";\n imageMenuHeightFormLabel.textContent = \"Height\"; // Width Input Form\n\n var imageMenuWidthForm = imageMenuForm.cloneNode(true);\n var imageMenuWidthFormInput = imageMenuWidthForm.querySelector('input');\n var imageMenuWidthFormLabel = imageMenuWidthForm.querySelector('p');\n imageMenuWidthFormInput.placeholder = \"Image Height\";\n imageMenuWidthFormLabel.textContent = \"Width\";\n\n imageMenuButton.onclick = function (e) {\n var linkValue = imageMenuFormSourceInput.value;\n var heightValue = imageMenuHeightFormInput.value;\n var widthValue = imageMenuWidthFormInput.value;\n\n if (linkValue) {\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(_this5.range);\n document.execCommand(\"insertImage\", true, linkValue);\n\n var imageTags = _this5.body.querySelectorAll(\"img\");\n\n imageTags[imageTags.length - 1].style.height = \"\".concat(heightValue, \"px\");\n imageTags[imageTags.length - 1].style.width = \"\".concat(widthValue, \"px\");\n imageMenuHeightFormInput.value = \"\";\n imageMenuWidthFormInput.value = \"\";\n imageMenuFormSourceInput.value = \"\";\n\n _this5.toolbar.querySelector(\"#toolbar-image\").onclick();\n } else {\n _this5.body.focus();\n\n _this5.closeImageMenu();\n }\n };\n\n imageMenu.appendChild(imageMenuHeightForm);\n imageMenu.appendChild(imageMenuWidthForm);\n imageMenu.appendChild(imageMenuForm);\n imageMenu.appendChild(imageMenuButton);\n return imageMenu;\n }\n }, {\n key: \"initMetaDataSection\",\n value: function initMetaDataSection() {\n var metaDataSection = document.createElement(\"div\");\n metaDataSection.classList.add(\"metadata-section\");\n metaDataSection.style.display = \"flex\";\n metaDataSection.style.flexWrap = \"wrap\";\n metaDataSection.style.zIndex = \"500\";\n return metaDataSection;\n }\n }, {\n key: \"initFilesSection\",\n value: function initFilesSection() {\n var _this6 = this;\n\n var filesSection = document.createElement(\"div\");\n filesSection.classList.add(\"files-section\");\n filesSection.style.display = \"flex\";\n filesSection.style.flexWrap = \"wrap\";\n filesSection.style.zIndex = \"500\";\n\n this.body.ondragenter = function (e) {\n _this6.body.style.backgroundColor = \"#ddd\";\n };\n\n this.body.ondragleave = function (e) {\n _this6.body.style.backgroundColor = \"inherit\";\n };\n\n this.body.ondrop = function (e) {\n _this6.body.style.backgroundColor = \"inherit\";\n e.preventDefault();\n var file = e.dataTransfer.files && e.dataTransfer.files[0];\n\n _this6.attachFile(file);\n };\n\n this.editor.getfiles = function () {\n return _this6.getFiles();\n };\n\n return filesSection;\n }\n }, {\n key: \"createFileElement\",\n value: function createFileElement(name, size) {\n var _this7 = this;\n\n var fileEl = document.createElement(\"div\");\n var fileNameEl = document.createElement(\"h4\");\n var fileSizeEl = document.createElement(\"p\");\n var removeFileEl = document.createElement(\"p\");\n fileNameEl.textContent = name;\n fileSizeEl.textContent = size;\n removeFileEl.textContent = \"X\";\n fileEl.dataset.fileindex = this.files.length - 1;\n fileEl.style.width = \"100%\";\n fileEl.style.display = \"flex\";\n fileEl.style.flexDirection = \"column\";\n fileEl.style.margin = \"10px\";\n fileEl.style.position = \"relative\";\n fileNameEl.style.fontWeight = \"bold\";\n fileNameEl.style.margin = \"0\";\n fileSizeEl.style.fontSize = \"12px\";\n fileSizeEl.style.margin = \"2px 0\";\n removeFileEl.style.margin = \"0\";\n removeFileEl.style.userSelect = \"none\";\n removeFileEl.style.color = \"black\";\n removeFileEl.style.position = \"absolute\";\n removeFileEl.style.right = \"5px\";\n removeFileEl.style.top = \"-5px\";\n removeFileEl.style.cursor = \"pointer\";\n removeFileEl.style.backgroundColor = \"#fff\";\n\n removeFileEl.onmouseenter = function () {\n return removeFileEl.style.color = \"#ddd\";\n };\n\n removeFileEl.onmouseleave = function () {\n return removeFileEl.style.color = \"black\";\n };\n\n removeFileEl.onclick = function (e) {\n _this7.files.splice(e.target.parentElement.dataset.fileindex, 1);\n\n e.target.parentElement.remove();\n };\n\n fileEl.appendChild(fileNameEl);\n fileEl.appendChild(fileSizeEl);\n fileEl.appendChild(removeFileEl);\n this.filesSection.appendChild(fileEl);\n\n this.editor.getfiles = function () {\n return _this7.getFiles();\n };\n }\n }, {\n key: \"createMetaDataElement\",\n value: function createMetaDataElement(url, img, title, description) {\n var metaItemEl = document.createElement(\"div\");\n var metaLinkEl = document.createElement(\"a\");\n var metaImageEl = document.createElement(\"img\");\n var metaDataEl = document.createElement(\"div\");\n var metaDataTitleEl = document.createElement(\"h4\");\n var metaDataDescriptionEl = document.createElement(\"p\");\n var removeMetaDataEl = document.createElement(\"span\");\n metaLinkEl.href = url;\n metaImageEl.src = img;\n metaDataTitleEl.textContent = title;\n metaDataDescriptionEl.textContent = description;\n removeMetaDataEl.textContent = \"X\";\n metaLinkEl.target = \"blank\";\n metaItemEl.style.width = \"100%\";\n metaItemEl.style.display = \"flex\";\n metaItemEl.style.margin = \"10px\";\n metaItemEl.style.position = \"relative\";\n metaImageEl.style.marginRight = \"10px\";\n metaImageEl.style.height = \"50px\";\n metaImageEl.style.width = \"75px\";\n metaDataTitleEl.style.fontWeight = \"bold\";\n metaDataTitleEl.style.margin = \"0\";\n metaDataDescriptionEl.style.margin = \"0\";\n removeMetaDataEl.style.userSelect = \"none\";\n removeMetaDataEl.style.color = \"black\";\n removeMetaDataEl.style.position = \"absolute\";\n removeMetaDataEl.style.right = \"5px\";\n removeMetaDataEl.style.top = \"-5px\";\n removeMetaDataEl.style.cursor = \"pointer\";\n removeMetaDataEl.style.backgroundColor = \"#fff\";\n\n removeMetaDataEl.onmouseenter = function () {\n return removeMetaDataEl.style.color = \"#ddd\";\n };\n\n removeMetaDataEl.onmouseleave = function () {\n return removeMetaDataEl.style.color = \"black\";\n };\n\n removeMetaDataEl.onclick = function (e) {\n return e.target.parentElement.remove();\n };\n\n metaLinkEl.appendChild(metaImageEl);\n metaDataEl.appendChild(metaDataTitleEl);\n metaDataEl.appendChild(metaDataDescriptionEl);\n metaItemEl.appendChild(metaLinkEl);\n metaItemEl.appendChild(metaDataEl);\n metaItemEl.appendChild(removeMetaDataEl);\n this.metaDataSection.appendChild(metaItemEl);\n }\n }, {\n key: \"constructSVG\",\n value: function constructSVG(svgData) {\n var viewBox = svgData.viewBox,\n d = svgData.d;\n var fillColor = this.options.toolbarOptionFillColor ? this.options.toolbarOptionFillColor : \"#333\";\n var xmlns = \"http://www.w3.org/2000/svg\";\n var height = \"16\";\n var width = \"16\";\n var icon = document.createElement('span');\n var svg = \"<svg width=\\\"\".concat(width, \"\\\" height=\\\"\").concat(height, \"\\\" viewBox=\\\"\").concat(viewBox, \"\\\" xmlns=\\\"\").concat(xmlns, \"\\\">\");\n var path = \"<path fill=\\\"\".concat(fillColor, \"\\\" d=\\\"\").concat(d, \"\\\"/>\");\n icon.innerHTML = \"\".concat(svg).concat(path, \"</svg>\");\n return icon;\n }\n }, {\n key: \"initResponsive\",\n value: function initResponsive() {\n var _this8 = this;\n\n var that = this;\n\n if (!this.options.minimal) {\n var responsiveGroups = function responsiveGroups(isResponsive) {\n that.toolbarGroups.forEach(function (group) {\n group.dataset.open = \"false\";\n group.style.display = isResponsive ? \"none\" : \"block\";\n group.style.position = isResponsive ? \"absolute\" : \"relative\";\n group.style.bottom = isResponsive ? \"5px\" : \"inherit\";\n group.style.right = isResponsive ? \"5px\" : \"inherit\";\n group.style.backgroundColor = isResponsive ? \"#fff\" : \"inherit\";\n group.style.border = isResponsive ? \"2px solid #ddd\" : \"none\";\n });\n that.toolbarMenus.forEach(function (menu) {\n function toggleMenu() {\n var selectedGroup = that.toolbar.querySelector(\"#group-\".concat(menu.id.split(\"-\")[1]));\n\n if (selectedGroup.dataset.open === \"false\") {\n // close opened groups\n that.toolbarGroups.forEach(function (group) {\n if (group.dataset.open === \"true\") {\n group.style.display = \"none\";\n group.dataset.open = \"false\";\n }\n }); // open group\n\n selectedGroup.style.display = \"block\";\n selectedGroup.style.padding = \"5px\";\n selectedGroup.dataset.open = \"true\";\n } else {\n selectedGroup.style.display = \"none\";\n selectedGroup.dataset.open = \"false\";\n }\n }\n\n menu.style.padding = \"0 10px\";\n menu.style.cursor = \"pointer\";\n menu.style.userSelect = \"none\";\n menu.style.display = isResponsive ? \"block\" : \"none\";\n\n menu.onclick = function (e) {\n toggleMenu();\n that.body.focus();\n };\n });\n };\n\n var setResponsive = function setResponsive() {\n responsive = window.matchMedia(\"(max-width: 700px)\").matches;\n responsiveGroups(responsive);\n };\n\n var responsive = window.matchMedia(\"(max-width: 700px)\").matches;\n setResponsive();\n\n window.onresize = function () {\n _this8.toolbarGroups.forEach(function (group) {\n return group.style.padding = \"0\";\n });\n\n _this8.closeLinkMenu();\n\n _this8.closeImageMenu();\n\n setResponsive();\n };\n } else {\n this.toolbarMenus.forEach(function (menu) {\n return menu.style.display = \"none\";\n });\n this.toolbar.querySelector(\"#toolbar-strikethrough\").style.display = \"none\";\n this.toolbar.querySelector(\"#toolbar-image\").style.display = \"none\";\n this.toolbar.querySelector(\"#toolbar-insertOrderedList\").style.display = \"none\";\n this.toolbar.querySelector(\"#group-textAlign\").style.display = \"none\";\n }\n }\n }, {\n key: \"initOverflow\",\n value: function initOverflow() {\n var _this9 = this;\n\n var onFocus = this.body.onfocus;\n\n this.body.onfocus = function () {\n onFocus && onFocus();\n\n _this9.overflow();\n };\n\n var onBlur = this.body.onblur;\n\n this.body.onblur = function () {\n onBlur && onBlur();\n\n _this9.overflow();\n };\n\n this.body.onkeypress = function () {\n return _this9.overflow();\n };\n }\n }, {\n key: \"getFiles\",\n value: function getFiles() {\n return this.files;\n }\n }, {\n key: \"getContent\",\n value: function getContent() {\n return this.body.innerHTML;\n }\n }, {\n key: \"getRange\",\n value: function getRange() {\n return window.getSelection().getRangeAt(0);\n }\n }, {\n key: \"getMeta\",\n value: function getMeta(url) {\n return fetch(this.options.metaUrl, {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n targetUrl: url\n })\n }).then(function (res) {\n return res.json();\n });\n }\n }, {\n key: \"validURL\",\n value: function validURL(str) {\n var pattern = new RegExp(\"^(https?:\\\\/\\\\/)?\" + \"((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|\" + \"((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))\" + \"(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*\" + \"(\\\\?[;&a-z\\\\d%_.~+=-]*)?\" + \"(\\\\#[-a-z\\\\d_]*)?$\", \"i\");\n return !!pattern.test(str);\n }\n }, {\n key: \"overflow\",\n value: function overflow() {\n var body = this.body;\n body.scrollHeight > body.clientHeight ? body.style.overflowY = \"scroll\" : body.style.overflowY = \"hidden\";\n body.scrollWidth > body.clientWidth ? body.style.overflowX = \"scroll\" : body.style.overflowX = \"hidden\";\n }\n }, {\n key: \"formatBytes\",\n value: function formatBytes(bytes) {\n var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n if (bytes === 0) return '0 Bytes';\n var k = 1024;\n var dm = decimals < 0 ? 0 : decimals;\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n var i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n }\n }, {\n key: \"validateFile\",\n value: function validateFile(file) {\n var extension = file.type.split('/').pop();\n return this.options.extensions.includes(\".\".concat(extension));\n }\n }, {\n key: \"attachFile\",\n value: function attachFile(file) {\n if (this.validateFile(file)) {\n this.files.push(file);\n this.createFileElement(file.name, this.formatBytes(file.size));\n } else {\n this.fileInvalid();\n }\n }\n }, {\n key: \"fileInvalid\",\n value: function fileInvalid() {\n var _this10 = this;\n\n this.body.style.transition = \"background-color .5s\";\n this.body.style.backgroundColor = \"#d9534f\";\n setTimeout(function () {\n _this10.body.style.backgroundColor = \"inherit\";\n setTimeout(function () {\n return _this10.body.style.transition = \"none\";\n }, 500);\n }, 500);\n }\n }, {\n key: \"openLinkMenu\",\n value: function openLinkMenu() {\n this.closeImageMenu();\n this.linkMenu.dataset.active = \"true\";\n this.linkMenu.style.display = \"block\";\n }\n }, {\n key: \"openImageMenu\",\n value: function openImageMenu() {\n this.closeLinkMenu();\n this.imageMenu.dataset.active = \"true\";\n this.imageMenu.style.display = \"block\";\n }\n }, {\n key: \"closeLinkMenu\",\n value: function closeLinkMenu() {\n this.linkMenu.dataset.active = \"false\";\n this.linkMenu.style.display = \"none\";\n }\n }, {\n key: \"closeImageMenu\",\n value: function closeImageMenu() {\n this.imageMenu.dataset.active = \"false\";\n this.imageMenu.style.display = \"none\";\n }\n }, {\n key: \"setContent\",\n value: function setContent(html) {\n this.body.innerHTML = html;\n }\n }, {\n key: \"clearContent\",\n value: function clearContent() {\n this.body.innerHTML = \"\";\n }\n }]);\n\n return StrivenEditor;\n }();\n\n _exports[\"default\"] = StrivenEditor;\n});\n\n//# sourceURL=webpack://striveneditor/./src/striveneditor.js?");
/***/ })
-/******/ ]);
+
+/******/ });
});
\ No newline at end of file
diff --git a/dist/striveneditor.js b/dist/striveneditor.js
@@ -1 +1,2 @@
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.striveneditor=e():t.striveneditor=e()}(window,(function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)o.d(n,i,function(e){return t[e]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){var n,i,l;i=[e],void 0===(l="function"==typeof(n=function(t){"use strict";function e(t){return function(t){if(Array.isArray(t)){for(var e=0,o=new Array(t.length);e<t.length;e++)o[e]=t[e];return o}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=[".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".tif",".jpeg",".jpg",".gif",".bmp",".txt",".csv",".png",".msg",".wav",".mp3",".mp4",".zip",".rtf",".eps",".ai",".psd",".avi",".mov",".wmv",".cfg",".wss",".vsd",".vsdx",".tsd",".lic"],l="fas",r={textDecoration:{menu:{viewBox:"0 0 1792 1792",d:"M789 559l-170 450q33 0 136.5 2t160.5 2q19 0 57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29 31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15 34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5 13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0 12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11 2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0 22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58 0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z"},group:[{bold:{viewBox:"0 0 1792 1792",d:"M747 1521q74 32 140 32 376 0 376-335 0-114-41-180-27-44-61.5-74t-67.5-46.5-80.5-25-84-10.5-94.5-2q-73 0-101 10 0 53-.5 159t-.5 158q0 8-1 67.5t-.5 96.5 4.5 83.5 12 66.5zm-14-746q42 7 109 7 82 0 143-13t110-44.5 74.5-89.5 25.5-142q0-70-29-122.5t-79-82-108-43.5-124-14q-50 0-130 13 0 50 4 151t4 152q0 27-.5 80t-.5 79q0 46 1 69zm-541 889l2-94q15-4 85-16t106-27q7-12 12.5-27t8.5-33.5 5.5-32.5 3-37.5.5-34v-65.5q0-982-22-1025-4-8-22-14.5t-44.5-11-49.5-7-48.5-4.5-30.5-3l-4-83q98-2 340-11.5t373-9.5q23 0 68 .5t68 .5q70 0 136.5 13t128.5 42 108 71 74 104.5 28 137.5q0 52-16.5 95.5t-39 72-64.5 57.5-73 45-84 40q154 35 256.5 134t102.5 248q0 100-35 179.5t-93.5 130.5-138 85.5-163.5 48.5-176 14q-44 0-132-3t-132-3q-106 0-307 11t-231 12z"}},{italic:{viewBox:"0 0 1792 1792",d:"M384 1662l17-85q22-7 61.5-16.5t72-19 59.5-23.5q28-35 41-101 1-7 62-289t114-543.5 52-296.5v-25q-24-13-54.5-18.5t-69.5-8-58-5.5l19-103q33 2 120 6.5t149.5 7 120.5 2.5q48 0 98.5-2.5t121-7 98.5-6.5q-5 39-19 89-30 10-101.5 28.5t-108.5 33.5q-8 19-14 42.5t-9 40-7.5 45.5-6.5 42q-27 148-87.5 419.5t-77.5 355.5q-2 9-13 58t-20 90-16 83.5-6 57.5l1 18q17 4 185 31-3 44-16 99-11 0-32.5 1.5t-32.5 1.5q-29 0-87-10t-86-10q-138-2-206-2-51 0-143 9t-121 11z"}},{underline:{viewBox:"0 0 1792 1792",d:"M176 223q-37-2-45-4l-3-88q13-1 40-1 60 0 112 4 132 7 166 7 86 0 168-3 116-4 146-5 56 0 86-2l-1 14 2 64v9q-60 9-124 9-60 0-79 25-13 14-13 132 0 13 .5 32.5t.5 25.5l1 229 14 280q6 124 51 202 35 59 96 92 88 47 177 47 104 0 191-28 56-18 99-51 48-36 65-64 36-56 53-114 21-73 21-229 0-79-3.5-128t-11-122.5-13.5-159.5l-4-59q-5-67-24-88-34-35-77-34l-100 2-14-3 2-86h84l205 10q76 3 196-10l18 2q6 38 6 51 0 7-4 31-45 12-84 13-73 11-79 17-15 15-15 41 0 7 1.5 27t1.5 31q8 19 22 396 6 195-15 304-15 76-41 122-38 65-112 123-75 57-182 89-109 33-255 33-167 0-284-46-119-47-179-122-61-76-83-195-16-80-16-237v-333q0-188-17-213-25-36-147-39zm1488 1409v-64q0-14-9-23t-23-9h-1472q-14 0-23 9t-9 23v64q0 14 9 23t23 9h1472q14 0 23-9t9-23z"}},{strikethrough:{viewBox:"0 0 1792 1792",d:"M1760 896q14 0 23 9t9 23v64q0 14-9 23t-23 9h-1728q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h1728zm-1277-64q-28-35-51-80-48-98-48-188 0-181 134-309 133-127 393-127 50 0 167 19 66 12 177 48 10 38 21 118 14 123 14 183 0 18-5 45l-12 3-84-6-14-2q-50-149-103-205-88-91-210-91-114 0-182 59-67 58-67 146 0 73 66 140t279 129q69 20 173 66 58 28 95 52h-743zm507 256h411q7 39 7 92 0 111-41 212-23 56-71 104-37 35-109 81-80 48-153 66-80 21-203 21-114 0-195-23l-140-40q-57-16-72-28-8-8-8-22v-13q0-108-2-156-1-30 0-68l2-37v-44l102-2q15 34 30 71t22.5 56 12.5 27q35 57 80 94 43 36 105 57 59 22 132 22 64 0 139-27 77-26 122-86 47-61 47-129 0-84-81-157-34-29-137-71z"}}]},listOptions:{menu:{viewBox:"0 0 1792 1792",d:"M256 1312v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm-1536-1152v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5z"},group:[{insertOrderedList:{viewBox:"0 0 1792 1792",d:"M381 1620q0 80-54.5 126t-135.5 46q-106 0-172-66l57-88q49 45 106 45 29 0 50.5-14.5t21.5-42.5q0-64-105-56l-26-56q8-10 32.5-43.5t42.5-54 37-38.5v-1q-16 0-48.5 1t-48.5 1v53h-106v-152h333v88l-95 115q51 12 81 49t30 88zm2-627v159h-362q-6-36-6-54 0-51 23.5-93t56.5-68 66-47.5 56.5-43.5 23.5-45q0-25-14.5-38.5t-39.5-13.5q-46 0-81 58l-85-59q24-51 71.5-79.5t105.5-28.5q73 0 123 41.5t50 112.5q0 50-34 91.5t-75 64.5-75.5 50.5-35.5 52.5h127v-60h105zm1409 319v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm-1408-899v99h-335v-99h107q0-41 .5-121.5t.5-121.5v-12h-2q-8 17-50 54l-71-76 136-127h106v404h108zm1408 387v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5z"}},{insertUnorderedList:{viewBox:"0 0 1792 1792",d:"M384 1408q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm0-512q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm-1408-928q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5"}}]},textAlign:{menu:{viewBox:"0 0 1792 1792",d:"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45z"},group:[{indent:{viewBox:"0 0 1792 1792",d:"M352 832q0 14-9 23l-288 288q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-576q0-13 9.5-22.5t22.5-9.5q14 0 23 9l288 288q9 9 9 23zm1440 480v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5z"}},{justifyLeft:{viewBox:"0 0 1792 1792",d:"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"}},{justifyCenter:{viewBox:"0 0 1792 1792",d:"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h896q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-640q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h640q26 0 45 19t19 45z"}},{justifyRight:{viewBox:"0 0 1792 1792",d:"M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"}}]},attachments:{menu:{viewBox:"0 0 1792 1792",d:"M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"},group:[{attachment:{viewBox:"0 0 1792 1792",d:"M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"}},{link:{viewBox:"0 0 1792 1792",d:"M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"}},{image:{viewBox:"0 0 2048 1792",d:"M704 576q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1024 384v448h-1408v-192l320-320 160 160 512-512zm96-704h-1600q-13 0-22.5 9.5t-9.5 22.5v1216q0 13 9.5 22.5t22.5 9.5h1600q13 0 22.5-9.5t9.5-22.5v-1216q0-13-9.5-22.5t-22.5-9.5zm160 32v1216q0 66-47 113t-113 47h-1600q-66 0-113-47t-47-113v-1216q0-66 47-113t113-47h1600q66 0 113 47t47 113z"}}]}},a=["bold","italic","underline","strikethrough","insertOrderedList","insertUnorderedList","indent","justifyLeft","justifyCenter","justifyRight","attachment","link","image"],s=function(){function t(e,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.range=new Range,this.files=[],this.optionGroups=r,o?(this.options=o,o.fontPack||(this.options.fontPack=l),o.extensions||(this.options.extensions=i),o.toolbarOptions||(this.options.toolbarOptions=a)):this.options={fontPack:l,extensions:i,DEFAULTOPTIONS:a},this.initEditor(e),this.initResponsive(),this.initOverflow()}var s,c,d;return s=t,(c=[{key:"initEditor",value:function(t){var e=this;this.editor=t,this.toolbar=this.initToolbar(),this.body=this.initBody(),this.linkMenu=this.initLinkMenu(),this.imageMenu=this.initImageMenu(),this.metaDataSection=this.initMetaDataSection(),this.filesSection=this.initFilesSection(),this.editor.style.border="2px solid #ddd",this.editor.style.display="flex",this.editor.style.position="relative",this.editor.style.flexDirection="column",this.editor.style.fontFamily="Arial",this.editor.style.minHeight="auto",this.editor.style.maxHeight="auto",this.editor.style.maxWidth="100%",this.options.toolbarHide&&(this.toolbarSend.style.display="none",this.toolbarOptionsGroup.style.display="none",this.body.onfocus=function(){e.overflow(),e.toolbarSlideUp()},this.body.onblur=function(){e.overflow(),setTimeout((function(){document.activeElement!==e.body&&document.activeElement!==e.linkMenu.querySelector("input")&&document.activeElement!==e.imageMenu.querySelectorAll("input")[0]&&document.activeElement!==e.imageMenu.querySelectorAll("input")[1]&&document.activeElement!==e.imageMenu.querySelectorAll("input")[2]&&e.toolbarSlideDown()}),2e3)}),this.toolbarOptions.forEach((function(t){t.style.cursor="pointer",t.style.userSelect="none";var o=t.onclick;t.onclick=function(n){e.body.focus();var i=t.id.split("-")[1];switch(i){case"insertOrderedList":case"insertUnorderedList":document.execCommand("indent",!0),document.execCommand(i,!0);break;case"attachment":var l=document.createElement("input");l.style.display="none",l.type="file",l.click(),l.onchange=function(t){return e.attachFile(l.files[0])};break;case"link":"true"===e.linkMenu.dataset.active?e.closeLinkMenu():(e.openLinkMenu(),e.range=e.getRange(),e.linkMenu.querySelector("input").focus());break;case"image":"true"===e.imageMenu.dataset.active?e.closeImageMenu():(e.openImageMenu(),e.range=e.getRange(),e.imageMenu.querySelector("input").focus());break;default:document.execCommand(i,!0)}o&&o()}})),this.editor.getcontent=function(){return e.getContent()},this.editor.getrange=function(){return e.getRange()},this.editor.appendChild(this.toolbar),this.editor.appendChild(this.body),this.editor.appendChild(this.linkMenu),this.editor.appendChild(this.imageMenu),this.editor.appendChild(this.metaDataSection),this.editor.appendChild(this.filesSection),this.options.toolbarBottom&&(this.editor.removeChild(this.toolbar),this.editor.append(this.toolbar))}},{key:"toolbarSlideUp",value:function(){var t=this,e=this.toolbar.offsetHeight,o=setInterval((function(){e>=40?(t.options.onToolbarSend&&(t.toolbarSend.style.display="flex"),t.toolbarOptionsGroup.style.display="flex",clearInterval(o)):(e++,t.toolbar.style.minHeight="".concat(e,"px"))}),5)}},{key:"toolbarSlideDown",value:function(){var t=this;this.options.onToolbarSend&&(this.toolbarSend.style.display="none"),this.toolbarOptionsGroup.style.display="none";var e=40,o=setInterval((function(){0===e?clearInterval(o):(e--,t.toolbar.style.minHeight="".concat(e,"px"))}),5)}},{key:"initToolbar",value:function(){var t=this,n=document.createElement("div");this.toolbarOptionsGroup=document.createElement("div");var i=Object.keys(this.optionGroups);n.classList.add("toolbar"),n.style.display="flex",n.style.justifyContent="space-between",n.style.alignItems="center",n.style.flexWrap="wrap",n.style.minHeight=this.options.toolbarHide?"0":"40px",n.style.position="relative",this.toolbarOptionsGroup.classList.add("toolbar-options"),this.toolbarOptionsGroup.style.margin="0 10px",this.toolbarOptionsGroup.style.display=this.options.toolbarHide?"none":"flex",i.forEach((function(e){var o=document.createElement("div");o.classList.add("toolbar-menu"),o.id="menu-".concat(e),o.appendChild(t.constructSVG(t.optionGroups[e].menu)),t.toolbarOptionsGroup.appendChild(o);var n=document.createElement("div");n.classList.add("toolbar-group"),n.id="group-".concat(e),t.options.toolbarOptions.forEach((function(o){var i=t.optionGroups[e].group.filter((function(t){return t[o]}))[0];if(i){var l=i[o],r=t.constructSVG(l);r.id="toolbar-".concat(o),r.style.margin="0 10px",n.appendChild(r)}})),t.toolbarOptionsGroup.appendChild(n)}));var l=this.options.toolbarOptions.filter((function(t){return"object"===o(t)}));l.length>0&&(this.customToolbarMenu=document.createElement("div"),this.customToolbarMenu.classList.add("toolbar-menu"),this.customToolbarMenu.id="menu-custom",this.customToolbarMenu.appendChild(this.constructSVG({viewBox:"0 0 1792 1792",d:"M1088 1248v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68z"})),this.toolbarOptionsGroup.appendChild(this.customToolbarMenu),this.customToolbarGroup=document.createElement("div"),this.customToolbarGroup.classList.add("toolbar-group"),this.customToolbarGroup.id="group-custom",l.forEach((function(e){var o=e.icon,n=e.handler,i=t.constructSVG(o);i.id="toolbar-customOption",i.style.margin="0 10px",i.onclick=function(){return n()},t.customToolbarGroup.appendChild(i)})),this.toolbarOptionsGroup.appendChild(this.customToolbarGroup)),n.appendChild(this.toolbarOptionsGroup);var r=document.createElement("div");r.id="toolbar-send",r.style.display="none",r.style.color="#fff",r.style.backgroundColor="#5cb85c",r.style.minHeight=this.options.toolbarHide?"40px":this.toolbar.style.minHeight,r.style.width="50px",r.style.textAlign="center",r.style.justifyContent="center",r.style.alignContent="center",r.style.alignItems="center",r.style.cursor="pointer",r.style.border="1px solid #4cae4c",r.style.alignSelf="flex-end",this.options.onToolbarSend&&(r.onclick=function(){return t.options.onToolbarSend()}),this.options.onToolbarSend&&!this.options.toolbarHide&&(r.style.display="flex"),r.onmouseenter=function(){return r.style.backgroundColor="#4cae4c"},r.onmouseleave=function(){return r.style.backgroundColor="#5cb85c"};var a=this.constructSVG({viewBox:"0 0 1792 1792",d:"M1764 11q33 24 27 64l-256 1536q-5 29-32 45-14 8-31 8-11 0-24-5l-453-185-242 295q-18 23-49 23-13 0-22-4-19-7-30.5-23.5t-11.5-36.5v-349l864-1059-1069 925-395-162q-37-14-40-55-2-40 32-59l1664-960q15-9 32-9 20 0 36 11z"});return a.querySelector("path").setAttribute("fill","#fff"),r.appendChild(a),n.appendChild(r),this.toolbarOptions=n.querySelectorAll("span"),this.toolbarGroups=e(n.getElementsByClassName("toolbar-group")),this.toolbarMenus=e(n.getElementsByClassName("toolbar-menu")),this.toolbarSend=n.querySelector("#toolbar-send"),this.toolbarMenus.push(this.customToolbarMenu),this.toolbarGroups.push(this.customToolbarGroup),this.toolbarGroups.forEach((function(e){if(e.children.length<1){var o=e.id.split("-")[1];t.toolbarMenus.filter((function(t){return t.id.split("-")[1]===o}))[0].remove()}})),n}},{key:"initBody",value:function(){var t=this,e=document.createElement("div");return e.classList.add("body"),e.contentEditable="true",e.style.outline="none",e.style.padding="10px 20px",e.style.height=this.editor.style.height,e.style.minHeight=this.editor.style.minHeight,e.style.maxHeight=this.editor.style.maxHeight,e.onpaste=function(e){var o;e.clipboardData.files.length>0&&e.clipboardData.files[0].type.includes("image")&&(o=e.clipboardData.files[0],new Promise((function(t,e){var n=new FileReader;n.readAsDataURL(o),n.onload=function(){return t(n.result)},n.onerror=function(t){return e(t)}}))).then((function(e){document.execCommand("insertImage",!0,e),t.options.uploadOnPaste&&t.attachFile(function(t,e){for(var o=t.split(","),n=o[0].match(/:(.*?);/)[1],i=atob(o[1]),l=i.length,r=new Uint8Array(l);l--;)r[l]=i.charCodeAt(l);var a=new File([r],e,{type:n});return new File([r],"".concat(a.name,".").concat(a.type.split("/").pop()),{type:a.type})}(e,"pastedimage")),t.overflow()})),e.clipboardData.items.length>0&&"text/plain"===e.clipboardData.items[0].type&&e.clipboardData.items[0].getAsString((function(e){t.options.metaUrl&&t.validURL(e)&&t.getMeta(e).then((function(e){var o=e.url,n=e.title,i=e.image,l=e.description;o&&n&&i&&t.createMetaDataElement(o,i,n,l)}))})),t.overflow()},e}},{key:"initLinkMenu",value:function(){var t=this,e=document.createElement("div"),o=document.createElement("div"),n=document.createElement("button"),i=document.createElement("p"),l=document.createElement("input");return e.id="link-menu",n.textContent="Insert Link",i.textContent="Web Address",l.type="text",i.style.margin="8px 10px 8px 0",i.style.fontSize="14px",n.style.cursor="pointer",e.dataset.active="false",e.style.display="none",e.style.position="absolute",e.style.right="10px",e.style.bottom="10px",e.style.backgroundColor="#fff",e.style.border="2px solid #ddd",e.style.padding="10px 20px",e.style.zIndex="1000",i.style.width="100%",i.style.textAlign="right",i.style.marginRight="10px",l.style.outline="none",l.style.padding="0 5px",l.placeholder="Insert a Link",o.style.display="flex",o.style.justifyContent="space-between",o.style.margin="5px 0",n.style.float="right",n.style.padding="6px 12px",n.style.border="1px solid #4cae4c",n.style.backgroundColor="#5cb85c",n.style.fontSize="14px",n.style.color="#fff",n.style.outline="none",n.onmouseenter=function(){return n.style.backgroundColor="#4cae4c"},n.onmouseleave=function(){return n.style.backgroundColor="#5cb85c"},n.onclick=function(e){var o=l.value;if(o){window.getSelection().removeAllRanges(),window.getSelection().addRange(t.range),document.execCommand("createLink",!0,o),t.options.metaUrl&&t.validURL(o)&&t.getMeta(o).then((function(e){var o=e.url,n=e.image,i=e.title,l=e.description;o&&n&&i&&t.createMetaDataElement(o,n,i,l)}));var n=t.body.querySelectorAll("a");n[n.length-1].contentEditable="false",l.value="",t.toolbar.querySelector("#toolbar-link").onclick()}else t.body.focus(),t.closeLinkMenu()},o.appendChild(i),o.appendChild(l),e.appendChild(o),e.appendChild(n),e}},{key:"initImageMenu",value:function(){var t=this,e=document.createElement("div"),o=document.createElement("div"),n=document.createElement("button"),i=document.createElement("p"),l=document.createElement("input");e.id="image-menu",n.textContent="Insert Image",i.textContent="Image URL",l.type="text",i.style.margin="8px 10px 8px 0",i.style.fontSize="14px",n.style.cursor="pointer",e.dataset.active="false",e.style.display="none",e.style.position="absolute",e.style.right="10px",e.style.bottom="10px",e.style.backgroundColor="#fff",e.style.border="2px solid #ddd",e.style.padding="10px 20px",e.style.zIndex="1000",i.style.width="100%",i.style.textAlign="right",i.style.marginRight="10px",l.style.outline="none",l.style.padding="0 5px",l.placeholder="Insert a Link",o.style.display="flex",o.style.justifyContent="space-between",o.style.margin="5px 0",n.style.float="right",n.style.padding="6px 12px",n.style.border="1px solid #4cae4c",n.style.backgroundColor="#5cb85c",n.style.fontSize="14px",n.style.color="#fff",n.style.outline="none",n.onmouseenter=function(){return n.style.backgroundColor="#4cae4c"},n.onmouseleave=function(){return n.style.backgroundColor="#5cb85c"},o.appendChild(i),o.appendChild(l);var r=o.cloneNode(!0),a=r.querySelector("input"),s=r.querySelector("p");a.placeholder="Image Height",s.textContent="Height";var c=o.cloneNode(!0),d=c.querySelector("input"),u=c.querySelector("p");return d.placeholder="Image Height",u.textContent="Width",n.onclick=function(e){var o=l.value,n=a.value,i=d.value;if(o){window.getSelection().removeAllRanges(),window.getSelection().addRange(t.range),document.execCommand("insertImage",!0,o);var r=t.body.querySelectorAll("img");r[r.length-1].style.height="".concat(n,"px"),r[r.length-1].style.width="".concat(i,"px"),a.value="",d.value="",l.value="",t.toolbar.querySelector("#toolbar-image").onclick()}else t.body.focus(),t.closeImageMenu()},e.appendChild(r),e.appendChild(c),e.appendChild(o),e.appendChild(n),e}},{key:"initMetaDataSection",value:function(){var t=document.createElement("div");return t.classList.add("metadata-section"),t.style.display="flex",t.style.flexWrap="wrap",t.style.zIndex="500",t}},{key:"initFilesSection",value:function(){var t=this,e=document.createElement("div");return e.classList.add("files-section"),e.style.display="flex",e.style.flexWrap="wrap",e.style.zIndex="500",this.body.ondragenter=function(e){t.body.style.backgroundColor="#ddd"},this.body.ondragleave=function(e){t.body.style.backgroundColor="inherit"},this.body.ondrop=function(e){t.body.style.backgroundColor="inherit",e.preventDefault();var o=e.dataTransfer.files&&e.dataTransfer.files[0];t.attachFile(o)},this.editor.getfiles=function(){return t.getFiles()},e}},{key:"createFileElement",value:function(t,e){var o=this,n=document.createElement("div"),i=document.createElement("h4"),l=document.createElement("p"),r=document.createElement("p");i.textContent=t,l.textContent=e,r.textContent="X",n.dataset.fileindex=this.files.length-1,n.style.width="100%",n.style.display="flex",n.style.flexDirection="column",n.style.margin="10px",n.style.position="relative",i.style.fontWeight="bold",i.style.margin="0",l.style.fontSize="12px",l.style.margin="2px 0",r.style.margin="0",r.style.userSelect="none",r.style.color="black",r.style.position="absolute",r.style.right="5px",r.style.top="-5px",r.style.cursor="pointer",r.style.backgroundColor="#fff",r.onmouseenter=function(){return r.style.color="#ddd"},r.onmouseleave=function(){return r.style.color="black"},r.onclick=function(t){o.files.splice(t.target.parentElement.dataset.fileindex,1),t.target.parentElement.remove()},n.appendChild(i),n.appendChild(l),n.appendChild(r),this.filesSection.appendChild(n),this.editor.getfiles=function(){return o.getFiles()}}},{key:"createMetaDataElement",value:function(t,e,o,n){var i=document.createElement("div"),l=document.createElement("a"),r=document.createElement("img"),a=document.createElement("div"),s=document.createElement("h4"),c=document.createElement("p"),d=document.createElement("span");l.href=t,r.src=e,s.textContent=o,c.textContent=n,d.textContent="X",l.target="blank",i.style.width="100%",i.style.display="flex",i.style.margin="10px",i.style.position="relative",r.style.marginRight="10px",r.style.height="50px",r.style.width="75px",s.style.fontWeight="bold",s.style.margin="0",c.style.margin="0",d.style.userSelect="none",d.style.color="black",d.style.position="absolute",d.style.right="5px",d.style.top="-5px",d.style.cursor="pointer",d.style.backgroundColor="#fff",d.onmouseenter=function(){return d.style.color="#ddd"},d.onmouseleave=function(){return d.style.color="black"},d.onclick=function(t){return t.target.parentElement.remove()},l.appendChild(r),a.appendChild(s),a.appendChild(c),i.appendChild(l),i.appendChild(a),i.appendChild(d),this.metaDataSection.appendChild(i)}},{key:"constructSVG",value:function(t){var e=t.viewBox,o=t.d,n=this.options.toolbarOptionFillColor?this.options.toolbarOptionFillColor:"#333",i=document.createElement("span"),l='<svg width="'.concat("16",'" height="').concat("16",'" viewBox="').concat(e,'" xmlns="').concat("http://www.w3.org/2000/svg",'">'),r='<path fill="'.concat(n,'" d="').concat(o,'"/>');return i.innerHTML="".concat(l).concat(r,"</svg>"),i}},{key:"initResponsive",value:function(){var t=this,e=this;if(this.options.minimal)this.toolbarMenus.forEach((function(t){return t.style.display="none"})),this.toolbar.querySelector("#toolbar-strikethrough").style.display="none",this.toolbar.querySelector("#toolbar-image").style.display="none",this.toolbar.querySelector("#toolbar-insertOrderedList").style.display="none",this.toolbar.querySelector("#group-textAlign").style.display="none";else{var o=function(t){e.toolbarGroups.forEach((function(e){e.dataset.open="false",e.style.display=t?"none":"block",e.style.position=t?"absolute":"relative",e.style.bottom=t?"5px":"inherit",e.style.right=t?"5px":"inherit",e.style.backgroundColor=t?"#fff":"inherit",e.style.border=t?"2px solid #ddd":"none"})),e.toolbarMenus.forEach((function(o){o.style.padding="0 10px",o.style.cursor="pointer",o.style.userSelect="none",o.style.display=t?"block":"none",o.onclick=function(t){var n;"false"===(n=e.toolbar.querySelector("#group-".concat(o.id.split("-")[1]))).dataset.open?(e.toolbarGroups.forEach((function(t){"true"===t.dataset.open&&(t.style.display="none",t.dataset.open="false")})),n.style.display="block",n.style.padding="5px",n.dataset.open="true"):(n.style.display="none",n.dataset.open="false"),e.body.focus()}}))},n=function(){i=window.matchMedia("(max-width: 700px)").matches,o(i)},i=window.matchMedia("(max-width: 700px)").matches;n(),window.onresize=function(){t.toolbarGroups.forEach((function(t){return t.style.padding="0"})),t.closeLinkMenu(),t.closeImageMenu(),n()}}}},{key:"initOverflow",value:function(){var t=this,e=this.body.onfocus;this.body.onfocus=function(){e&&e(),t.overflow()};var o=this.body.onblur;this.body.onblur=function(){o&&o(),t.overflow()},this.body.onkeypress=function(){return t.overflow()}}},{key:"getFiles",value:function(){return this.files}},{key:"getContent",value:function(){return this.body.innerHTML}},{key:"getRange",value:function(){return window.getSelection().getRangeAt(0)}},{key:"getMeta",value:function(t){return fetch(this.options.metaUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetUrl:t})}).then((function(t){return t.json()}))}},{key:"validURL",value:function(t){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(t)}},{key:"overflow",value:function(){var t=this.body;t.scrollHeight>t.clientHeight?t.style.overflowY="scroll":t.style.overflowY="hidden",t.scrollWidth>t.clientWidth?t.style.overflowX="scroll":t.style.overflowX="hidden"}},{key:"formatBytes",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(0===t)return"0 Bytes";var o=1024,n=e<0?0:e,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],l=Math.floor(Math.log(t)/Math.log(o));return parseFloat((t/Math.pow(o,l)).toFixed(n))+" "+i[l]}},{key:"validateFile",value:function(t){var e=t.type.split("/").pop();return this.options.extensions.includes(".".concat(e))}},{key:"attachFile",value:function(t){this.validateFile(t)?(this.files.push(t),this.createFileElement(t.name,this.formatBytes(t.size))):this.fileInvalid()}},{key:"fileInvalid",value:function(){var t=this;this.body.style.transition="background-color .5s",this.body.style.backgroundColor="#d9534f",setTimeout((function(){t.body.style.backgroundColor="inherit",setTimeout((function(){return t.body.style.transition="none"}),500)}),500)}},{key:"openLinkMenu",value:function(){this.closeImageMenu(),this.linkMenu.dataset.active="true",this.linkMenu.style.display="block"}},{key:"openImageMenu",value:function(){this.closeLinkMenu(),this.imageMenu.dataset.active="true",this.imageMenu.style.display="block"}},{key:"closeLinkMenu",value:function(){this.linkMenu.dataset.active="false",this.linkMenu.style.display="none"}},{key:"closeImageMenu",value:function(){this.imageMenu.dataset.active="false",this.imageMenu.style.display="none"}},{key:"setContent",value:function(t){this.body.innerHTML=t}}])&&n(s.prototype,c),d&&n(s,d),t}();t.default=s})?n.apply(e,i):n)||(t.exports=l)}])}));
-\ No newline at end of file
+/*! For license information please see striveneditor.js.LICENSE */
+!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.striveneditor=t():n.striveneditor=t()}(window,(function(){return function(n){var t={};function e(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=n,e.c=t,e.d=function(n,t,o){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:o})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var i in n)e.d(o,i,function(t){return n[t]}.bind(null,i));return o},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s="./src/striveneditor.js")}({"./src/striveneditor.js":function(module,exports,__webpack_require__){eval('var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === \'function\' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else { var mod; }\n})(this, function (_exports) {\n "use strict";\n\n Object.defineProperty(_exports, "__esModule", {\n value: true\n });\n _exports["default"] = void 0;\n\n function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\n function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }\n\n function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }\n\n function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\n function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\n function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n // Font Awesome Imports\n // import { dom } from \'@fortawesome/fontawesome-svg-core\';\n // import { library as faLib } from "@fortawesome/fontawesome-svg-core";\n // import { faFont } from "@fortawesome/free-solid-svg-icons/faFont";\n // import { faBold } from "@fortawesome/free-solid-svg-icons/faBold";\n // import { faItalic } from "@fortawesome/free-solid-svg-icons/faItalic";\n // import { faUnderline } from "@fortawesome/free-solid-svg-icons/faUnderline";\n // import { faStrikethrough } from "@fortawesome/free-solid-svg-icons/faStrikethrough";\n // import { faList } from "@fortawesome/free-solid-svg-icons/faList";\n // import { faListOl } from "@fortawesome/free-solid-svg-icons/faListOl";\n // import { faListUl } from "@fortawesome/free-solid-svg-icons/faListUl";\n // import { faAlignJustify } from "@fortawesome/free-solid-svg-icons/faAlignJustify";\n // import { faIndent } from "@fortawesome/free-solid-svg-icons/faIndent";\n // import { faAlignLeft } from "@fortawesome/free-solid-svg-icons/faAlignLeft";\n // import { faAlignCenter } from "@fortawesome/free-solid-svg-icons/faAlignCenter";\n // import { faAlignRight } from "@fortawesome/free-solid-svg-icons/faAlignRight";\n // import { faPaperclip } from "@fortawesome/free-solid-svg-icons/faPaperclip";\n // import { faLink } from "@fortawesome/free-solid-svg-icons/faLink";\n // import { faImage } from "@fortawesome/free-solid-svg-icons/faImage";\n // import { faPaperPlane } from "@fortawesome/free-solid-svg-icons/faPaperPlane";\n // faLib.add(faFont);\n // faLib.add(faBold);\n // faLib.add(faItalic);\n // faLib.add(faUnderline);\n // faLib.add(faStrikethrough);\n // faLib.add(faList);\n // faLib.add(faListOl);\n // faLib.add(faListUl);\n // faLib.add(faAlignJustify);\n // faLib.add(faIndent);\n // faLib.add(faAlignLeft);\n // faLib.add(faAlignCenter);\n // faLib.add(faAlignRight);\n // faLib.add(faPaperclip);\n // faLib.add(faLink);\n // faLib.add(faImage);\n // faLib.add(faPaperPlane);\n // dom.watch();\n var EXTENSIONS = [".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".tif", ".jpeg", ".jpg", ".gif", ".bmp", ".txt", ".csv", ".png", ".msg", ".wav", ".mp3", ".mp4", ".zip", ".rtf", ".eps", ".ai", ".psd", ".avi", ".mov", ".wmv", ".cfg", ".wss", ".vsd", ".vsdx", ".tsd", ".lic"];\n var FONTPACK = "fas";\n var OPTIONGROUPS = {\n textDecoration: {\n menu: {\n viewBox: "0 0 1792 1792",\n d: "M789 559l-170 450q33 0 136.5 2t160.5 2q19 0 57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29 31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15 34 58 144.5t72 168.5q20 45 35 57 19 15 88 29.5t84 20.5q6 38 6 57 0 5-.5 13.5t-.5 12.5q-63 0-190-8t-191-8q-76 0-215 7t-178 8q0-43 4-78l131-28q1 0 12.5-2.5t15.5-3.5 14.5-4.5 15-6.5 11-8 9-11 2.5-14q0-16-31-96.5t-72-177.5-42-100l-450-2q-26 58-76.5 195.5t-50.5 162.5q0 22 14 37.5t43.5 24.5 48.5 13.5 57 8.5 41 4q1 19 1 58 0 9-2 27-58 0-174.5-10t-174.5-10q-8 0-26.5 4t-21.5 4q-80 14-188 14z"\n },\n group: [{\n bold: {\n viewBox: "0 0 1792 1792",\n d: "M747 1521q74 32 140 32 376 0 376-335 0-114-41-180-27-44-61.5-74t-67.5-46.5-80.5-25-84-10.5-94.5-2q-73 0-101 10 0 53-.5 159t-.5 158q0 8-1 67.5t-.5 96.5 4.5 83.5 12 66.5zm-14-746q42 7 109 7 82 0 143-13t110-44.5 74.5-89.5 25.5-142q0-70-29-122.5t-79-82-108-43.5-124-14q-50 0-130 13 0 50 4 151t4 152q0 27-.5 80t-.5 79q0 46 1 69zm-541 889l2-94q15-4 85-16t106-27q7-12 12.5-27t8.5-33.5 5.5-32.5 3-37.5.5-34v-65.5q0-982-22-1025-4-8-22-14.5t-44.5-11-49.5-7-48.5-4.5-30.5-3l-4-83q98-2 340-11.5t373-9.5q23 0 68 .5t68 .5q70 0 136.5 13t128.5 42 108 71 74 104.5 28 137.5q0 52-16.5 95.5t-39 72-64.5 57.5-73 45-84 40q154 35 256.5 134t102.5 248q0 100-35 179.5t-93.5 130.5-138 85.5-163.5 48.5-176 14q-44 0-132-3t-132-3q-106 0-307 11t-231 12z"\n }\n }, {\n italic: {\n viewBox: "0 0 1792 1792",\n d: "M384 1662l17-85q22-7 61.5-16.5t72-19 59.5-23.5q28-35 41-101 1-7 62-289t114-543.5 52-296.5v-25q-24-13-54.5-18.5t-69.5-8-58-5.5l19-103q33 2 120 6.5t149.5 7 120.5 2.5q48 0 98.5-2.5t121-7 98.5-6.5q-5 39-19 89-30 10-101.5 28.5t-108.5 33.5q-8 19-14 42.5t-9 40-7.5 45.5-6.5 42q-27 148-87.5 419.5t-77.5 355.5q-2 9-13 58t-20 90-16 83.5-6 57.5l1 18q17 4 185 31-3 44-16 99-11 0-32.5 1.5t-32.5 1.5q-29 0-87-10t-86-10q-138-2-206-2-51 0-143 9t-121 11z"\n }\n }, {\n underline: {\n viewBox: "0 0 1792 1792",\n d: "M176 223q-37-2-45-4l-3-88q13-1 40-1 60 0 112 4 132 7 166 7 86 0 168-3 116-4 146-5 56 0 86-2l-1 14 2 64v9q-60 9-124 9-60 0-79 25-13 14-13 132 0 13 .5 32.5t.5 25.5l1 229 14 280q6 124 51 202 35 59 96 92 88 47 177 47 104 0 191-28 56-18 99-51 48-36 65-64 36-56 53-114 21-73 21-229 0-79-3.5-128t-11-122.5-13.5-159.5l-4-59q-5-67-24-88-34-35-77-34l-100 2-14-3 2-86h84l205 10q76 3 196-10l18 2q6 38 6 51 0 7-4 31-45 12-84 13-73 11-79 17-15 15-15 41 0 7 1.5 27t1.5 31q8 19 22 396 6 195-15 304-15 76-41 122-38 65-112 123-75 57-182 89-109 33-255 33-167 0-284-46-119-47-179-122-61-76-83-195-16-80-16-237v-333q0-188-17-213-25-36-147-39zm1488 1409v-64q0-14-9-23t-23-9h-1472q-14 0-23 9t-9 23v64q0 14 9 23t23 9h1472q14 0 23-9t9-23z"\n }\n }, {\n strikethrough: {\n viewBox: "0 0 1792 1792",\n d: "M1760 896q14 0 23 9t9 23v64q0 14-9 23t-23 9h-1728q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h1728zm-1277-64q-28-35-51-80-48-98-48-188 0-181 134-309 133-127 393-127 50 0 167 19 66 12 177 48 10 38 21 118 14 123 14 183 0 18-5 45l-12 3-84-6-14-2q-50-149-103-205-88-91-210-91-114 0-182 59-67 58-67 146 0 73 66 140t279 129q69 20 173 66 58 28 95 52h-743zm507 256h411q7 39 7 92 0 111-41 212-23 56-71 104-37 35-109 81-80 48-153 66-80 21-203 21-114 0-195-23l-140-40q-57-16-72-28-8-8-8-22v-13q0-108-2-156-1-30 0-68l2-37v-44l102-2q15 34 30 71t22.5 56 12.5 27q35 57 80 94 43 36 105 57 59 22 132 22 64 0 139-27 77-26 122-86 47-61 47-129 0-84-81-157-34-29-137-71z"\n }\n }]\n },\n listOptions: {\n menu: {\n viewBox: "0 0 1792 1792",\n d: "M256 1312v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm-1536-1152v192q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5zm1536 768v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1344q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1344q13 0 22.5 9.5t9.5 22.5z"\n },\n group: [{\n insertOrderedList: {\n viewBox: "0 0 1792 1792",\n d: "M381 1620q0 80-54.5 126t-135.5 46q-106 0-172-66l57-88q49 45 106 45 29 0 50.5-14.5t21.5-42.5q0-64-105-56l-26-56q8-10 32.5-43.5t42.5-54 37-38.5v-1q-16 0-48.5 1t-48.5 1v53h-106v-152h333v88l-95 115q51 12 81 49t30 88zm2-627v159h-362q-6-36-6-54 0-51 23.5-93t56.5-68 66-47.5 56.5-43.5 23.5-45q0-25-14.5-38.5t-39.5-13.5q-46 0-81 58l-85-59q24-51 71.5-79.5t105.5-28.5q73 0 123 41.5t50 112.5q0 50-34 91.5t-75 64.5-75.5 50.5-35.5 52.5h127v-60h105zm1409 319v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm-1408-899v99h-335v-99h107q0-41 .5-121.5t.5-121.5v-12h-2q-8 17-50 54l-71-76 136-127h106v404h108zm1408 387v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-14 9-23t23-9h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5z"\n }\n }, {\n insertUnorderedList: {\n viewBox: "0 0 1792 1792",\n d: "M384 1408q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm0-512q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm-1408-928q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1408 416v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5zm0-512v192q0 13-9.5 22.5t-22.5 9.5h-1216q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1216q13 0 22.5 9.5t9.5 22.5"\n }\n }]\n },\n textAlign: {\n menu: {\n viewBox: "0 0 1792 1792",\n d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45z"\n },\n group: [{\n indent: {\n viewBox: "0 0 1792 1792",\n d: "M352 832q0 14-9 23l-288 288q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-576q0-13 9.5-22.5t22.5-9.5q14 0 23 9l288 288q9 9 9 23zm1440 480v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1088q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1088q13 0 22.5 9.5t9.5 22.5zm0-384v192q0 13-9.5 22.5t-22.5 9.5h-1728q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h1728q13 0 22.5 9.5t9.5 22.5z"\n }\n }, {\n justifyLeft: {\n viewBox: "0 0 1792 1792",\n d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"\n }\n }, {\n justifyCenter: {\n viewBox: "0 0 1792 1792",\n d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-896q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h896q26 0 45 19t19 45zm256-384v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm-384-384v128q0 26-19 45t-45 19h-640q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h640q26 0 45 19t19 45z"\n }\n }, {\n justifyRight: {\n viewBox: "0 0 1792 1792",\n d: "M1792 1344v128q0 26-19 45t-45 19h-1664q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1664q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1280q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1280q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1536q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1536q26 0 45 19t19 45zm0-384v128q0 26-19 45t-45 19h-1152q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1152q26 0 45 19t19 45z"\n }\n }]\n },\n attachments: {\n menu: {\n viewBox: "0 0 1792 1792",\n d: "M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"\n },\n group: [{\n attachment: {\n viewBox: "0 0 1792 1792",\n d: "M1596 1385q0 117-79 196t-196 79q-135 0-235-100l-777-776q-113-115-113-271 0-159 110-270t269-111q158 0 273 113l605 606q10 10 10 22 0 16-30.5 46.5t-46.5 30.5q-13 0-23-10l-606-607q-79-77-181-77-106 0-179 75t-73 181q0 105 76 181l776 777q63 63 145 63 64 0 106-42t42-106q0-82-63-145l-581-581q-26-24-60-24-29 0-48 19t-19 48q0 32 25 59l410 410q10 10 10 22 0 16-31 47t-47 31q-12 0-22-10l-410-410q-63-61-63-149 0-82 57-139t139-57q88 0 149 63l581 581q100 98 100 235z"\n }\n }, {\n link: {\n viewBox: "0 0 1792 1792",\n d: "M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"\n }\n }, {\n image: {\n viewBox: "0 0 2048 1792",\n d: "M704 576q0 80-56 136t-136 56-136-56-56-136 56-136 136-56 136 56 56 136zm1024 384v448h-1408v-192l320-320 160 160 512-512zm96-704h-1600q-13 0-22.5 9.5t-9.5 22.5v1216q0 13 9.5 22.5t22.5 9.5h1600q13 0 22.5-9.5t9.5-22.5v-1216q0-13-9.5-22.5t-22.5-9.5zm160 32v1216q0 66-47 113t-113 47h-1600q-66 0-113-47t-47-113v-1216q0-66 47-113t113-47h1600q66 0 113 47t47 113z"\n }\n }]\n }\n };\n var DEFAULTOPTIONS = ["bold", "italic", "underline", "strikethrough", "insertOrderedList", "insertUnorderedList", "indent", "justifyLeft", "justifyCenter", "justifyRight", "attachment", "link", "image"];\n\n var StrivenEditor =\n /*#__PURE__*/\n function () {\n function StrivenEditor(el, options) {\n _classCallCheck(this, StrivenEditor);\n\n this.range = new Range();\n this.files = [];\n this.optionGroups = OPTIONGROUPS;\n\n if (options) {\n this.options = options;\n options.fontPack || (this.options.fontPack = FONTPACK);\n options.extensions || (this.options.extensions = EXTENSIONS);\n options.toolbarOptions || (this.options.toolbarOptions = DEFAULTOPTIONS);\n } else {\n this.options = {\n fontPack: FONTPACK,\n extensions: EXTENSIONS,\n DEFAULTOPTIONS: DEFAULTOPTIONS\n };\n }\n\n this.initEditor(el);\n this.initResponsive();\n this.initOverflow();\n }\n\n _createClass(StrivenEditor, [{\n key: "initEditor",\n value: function initEditor(el) {\n var _this = this;\n\n this.editor = el;\n this.toolbar = this.initToolbar();\n this.body = this.initBody();\n this.linkMenu = this.initLinkMenu();\n this.imageMenu = this.initImageMenu();\n this.metaDataSection = this.initMetaDataSection();\n this.filesSection = this.initFilesSection();\n this.editor.style.border = "2px solid #ddd";\n this.editor.style.display = "flex";\n this.editor.style.position = "relative";\n this.editor.style.flexDirection = "column";\n this.editor.style.fontFamily = "Arial";\n this.editor.style.minHeight = "auto";\n this.editor.style.maxHeight = "auto";\n this.editor.style.maxWidth = "100%"; // Toolbar Hide\n\n if (this.options.toolbarHide) {\n this.toolbarSend.style.display = "none";\n this.toolbarOptionsGroup.style.display = "none";\n\n this.body.onfocus = function () {\n _this.overflow();\n\n _this.toolbarSlideUp();\n };\n\n this.body.onblur = function () {\n _this.overflow();\n\n setTimeout(function () {\n if (document.activeElement !== _this.body && document.activeElement !== _this.linkMenu.querySelector(\'input\') && document.activeElement !== _this.imageMenu.querySelectorAll(\'input\')[0] && document.activeElement !== _this.imageMenu.querySelectorAll(\'input\')[1] && document.activeElement !== _this.imageMenu.querySelectorAll(\'input\')[2]) {\n _this.toolbarSlideDown();\n }\n }, 2000);\n };\n } // Toolbar Options\n\n\n this.toolbarOptions.forEach(function (optionEl) {\n // Assign Styles\n // optionEl.style.padding = "0 10px";\n optionEl.style.cursor = "pointer";\n optionEl.style.userSelect = "none"; // Execute Toolbar Commands\n\n var optionElClick = optionEl.onclick;\n\n optionEl.onclick = function (e) {\n _this.body.focus();\n\n var command = optionEl.id.split("-")[1];\n\n switch (command) {\n case "insertOrderedList":\n document.execCommand("indent", true);\n document.execCommand(command, true);\n break;\n\n case "insertUnorderedList":\n document.execCommand("indent", true);\n document.execCommand(command, true);\n break;\n\n case "attachment":\n var attachmentInput = document.createElement("input");\n attachmentInput.style.display = "none";\n attachmentInput.type = "file";\n attachmentInput.click();\n\n attachmentInput.onchange = function (e) {\n return _this.attachFile(attachmentInput.files[0]);\n };\n\n break;\n\n case "link":\n if (_this.linkMenu.dataset.active === "true") {\n _this.closeLinkMenu();\n } else {\n _this.openLinkMenu();\n\n _this.range = _this.getRange();\n\n _this.linkMenu.querySelector(\'input\').focus();\n }\n\n break;\n\n case "image":\n if (_this.imageMenu.dataset.active === "true") {\n _this.closeImageMenu();\n } else {\n _this.openImageMenu();\n\n _this.range = _this.getRange();\n\n _this.imageMenu.querySelector(\'input\').focus();\n }\n\n break;\n\n default:\n document.execCommand(command, true);\n break;\n }\n\n optionElClick && optionElClick();\n };\n }); // Get Content from Editor\n\n this.editor.getcontent = function () {\n return _this.getContent();\n }; // Get Editor Range\n\n\n this.editor.getrange = function () {\n return _this.getRange();\n };\n\n this.editor.appendChild(this.toolbar);\n this.editor.appendChild(this.body);\n this.editor.appendChild(this.linkMenu);\n this.editor.appendChild(this.imageMenu);\n this.editor.appendChild(this.metaDataSection);\n this.editor.appendChild(this.filesSection); // Reposition Toolbar\n\n if (this.options.toolbarBottom) {\n this.editor.removeChild(this.toolbar);\n this.editor.append(this.toolbar);\n }\n }\n }, {\n key: "toolbarSlideUp",\n value: function toolbarSlideUp() {\n var that = this;\n var height = this.toolbar.offsetHeight;\n var id = setInterval(frame, 5);\n\n function frame() {\n if (height >= 40) {\n that.options.onToolbarSend && (that.toolbarSend.style.display = "flex");\n that.toolbarOptionsGroup.style.display = "flex";\n clearInterval(id);\n } else {\n height++;\n that.toolbar.style.minHeight = "".concat(height, "px");\n }\n }\n }\n }, {\n key: "toolbarSlideDown",\n value: function toolbarSlideDown() {\n var that = this;\n this.options.onToolbarSend && (this.toolbarSend.style.display = "none");\n this.toolbarOptionsGroup.style.display = "none";\n var height = 40;\n var id = setInterval(frame, 5);\n\n function frame() {\n if (height === 0) {\n clearInterval(id);\n } else {\n height--;\n that.toolbar.style.minHeight = "".concat(height, "px");\n }\n }\n }\n }, {\n key: "initToolbar",\n value: function initToolbar() {\n var _this2 = this;\n\n var toolbar = document.createElement("div");\n this.toolbarOptionsGroup = document.createElement("div");\n var groups = Object.keys(this.optionGroups);\n toolbar.classList.add("toolbar");\n toolbar.style.display = "flex";\n toolbar.style.justifyContent = "space-between";\n toolbar.style.alignItems = "center";\n toolbar.style.flexWrap = "wrap";\n toolbar.style.minHeight = this.options.toolbarHide ? "0" : "40px";\n toolbar.style.position = "relative";\n this.toolbarOptionsGroup.classList.add("toolbar-options");\n this.toolbarOptionsGroup.style.margin = "0 10px";\n this.toolbarOptionsGroup.style.display = this.options.toolbarHide ? "none" : "flex"; //iterate groups\n\n groups.forEach(function (group) {\n // add menu to toolbarOptions\n var toolbarMenu = document.createElement("div"); // const toolbarMenuIcon = document.createElement("i");\n\n toolbarMenu.classList.add("toolbar-menu");\n toolbarMenu.id = "menu-".concat(group); // toolbarMenuIcon.classList.add(this.options.fontPack);\n // toolbarMenuIcon.classList.add(this.optionGroups[group].menu);\n\n toolbarMenu.appendChild(_this2.constructSVG(_this2.optionGroups[group].menu));\n\n _this2.toolbarOptionsGroup.appendChild(toolbarMenu); // add group to toolbarOptions\n\n\n var toolbarGroup = document.createElement("div");\n toolbarGroup.classList.add("toolbar-group");\n toolbarGroup.id = "group-".concat(group);\n\n _this2.options.toolbarOptions.forEach(function (option) {\n var toolbarOption = _this2.optionGroups[group].group.filter(function (group) {\n return group[option];\n })[0];\n\n if (toolbarOption) {\n var svgData = toolbarOption[option];\n\n var optionSpan = _this2.constructSVG(svgData);\n\n optionSpan.id = "toolbar-".concat(option);\n optionSpan.style.margin = "0 10px";\n toolbarGroup.appendChild(optionSpan);\n }\n });\n\n _this2.toolbarOptionsGroup.appendChild(toolbarGroup); // this.optionGroups[group].group.forEach((option) => {\n // const toolbarCommand = Object.keys(option)[0];\n // if(this.options.toolbarOptions.includes(toolbarCommand)){\n // const optionSpan = this.constructSVG(option[toolbarCommand]);\n // // const optionIcon = document.createElement("i");\n // optionSpan.id = `toolbar-${toolbarCommand}`;\n // optionSpan.style.margin = "0 10px";\n // // optionIcon.classList.add(this.options.fontPack);\n // // optionIcon.classList.add(option[toolbarCommand]);\n // // optionSpan.appendChild(optionIcon);\n // toolbarGroup.appendChild(optionSpan);\n // }\n // })\n // this.toolbarOptionsGroup.appendChild(toolbarGroup);\n\n }); // toolbar group for custom options\n\n var customOptions = this.options.toolbarOptions.filter(function (option) {\n return _typeof(option) === "object";\n });\n\n if (customOptions.length > 0) {\n this.customToolbarMenu = document.createElement("div");\n this.customToolbarMenu.classList.add("toolbar-menu");\n this.customToolbarMenu.id = "menu-custom";\n var customSVGViewBox = "0 0 1792 1792";\n var customSVGD = "M1088 1248v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h192q40 0 68 28t28 68z";\n this.customToolbarMenu.appendChild(this.constructSVG({\n viewBox: customSVGViewBox,\n d: customSVGD\n }));\n this.toolbarOptionsGroup.appendChild(this.customToolbarMenu);\n this.customToolbarGroup = document.createElement("div");\n this.customToolbarGroup.classList.add("toolbar-group");\n this.customToolbarGroup.id = "group-custom";\n customOptions.forEach(function (customOption) {\n var icon = customOption.icon,\n handler = customOption.handler;\n\n var optionSpan = _this2.constructSVG(icon);\n\n optionSpan.id = "toolbar-customOption";\n optionSpan.style.margin = "0 10px";\n\n optionSpan.onclick = function () {\n return handler();\n };\n\n _this2.customToolbarGroup.appendChild(optionSpan);\n });\n this.toolbarOptionsGroup.appendChild(this.customToolbarGroup);\n }\n\n toolbar.appendChild(this.toolbarOptionsGroup); //add toolbar-send\n\n var toolbarSend = document.createElement("div"); // const toolbarSendIcon = document.createElement("i");\n\n toolbarSend.id = "toolbar-send"; // toolbarSendIcon.classList.add(this.options.fontPack);\n // toolbarSendIcon.classList.add("fa-paper-plane");\n\n toolbarSend.style.display = "none";\n toolbarSend.style.color = "#fff";\n toolbarSend.style.backgroundColor = "#5cb85c";\n toolbarSend.style.minHeight = this.options.toolbarHide ? "40px" : this.toolbar.style.minHeight;\n toolbarSend.style.width = "50px";\n toolbarSend.style.textAlign = "center";\n toolbarSend.style.justifyContent = "center";\n toolbarSend.style.alignContent = "center";\n toolbarSend.style.alignItems = "center";\n toolbarSend.style.cursor = "pointer";\n toolbarSend.style.border = "1px solid #4cae4c";\n toolbarSend.style.alignSelf = "flex-end";\n this.options.onToolbarSend && (toolbarSend.onclick = function () {\n return _this2.options.onToolbarSend();\n });\n this.options.onToolbarSend && !this.options.toolbarHide && (toolbarSend.style.display = "flex");\n\n toolbarSend.onmouseenter = function () {\n return toolbarSend.style.backgroundColor = "#4cae4c";\n };\n\n toolbarSend.onmouseleave = function () {\n return toolbarSend.style.backgroundColor = "#5cb85c";\n };\n\n var toolbarSendSVG = this.constructSVG({\n viewBox: "0 0 1792 1792",\n d: "M1764 11q33 24 27 64l-256 1536q-5 29-32 45-14 8-31 8-11 0-24-5l-453-185-242 295q-18 23-49 23-13 0-22-4-19-7-30.5-23.5t-11.5-36.5v-349l864-1059-1069 925-395-162q-37-14-40-55-2-40 32-59l1664-960q15-9 32-9 20 0 36 11z"\n });\n toolbarSendSVG.querySelector(\'path\').setAttribute("fill", "#fff");\n toolbarSend.appendChild(toolbarSendSVG);\n toolbar.appendChild(toolbarSend);\n this.toolbarOptions = toolbar.querySelectorAll("span");\n this.toolbarGroups = _toConsumableArray(toolbar.getElementsByClassName("toolbar-group"));\n this.toolbarMenus = _toConsumableArray(toolbar.getElementsByClassName("toolbar-menu"));\n this.toolbarSend = toolbar.querySelector("#toolbar-send");\n this.toolbarMenus.push(this.customToolbarMenu);\n this.toolbarGroups.push(this.customToolbarGroup); // Remove menu that has no options enabled\n\n this.toolbarGroups.forEach(function (group) {\n if (group.children.length < 1) {\n var groupName = group.id.split("-")[1];\n\n var menu = _this2.toolbarMenus.filter(function (menu) {\n return menu.id.split("-")[1] === groupName;\n })[0];\n\n menu.remove();\n }\n });\n return toolbar;\n }\n }, {\n key: "initBody",\n value: function initBody() {\n var _this3 = this;\n\n var body = document.createElement("div");\n body.classList.add("body");\n body.contentEditable = "true";\n body.style.outline = "none";\n body.style.padding = "10px 20px";\n body.style.height = this.editor.style.height;\n body.style.minHeight = this.editor.style.minHeight;\n body.style.maxHeight = this.editor.style.maxHeight; // Paste Handler\n\n body.onpaste = function (e) {\n function dataURLtoFile(dataurl, filename) {\n var arr = dataurl.split(\',\'),\n mime = arr[0].match(/:(.*?);/)[1],\n bstr = atob(arr[1]),\n n = bstr.length,\n u8arr = new Uint8Array(n);\n\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n\n var file = new File([u8arr], filename, {\n type: mime\n });\n return new File([u8arr], "".concat(file.name, ".").concat(file.type.split(\'/\').pop()), {\n type: file.type\n });\n }\n\n var convertImage = function convertImage(file) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.readAsDataURL(file);\n\n reader.onload = function () {\n return resolve(reader.result);\n };\n\n reader.onerror = function (error) {\n return reject(error);\n };\n });\n };\n\n if (e.clipboardData.files.length > 0 && e.clipboardData.files[0].type.includes("image")) {\n convertImage(e.clipboardData.files[0]).then(function (res) {\n document.execCommand("insertImage", true, res);\n _this3.options.uploadOnPaste && _this3.attachFile(dataURLtoFile(res, "pastedimage"));\n\n _this3.overflow();\n });\n }\n\n if (e.clipboardData.items.length > 0 && e.clipboardData.items[0].type === "text/plain") {\n e.clipboardData.items[0].getAsString(function (string) {\n if (_this3.options.metaUrl && _this3.validURL(string)) {\n _this3.getMeta(string).then(function (res) {\n var url = res.url,\n title = res.title,\n image = res.image,\n description = res.description;\n url && title && image && _this3.createMetaDataElement(url, image, title, description);\n });\n }\n });\n }\n\n _this3.overflow();\n };\n\n return body;\n }\n }, {\n key: "initLinkMenu",\n value: function initLinkMenu() {\n var _this4 = this;\n\n var linkMenu = document.createElement("div");\n var linkMenuForm = document.createElement("div");\n var linkMenuButton = document.createElement("button");\n var linkMenuFormLabel = document.createElement("p");\n var linkMenuFormInput = document.createElement("input");\n linkMenu.id = "link-menu";\n linkMenuButton.textContent = "Insert Link";\n linkMenuFormLabel.textContent = "Web Address";\n linkMenuFormInput.type = "text";\n linkMenuFormLabel.style.margin = "8px 10px 8px 0";\n linkMenuFormLabel.style.fontSize = "14px";\n linkMenuButton.style.cursor = "pointer";\n linkMenu.dataset.active = "false";\n linkMenu.style.display = "none";\n linkMenu.style.position = "absolute";\n linkMenu.style.right = "10px";\n linkMenu.style.bottom = "10px";\n linkMenu.style.backgroundColor = "#fff";\n linkMenu.style.border = "2px solid #ddd";\n linkMenu.style.padding = "10px 20px";\n linkMenu.style.zIndex = "1000";\n linkMenuFormLabel.style.width = "100%";\n linkMenuFormLabel.style.textAlign = "right";\n linkMenuFormLabel.style.marginRight = "10px";\n linkMenuFormInput.style.outline = "none";\n linkMenuFormInput.style.padding = "0 5px";\n linkMenuFormInput.placeholder = "Insert a Link";\n linkMenuForm.style.display = "flex";\n linkMenuForm.style.justifyContent = "space-between";\n linkMenuForm.style.margin = "5px 0";\n linkMenuButton.style["float"] = "right";\n linkMenuButton.style.padding = "6px 12px";\n linkMenuButton.style.border = "1px solid #4cae4c";\n linkMenuButton.style.backgroundColor = "#5cb85c";\n linkMenuButton.style.fontSize = "14px";\n linkMenuButton.style.color = "#fff";\n linkMenuButton.style.outline = "none";\n\n linkMenuButton.onmouseenter = function () {\n return linkMenuButton.style.backgroundColor = "#4cae4c";\n };\n\n linkMenuButton.onmouseleave = function () {\n return linkMenuButton.style.backgroundColor = "#5cb85c";\n };\n\n linkMenuButton.onclick = function (e) {\n var linkValue = linkMenuFormInput.value;\n\n if (linkValue) {\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(_this4.range);\n document.execCommand("createLink", true, linkValue);\n\n if (_this4.options.metaUrl && _this4.validURL(linkValue)) {\n _this4.getMeta(linkValue).then(function (res) {\n var url = res.url,\n image = res.image,\n title = res.title,\n description = res.description;\n url && image && title && _this4.createMetaDataElement(url, image, title, description);\n });\n }\n\n var bodyLinks = _this4.body.querySelectorAll("a");\n\n bodyLinks[bodyLinks.length - 1].contentEditable = "false";\n linkMenuFormInput.value = "";\n\n _this4.toolbar.querySelector("#toolbar-link").onclick();\n } else {\n _this4.body.focus();\n\n _this4.closeLinkMenu();\n }\n };\n\n linkMenuForm.appendChild(linkMenuFormLabel);\n linkMenuForm.appendChild(linkMenuFormInput);\n linkMenu.appendChild(linkMenuForm);\n linkMenu.appendChild(linkMenuButton);\n return linkMenu;\n }\n }, {\n key: "initImageMenu",\n value: function initImageMenu() {\n var _this5 = this;\n\n var imageMenu = document.createElement("div");\n var imageMenuForm = document.createElement("div");\n var imageMenuButton = document.createElement("button");\n var imageMenuFormLabel = document.createElement("p");\n var imageMenuFormSourceInput = document.createElement("input");\n imageMenu.id = "image-menu";\n imageMenuButton.textContent = "Insert Image";\n imageMenuFormLabel.textContent = "Image URL";\n imageMenuFormSourceInput.type = "text";\n imageMenuFormLabel.style.margin = "8px 10px 8px 0";\n imageMenuFormLabel.style.fontSize = "14px";\n imageMenuButton.style.cursor = "pointer";\n imageMenu.dataset.active = "false";\n imageMenu.style.display = "none";\n imageMenu.style.position = "absolute";\n imageMenu.style.right = "10px";\n imageMenu.style.bottom = "10px";\n imageMenu.style.backgroundColor = "#fff";\n imageMenu.style.border = "2px solid #ddd";\n imageMenu.style.padding = "10px 20px";\n imageMenu.style.zIndex = "1000";\n imageMenuFormLabel.style.width = "100%";\n imageMenuFormLabel.style.textAlign = "right";\n imageMenuFormLabel.style.marginRight = "10px";\n imageMenuFormSourceInput.style.outline = "none";\n imageMenuFormSourceInput.style.padding = "0 5px";\n imageMenuFormSourceInput.placeholder = "Insert a Link";\n imageMenuForm.style.display = "flex";\n imageMenuForm.style.justifyContent = "space-between";\n imageMenuForm.style.margin = "5px 0";\n imageMenuButton.style["float"] = "right";\n imageMenuButton.style.padding = "6px 12px";\n imageMenuButton.style.border = "1px solid #4cae4c";\n imageMenuButton.style.backgroundColor = "#5cb85c";\n imageMenuButton.style.fontSize = "14px";\n imageMenuButton.style.color = "#fff";\n imageMenuButton.style.outline = "none";\n\n imageMenuButton.onmouseenter = function () {\n return imageMenuButton.style.backgroundColor = "#4cae4c";\n };\n\n imageMenuButton.onmouseleave = function () {\n return imageMenuButton.style.backgroundColor = "#5cb85c";\n };\n\n imageMenuForm.appendChild(imageMenuFormLabel);\n imageMenuForm.appendChild(imageMenuFormSourceInput); // Height Input Form\n\n var imageMenuHeightForm = imageMenuForm.cloneNode(true);\n var imageMenuHeightFormInput = imageMenuHeightForm.querySelector(\'input\');\n var imageMenuHeightFormLabel = imageMenuHeightForm.querySelector(\'p\');\n imageMenuHeightFormInput.placeholder = "Image Height";\n imageMenuHeightFormLabel.textContent = "Height"; // Width Input Form\n\n var imageMenuWidthForm = imageMenuForm.cloneNode(true);\n var imageMenuWidthFormInput = imageMenuWidthForm.querySelector(\'input\');\n var imageMenuWidthFormLabel = imageMenuWidthForm.querySelector(\'p\');\n imageMenuWidthFormInput.placeholder = "Image Height";\n imageMenuWidthFormLabel.textContent = "Width";\n\n imageMenuButton.onclick = function (e) {\n var linkValue = imageMenuFormSourceInput.value;\n var heightValue = imageMenuHeightFormInput.value;\n var widthValue = imageMenuWidthFormInput.value;\n\n if (linkValue) {\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(_this5.range);\n document.execCommand("insertImage", true, linkValue);\n\n var imageTags = _this5.body.querySelectorAll("img");\n\n imageTags[imageTags.length - 1].style.height = "".concat(heightValue, "px");\n imageTags[imageTags.length - 1].style.width = "".concat(widthValue, "px");\n imageMenuHeightFormInput.value = "";\n imageMenuWidthFormInput.value = "";\n imageMenuFormSourceInput.value = "";\n\n _this5.toolbar.querySelector("#toolbar-image").onclick();\n } else {\n _this5.body.focus();\n\n _this5.closeImageMenu();\n }\n };\n\n imageMenu.appendChild(imageMenuHeightForm);\n imageMenu.appendChild(imageMenuWidthForm);\n imageMenu.appendChild(imageMenuForm);\n imageMenu.appendChild(imageMenuButton);\n return imageMenu;\n }\n }, {\n key: "initMetaDataSection",\n value: function initMetaDataSection() {\n var metaDataSection = document.createElement("div");\n metaDataSection.classList.add("metadata-section");\n metaDataSection.style.display = "flex";\n metaDataSection.style.flexWrap = "wrap";\n metaDataSection.style.zIndex = "500";\n return metaDataSection;\n }\n }, {\n key: "initFilesSection",\n value: function initFilesSection() {\n var _this6 = this;\n\n var filesSection = document.createElement("div");\n filesSection.classList.add("files-section");\n filesSection.style.display = "flex";\n filesSection.style.flexWrap = "wrap";\n filesSection.style.zIndex = "500";\n\n this.body.ondragenter = function (e) {\n _this6.body.style.backgroundColor = "#ddd";\n };\n\n this.body.ondragleave = function (e) {\n _this6.body.style.backgroundColor = "inherit";\n };\n\n this.body.ondrop = function (e) {\n _this6.body.style.backgroundColor = "inherit";\n e.preventDefault();\n var file = e.dataTransfer.files && e.dataTransfer.files[0];\n\n _this6.attachFile(file);\n };\n\n this.editor.getfiles = function () {\n return _this6.getFiles();\n };\n\n return filesSection;\n }\n }, {\n key: "createFileElement",\n value: function createFileElement(name, size) {\n var _this7 = this;\n\n var fileEl = document.createElement("div");\n var fileNameEl = document.createElement("h4");\n var fileSizeEl = document.createElement("p");\n var removeFileEl = document.createElement("p");\n fileNameEl.textContent = name;\n fileSizeEl.textContent = size;\n removeFileEl.textContent = "X";\n fileEl.dataset.fileindex = this.files.length - 1;\n fileEl.style.width = "100%";\n fileEl.style.display = "flex";\n fileEl.style.flexDirection = "column";\n fileEl.style.margin = "10px";\n fileEl.style.position = "relative";\n fileNameEl.style.fontWeight = "bold";\n fileNameEl.style.margin = "0";\n fileSizeEl.style.fontSize = "12px";\n fileSizeEl.style.margin = "2px 0";\n removeFileEl.style.margin = "0";\n removeFileEl.style.userSelect = "none";\n removeFileEl.style.color = "black";\n removeFileEl.style.position = "absolute";\n removeFileEl.style.right = "5px";\n removeFileEl.style.top = "-5px";\n removeFileEl.style.cursor = "pointer";\n removeFileEl.style.backgroundColor = "#fff";\n\n removeFileEl.onmouseenter = function () {\n return removeFileEl.style.color = "#ddd";\n };\n\n removeFileEl.onmouseleave = function () {\n return removeFileEl.style.color = "black";\n };\n\n removeFileEl.onclick = function (e) {\n _this7.files.splice(e.target.parentElement.dataset.fileindex, 1);\n\n e.target.parentElement.remove();\n };\n\n fileEl.appendChild(fileNameEl);\n fileEl.appendChild(fileSizeEl);\n fileEl.appendChild(removeFileEl);\n this.filesSection.appendChild(fileEl);\n\n this.editor.getfiles = function () {\n return _this7.getFiles();\n };\n }\n }, {\n key: "createMetaDataElement",\n value: function createMetaDataElement(url, img, title, description) {\n var metaItemEl = document.createElement("div");\n var metaLinkEl = document.createElement("a");\n var metaImageEl = document.createElement("img");\n var metaDataEl = document.createElement("div");\n var metaDataTitleEl = document.createElement("h4");\n var metaDataDescriptionEl = document.createElement("p");\n var removeMetaDataEl = document.createElement("span");\n metaLinkEl.href = url;\n metaImageEl.src = img;\n metaDataTitleEl.textContent = title;\n metaDataDescriptionEl.textContent = description;\n removeMetaDataEl.textContent = "X";\n metaLinkEl.target = "blank";\n metaItemEl.style.width = "100%";\n metaItemEl.style.display = "flex";\n metaItemEl.style.margin = "10px";\n metaItemEl.style.position = "relative";\n metaImageEl.style.marginRight = "10px";\n metaImageEl.style.height = "50px";\n metaImageEl.style.width = "75px";\n metaDataTitleEl.style.fontWeight = "bold";\n metaDataTitleEl.style.margin = "0";\n metaDataDescriptionEl.style.margin = "0";\n removeMetaDataEl.style.userSelect = "none";\n removeMetaDataEl.style.color = "black";\n removeMetaDataEl.style.position = "absolute";\n removeMetaDataEl.style.right = "5px";\n removeMetaDataEl.style.top = "-5px";\n removeMetaDataEl.style.cursor = "pointer";\n removeMetaDataEl.style.backgroundColor = "#fff";\n\n removeMetaDataEl.onmouseenter = function () {\n return removeMetaDataEl.style.color = "#ddd";\n };\n\n removeMetaDataEl.onmouseleave = function () {\n return removeMetaDataEl.style.color = "black";\n };\n\n removeMetaDataEl.onclick = function (e) {\n return e.target.parentElement.remove();\n };\n\n metaLinkEl.appendChild(metaImageEl);\n metaDataEl.appendChild(metaDataTitleEl);\n metaDataEl.appendChild(metaDataDescriptionEl);\n metaItemEl.appendChild(metaLinkEl);\n metaItemEl.appendChild(metaDataEl);\n metaItemEl.appendChild(removeMetaDataEl);\n this.metaDataSection.appendChild(metaItemEl);\n }\n }, {\n key: "constructSVG",\n value: function constructSVG(svgData) {\n var viewBox = svgData.viewBox,\n d = svgData.d;\n var fillColor = this.options.toolbarOptionFillColor ? this.options.toolbarOptionFillColor : "#333";\n var xmlns = "http://www.w3.org/2000/svg";\n var height = "16";\n var width = "16";\n var icon = document.createElement(\'span\');\n var svg = "<svg width=\\"".concat(width, "\\" height=\\"").concat(height, "\\" viewBox=\\"").concat(viewBox, "\\" xmlns=\\"").concat(xmlns, "\\">");\n var path = "<path fill=\\"".concat(fillColor, "\\" d=\\"").concat(d, "\\"/>");\n icon.innerHTML = "".concat(svg).concat(path, "</svg>");\n return icon;\n }\n }, {\n key: "initResponsive",\n value: function initResponsive() {\n var _this8 = this;\n\n var that = this;\n\n if (!this.options.minimal) {\n var responsiveGroups = function responsiveGroups(isResponsive) {\n that.toolbarGroups.forEach(function (group) {\n group.dataset.open = "false";\n group.style.display = isResponsive ? "none" : "block";\n group.style.position = isResponsive ? "absolute" : "relative";\n group.style.bottom = isResponsive ? "5px" : "inherit";\n group.style.right = isResponsive ? "5px" : "inherit";\n group.style.backgroundColor = isResponsive ? "#fff" : "inherit";\n group.style.border = isResponsive ? "2px solid #ddd" : "none";\n });\n that.toolbarMenus.forEach(function (menu) {\n function toggleMenu() {\n var selectedGroup = that.toolbar.querySelector("#group-".concat(menu.id.split("-")[1]));\n\n if (selectedGroup.dataset.open === "false") {\n // close opened groups\n that.toolbarGroups.forEach(function (group) {\n if (group.dataset.open === "true") {\n group.style.display = "none";\n group.dataset.open = "false";\n }\n }); // open group\n\n selectedGroup.style.display = "block";\n selectedGroup.style.padding = "5px";\n selectedGroup.dataset.open = "true";\n } else {\n selectedGroup.style.display = "none";\n selectedGroup.dataset.open = "false";\n }\n }\n\n menu.style.padding = "0 10px";\n menu.style.cursor = "pointer";\n menu.style.userSelect = "none";\n menu.style.display = isResponsive ? "block" : "none";\n\n menu.onclick = function (e) {\n toggleMenu();\n that.body.focus();\n };\n });\n };\n\n var setResponsive = function setResponsive() {\n responsive = window.matchMedia("(max-width: 700px)").matches;\n responsiveGroups(responsive);\n };\n\n var responsive = window.matchMedia("(max-width: 700px)").matches;\n setResponsive();\n\n window.onresize = function () {\n _this8.toolbarGroups.forEach(function (group) {\n return group.style.padding = "0";\n });\n\n _this8.closeLinkMenu();\n\n _this8.closeImageMenu();\n\n setResponsive();\n };\n } else {\n this.toolbarMenus.forEach(function (menu) {\n return menu.style.display = "none";\n });\n this.toolbar.querySelector("#toolbar-strikethrough").style.display = "none";\n this.toolbar.querySelector("#toolbar-image").style.display = "none";\n this.toolbar.querySelector("#toolbar-insertOrderedList").style.display = "none";\n this.toolbar.querySelector("#group-textAlign").style.display = "none";\n }\n }\n }, {\n key: "initOverflow",\n value: function initOverflow() {\n var _this9 = this;\n\n var onFocus = this.body.onfocus;\n\n this.body.onfocus = function () {\n onFocus && onFocus();\n\n _this9.overflow();\n };\n\n var onBlur = this.body.onblur;\n\n this.body.onblur = function () {\n onBlur && onBlur();\n\n _this9.overflow();\n };\n\n this.body.onkeypress = function () {\n return _this9.overflow();\n };\n }\n }, {\n key: "getFiles",\n value: function getFiles() {\n return this.files;\n }\n }, {\n key: "getContent",\n value: function getContent() {\n return this.body.innerHTML;\n }\n }, {\n key: "getRange",\n value: function getRange() {\n return window.getSelection().getRangeAt(0);\n }\n }, {\n key: "getMeta",\n value: function getMeta(url) {\n return fetch(this.options.metaUrl, {\n method: "POST",\n headers: {\n \'Content-Type\': \'application/json\'\n },\n body: JSON.stringify({\n targetUrl: url\n })\n }).then(function (res) {\n return res.json();\n });\n }\n }, {\n key: "validURL",\n value: function validURL(str) {\n var pattern = new RegExp("^(https?:\\\\/\\\\/)?" + "((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|" + "((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))" + "(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*" + "(\\\\?[;&a-z\\\\d%_.~+=-]*)?" + "(\\\\#[-a-z\\\\d_]*)?$", "i");\n return !!pattern.test(str);\n }\n }, {\n key: "overflow",\n value: function overflow() {\n var body = this.body;\n body.scrollHeight > body.clientHeight ? body.style.overflowY = "scroll" : body.style.overflowY = "hidden";\n body.scrollWidth > body.clientWidth ? body.style.overflowX = "scroll" : body.style.overflowX = "hidden";\n }\n }, {\n key: "formatBytes",\n value: function formatBytes(bytes) {\n var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n if (bytes === 0) return \'0 Bytes\';\n var k = 1024;\n var dm = decimals < 0 ? 0 : decimals;\n var sizes = [\'Bytes\', \'KB\', \'MB\', \'GB\', \'TB\', \'PB\', \'EB\', \'ZB\', \'YB\'];\n var i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + \' \' + sizes[i];\n }\n }, {\n key: "validateFile",\n value: function validateFile(file) {\n var extension = file.type.split(\'/\').pop();\n return this.options.extensions.includes(".".concat(extension));\n }\n }, {\n key: "attachFile",\n value: function attachFile(file) {\n if (this.validateFile(file)) {\n this.files.push(file);\n this.createFileElement(file.name, this.formatBytes(file.size));\n } else {\n this.fileInvalid();\n }\n }\n }, {\n key: "fileInvalid",\n value: function fileInvalid() {\n var _this10 = this;\n\n this.body.style.transition = "background-color .5s";\n this.body.style.backgroundColor = "#d9534f";\n setTimeout(function () {\n _this10.body.style.backgroundColor = "inherit";\n setTimeout(function () {\n return _this10.body.style.transition = "none";\n }, 500);\n }, 500);\n }\n }, {\n key: "openLinkMenu",\n value: function openLinkMenu() {\n this.closeImageMenu();\n this.linkMenu.dataset.active = "true";\n this.linkMenu.style.display = "block";\n }\n }, {\n key: "openImageMenu",\n value: function openImageMenu() {\n this.closeLinkMenu();\n this.imageMenu.dataset.active = "true";\n this.imageMenu.style.display = "block";\n }\n }, {\n key: "closeLinkMenu",\n value: function closeLinkMenu() {\n this.linkMenu.dataset.active = "false";\n this.linkMenu.style.display = "none";\n }\n }, {\n key: "closeImageMenu",\n value: function closeImageMenu() {\n this.imageMenu.dataset.active = "false";\n this.imageMenu.style.display = "none";\n }\n }, {\n key: "setContent",\n value: function setContent(html) {\n this.body.innerHTML = html;\n }\n }, {\n key: "clearContent",\n value: function clearContent() {\n this.body.innerHTML = "";\n }\n }]);\n\n return StrivenEditor;\n }();\n\n _exports["default"] = StrivenEditor;\n});\n\n//# sourceURL=webpack://striveneditor/./src/striveneditor.js?')}})}));
+\ No newline at end of file
diff --git a/src/striveneditor.js b/src/striveneditor.js
@@ -1063,4 +1063,8 @@ export default class StrivenEditor {
setContent(html) {
this.body.innerHTML = html;
}
+
+ clearContent() {
+ this.body.innerHTML = "";
+ }
}
\ No newline at end of file