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BU,UAAU,EACVP,MAAOtD,EAAKoE,WACZZ,MAAO,6MAGPC,QAAS,CACPO,MAAO,CAAEG,MAAO,SAChBJ,KAAM,YAIZhB,EAAM,UACJ9C,EAAGoD,IAAI,QAAS,EAAF,KACTF,GAAgB,CACnBG,MAAOtD,EAAKqE,WACZb,MAAO,qpBAGPC,QAAS,CACPM,KAAM,QACNO,IAAK,kBACLN,MAAO,CACLO,OAAQ,QACRC,MAAO,aAKfzB,EAAM,QACJ9C,EAAGoD,IAAI,MAAO,EAAF,KACPF,GAAgB,CACnBG,MAAOtD,EAAKyE,SACZjB,MAAO,uXAGPC,QAAS,CACPM,KAAM,MACNC,MAAO,CAAEO,OAAQ,YAGzB,CD1KE,CAAWxE,EA7BC,GACVK,OAAQ,CACN,UACA,UACA,UACA,YACA,OACA,OACA,QACA,QACA,OAEFE,UAAU,EACVD,YAAa,OACbG,eAAe,EACfL,SAAU,QACVoD,aAAc,WACdG,aAAc,YACdC,aAAc,YACdC,cAAe,gBACfE,UAAW,OACXI,UAAW,OACXE,WAAY,QACZC,WAAY,QACZI,SAAU,MACVlE,UAAW,IACRP,GAIP,E","sources":["webpack://gjs-blocks-basic/webpack/universalModuleDefinition","webpack://gjs-blocks-basic/webpack/bootstrap","webpack://gjs-blocks-basic/webpack/runtime/define property getters","webpack://gjs-blocks-basic/webpack/runtime/hasOwnProperty shorthand","webpack://gjs-blocks-basic/webpack/runtime/make namespace object","webpack://gjs-blocks-basic/./src/index.ts","webpack://gjs-blocks-basic/./src/blocks.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"gjs-blocks-basic\"] = factory();\n\telse\n\t\troot[\"gjs-blocks-basic\"] = factory();\n})(typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : this), () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { Plugin } from 'grapesjs';\nimport loadBlocks from './blocks';\n\nexport type PluginOptions = {\n /**\n * Which blocks to add.\n * @default ['column1', 'column2', 'column3', 'column3-7', 'text', 'link', 'image', 'video', 'map']\n */\n blocks?: string[];\n\n /**\n * Make use of flexbox for the grid\n * @default false\n */\n flexGrid?: boolean;\n\n /**\n * Classes prefix\n * @default 'gjs-'\n */\n stylePrefix?: string;\n\n /**\n * Use basic CSS for blocks\n * @default true\n */\n addBasicStyle?: boolean;\n\n /**\n * Blocks category name\n * @default 'Basic'\n */\n category?: string;\n\n /**\n * 1 Column label\n * @default '1 Column'\n */\n labelColumn1?: string;\n\n /**\n * 2 Columns label\n * @default '2 Columns'\n */\n labelColumn2?: string;\n\n /**\n * 3 Columns label\n * @default '3 Columns'\n */\n labelColumn3?: string;\n\n /**\n * 3/7 Columns label\n * @default '2 Columns 3/7'\n */\n labelColumn37?: string;\n\n /**\n * Text label\n * @default 'Text'\n */\n labelText?: string;\n\n /**\n * Link label\n * @default 'Link'\n */\n labelLink?: string;\n\n /**\n * Image label\n * @default 'Image'\n */\n labelImage?: string;\n\n /**\n * Video label\n * @default 'Video'\n */\n labelVideo?: string;\n\n /**\n * Map label\n * @default 'Map'\n */\n labelMap?: string;\n\n /**\n * Initial row height\n * @default 75\n */\n rowHeight?: number;\n};\n\nconst plugin: Plugin = (editor, opts = {}) => {\n const config: Required = {\n blocks: [\n 'column1',\n 'column2',\n 'column3',\n 'column3-7',\n 'text',\n 'link',\n 'image',\n 'video',\n 'map'\n ],\n flexGrid: false,\n stylePrefix: 'gjs-',\n addBasicStyle: true,\n category: 'Basic',\n labelColumn1: '1 Column',\n labelColumn2: '2 Columns',\n labelColumn3: '3 Columns',\n labelColumn37: '2 Columns 3/7',\n labelText: 'Text',\n labelLink: 'Link',\n labelImage: 'Image',\n labelVideo: 'Video',\n labelMap: 'Map',\n rowHeight: 75,\n ...opts\n };\n\n loadBlocks(editor, config);\n};\n\nexport default plugin;\n","import type { Editor, BlockProperties } from 'grapesjs';\nimport { PluginOptions } from '.';\n\nexport default function(editor: Editor, opts: Required) {\n const bm = editor.BlockManager;\n const { category, blocks, stylePrefix, flexGrid, rowHeight, addBasicStyle } = opts;\n const clsRow = `${stylePrefix}row`;\n const clsCell = `${stylePrefix}cell`;\n const styleRow = flexGrid\n ? `\n .${clsRow} {\n display: flex;\n justify-content: flex-start;\n align-items: stretch;\n flex-wrap: nowrap;\n padding: 10px;\n }\n @media (max-width: 768px) {\n .${clsRow} {\n flex-wrap: wrap;\n }\n }`\n : `\n .${clsRow} {\n display: table;\n padding: 10px;\n width: 100%;\n }\n @media (max-width: 768px) {\n .${stylePrefix}cell, .${stylePrefix}cell30, .${stylePrefix}cell70 {\n width: 100%;\n display: block;\n }\n }`;\n const styleClm = flexGrid\n ? `\n .${clsCell} {\n min-height: ${rowHeight}px;\n flex-grow: 1;\n flex-basis: 100%;\n }`\n : `\n .${clsCell} {\n width: 8%;\n display: table-cell;\n height: ${rowHeight}px;\n }`;\n const styleClm30 = `\n .${stylePrefix}cell30 {\n width: 30%;\n }`;\n const styleClm70 = `\n .${stylePrefix}cell70 {\n width: 70%;\n }`;\n\n const step = 0.2;\n const minDim = 1;\n const currentUnit = 1;\n const resizerBtm: Record = {\n tl: 0,\n tc: 0,\n tr: 0,\n cl: 0,\n cr: 0,\n bl: 0,\n br: 0,\n minDim\n };\n const resizerRight: Record = {\n ...resizerBtm,\n cr: 1,\n bc: 0,\n currentUnit,\n minDim,\n step\n };\n\n // Flex elements do not react on width style change therefore I use\n // 'flex-basis' as keyWidth for the resizer on columns\n if (flexGrid) {\n resizerRight.keyWidth = 'flex-basis';\n }\n\n const rowAttr = {\n class: clsRow,\n 'data-gjs-droppable': `.${clsCell}`,\n 'data-gjs-resizable': resizerBtm,\n 'data-gjs-name': 'Row'\n };\n\n const colAttr: Record = {\n class: clsCell,\n 'data-gjs-draggable': `.${clsRow}`,\n 'data-gjs-resizable': resizerRight,\n 'data-gjs-name': 'Cell'\n };\n\n if (flexGrid) {\n colAttr['data-gjs-unstylable'] = ['width'];\n colAttr['data-gjs-stylable-require'] = ['flex-basis'];\n }\n\n // Make row and column classes private\n const privateCls = [`.${clsRow}`, `.${clsCell}`];\n editor.on(\n 'selector:add',\n selector =>\n privateCls.indexOf(selector.getFullName()) >= 0 &&\n selector.set('private', 1)\n );\n\n const attrsToString = (attrs: Record) => {\n const result = [];\n\n for (let key in attrs) {\n let value = attrs[key];\n const toParse = value instanceof Array || value instanceof Object;\n value = toParse ? JSON.stringify(value) : value;\n result.push(`${key}=${toParse ? `'${value}'` : `'${value}'`}`);\n }\n\n return result.length ? ` ${result.join(' ')}` : '';\n };\n\n const toAdd = (name: string) => blocks.indexOf(name) >= 0;\n const attrsRow = attrsToString(rowAttr);\n const attrsCell = attrsToString(colAttr);\n const commonBlockProps: Partial = {\n category,\n select: true,\n };\n\n toAdd('column1') &&\n bm.add('column1', {\n ...commonBlockProps,\n label: opts.labelColumn1,\n media: `\n \n `,\n content: `
\n
\n
\n ${\n addBasicStyle\n ? ``\n : ''\n }`\n });\n\n toAdd('column2') &&\n bm.add('column2', {\n ...commonBlockProps,\n label: opts.labelColumn2,\n media: `\n \n `,\n content: `
\n
\n
\n
\n ${\n addBasicStyle\n ? ``\n : ''\n }`\n });\n\n toAdd('column3') &&\n bm.add('column3', {\n ...commonBlockProps,\n label: opts.labelColumn3,\n media: `\n \n `,\n content: `
\n
\n
\n
\n
\n ${\n addBasicStyle\n ? ``\n : ''\n }`\n });\n\n toAdd('column3-7') &&\n bm.add('column3-7', {\n ...commonBlockProps,\n label: opts.labelColumn37,\n media: `\n \n `,\n content: `
\n
\n
\n
\n ${\n addBasicStyle\n ? ``\n : ''\n }`\n });\n\n toAdd('text') &&\n bm.add('text', {\n ...commonBlockProps,\n activate: true,\n label: opts.labelText,\n media: `\n \n `,\n content: {\n type: 'text',\n content: 'Insert your text here',\n style: { padding: '10px' },\n }\n });\n\n toAdd('link') &&\n bm.add('link', {\n ...commonBlockProps,\n label: opts.labelLink,\n media: `\n \n `,\n content: {\n type: 'link',\n content: 'Link',\n style: { color: '#d983a6' }\n }\n });\n\n toAdd('image') &&\n bm.add('image', {\n ...commonBlockProps,\n activate: true,\n label: opts.labelImage,\n media: `\n \n `,\n content: {\n style: { color: 'black' },\n type: 'image',\n }\n });\n\n toAdd('video') &&\n bm.add('video', {\n ...commonBlockProps,\n label: opts.labelVideo,\n media: `\n \n `,\n content: {\n type: 'video',\n src: 'img/video2.webm',\n style: {\n height: '350px',\n width: '615px'\n }\n }\n });\n\n toAdd('map') &&\n bm.add('map', {\n ...commonBlockProps,\n label: opts.labelMap,\n media: `\n \n `,\n content: {\n type: 'map',\n style: { height: '350px' }\n }\n });\n}\n"],"names":["root","factory","exports","module","define","amd","globalThis","window","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","editor","opts","bm","BlockManager","category","blocks","stylePrefix","flexGrid","rowHeight","addBasicStyle","clsRow","clsCell","styleRow","styleClm","styleClm30","styleClm70","minDim","resizerBtm","tl","tc","tr","cl","cr","bl","br","resizerRight","bc","currentUnit","step","keyWidth","rowAttr","class","colAttr","privateCls","on","selector","indexOf","getFullName","set","attrsToString","attrs","result","Array","JSON","stringify","push","length","join","toAdd","name","attrsRow","attrsCell","commonBlockProps","select","add","label","labelColumn1","media","content","labelColumn2","labelColumn3","labelColumn37","activate","labelText","type","style","padding","labelLink","color","labelImage","labelVideo","src","height","width","labelMap"],"sourceRoot":""}