UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

981 lines (884 loc) 213 kB
/*! * jodit-pro - PRO Version of Jodit Editor * Author: Chupurnov Valerii <chupurnov@gmail.com> * Version: v4.9.27 * Url: https://xdsoft.net/jodit/pro/ * License(s): SEE LICENSE IN LICENSE.md */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(self, function() { return (self["webpackChunkjodit_pro"] = self["webpackChunkjodit_pro"] || []).push([[946],{ /***/ 482: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ googleMaps: function() { return /* binding */ googleMaps; } /* harmony export */ }); /* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77688); /* harmony import */ var _swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80294); /* harmony import */ var _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20616); /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67709); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(82749); /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18766); /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(56075); /* harmony import */ var _swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(94899); /* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23078); /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(31635); /* harmony import */ var _swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(62361); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(55029); /* harmony import */ var _assets__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(99413); /* harmony import */ var _helpers_const__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(17298); /* harmony import */ var _helpers_generate_js_script__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(61818); /* harmony import */ var _helpers_helpers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(67912); /* harmony import */ var _helpers_static_url__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(92931); /* harmony import */ var _ui_combo_box_combo_box__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(65805); /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(4774); /* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(82758); /* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(65478); /* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(21537); /* harmony import */ var jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(50911); /* harmony import */ var jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(62843); /* harmony import */ var jodit_esm_modules_dialog_dialog__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(78584); /* harmony import */ var jodit_esm_modules_widget__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(92762); /* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(2692); /*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ // @ts-ignore window['JoditGoogleReadyHandler'] = _helpers_helpers__WEBPACK_IMPORTED_MODULE_15__.GoogleReadyHandler; var googleMaps = /*#__PURE__*/ function(Plugin) { "use strict"; (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__._)(googleMaps, Plugin); function googleMaps() { (0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__._)(this, googleMaps); var _this; _this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__._)(this, googleMaps, arguments), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "buttons", [ { group: 'media', name: 'googleMaps' } ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "dialog", null); return _this; } (0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(googleMaps, [ { key: "className", value: function className() { return 'google-maps'; } }, { key: "afterInit", value: function afterInit(jodit) { var _this = this; jodit.registerCommand(_helpers_const__WEBPACK_IMPORTED_MODULE_13__.COMMAND_OPEN_DIALOG, function() { void _this.openMapEditor(null, {}); }); } }, { key: "beforeDestruct", value: function beforeDestruct(jodit) {} }, { key: "onOpenOnDblClick", value: function onOpenOnDblClick(image) { if (image.dataset.googleMaps) { var json; try { json = JSON.parse(this.j.ow.atob(image.dataset.googleMaps)); } catch (unused) {} void this.openMapEditor(image, json); return false; } } }, { key: "openMapEditor", value: function openMapEditor(target, initialState) { return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() { var _this, _dialog, jodit, dialog, state, apiUrl, openState, uiMap, search, onCLose; return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_10__._)(this, function(_state) { _this = this; jodit = this.j; dialog = this.getDialog(); state = this.j.o.googleMaps.saveStateInStorage ? dialog.storage.get(_helpers_const__WEBPACK_IMPORTED_MODULE_13__.STORAGE_KEY) : undefined; apiUrl = this.jodit.o.googleMaps.apiUrl; if (!(0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_15__.isApiAvailable)()) { void (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_21__.appendScriptAsync)(this.jodit, apiUrl.replace(/\${([^}]+)}/g, function(_, key) { var _this_get; return (_this_get = _this.get(key)) !== null && _this_get !== void 0 ? _this_get : ''; })); } openState = (0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({ type: this.j.o.googleMaps.map.type, layer: this.j.o.googleMaps.map.layer, size: this.j.o.googleMaps.map.size }, state, initialState); uiMap = new _ui__WEBPACK_IMPORTED_MODULE_18__.UIMap(dialog, openState, this.j.options); uiMap.container.classList.add(dialog.getFullElName('map')); search = new _ui_combo_box_combo_box__WEBPACK_IMPORTED_MODULE_17__.UIComboBox(jodit, { icon: 'search', placeholder: 'Search', clearButton: true }).setMod('in-header', true); search.container.classList.add(dialog.getFullElName('search')); this.j.async.promise(function(resolve) { if ((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_15__.isApiAvailable)()) { resolve(0); return; } // TODO - Need check googleReady var intervalChecker = function intervalChecker1() { if ((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_15__.isApiAvailable)()) { resolve(0); } else { _this.j.async.setTimeout(intervalChecker, 100); } }; intervalChecker(); (0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_15__.googleReady)(resolve); }).then(function() { uiMap.setStatus('ready'); search.setStatus('ready'); }); this.j.e.on(search, 'select', function(marker, bound) { if (bound) { uiMap.map.fitBounds(bound); return; } if (marker) { uiMap.state.center = [ marker.lat(), marker.lng() ]; } }); if (!state) { if (this.j.o.googleMaps.map.center === 'auto') { navigator.geolocation.getCurrentPosition(function(position) { uiMap.state.center = [ position.coords.latitude, position.coords.longitude ]; }, function() { uiMap.state.center = _this.j.o.googleMaps.map.defaultCenter; }); } else { uiMap.state.center = this.j.o.googleMaps.map.center; } } (_dialog = dialog).setSize.apply(_dialog, (0,_swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_7__._)(jodit.o.googleMaps.dialog.size)).setHeader([ search, '&nbsp;', (0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_23__.Button)(jodit, 'eye').onAction(function() { var image = _this.jodit.createInside.element('img'); image.src = (0,_helpers_static_url__WEBPACK_IMPORTED_MODULE_16__.staticUrl)(uiMap); image.dataset.googleMaps = btoa(uiMap.json()); var data = { value: image.outerHTML }; _this.onAfterGetValueFromEditor(data); jodit.execCommand('preview', null, data.value); }) ]).setContent((0,jodit_esm_modules_widget__WEBPACK_IMPORTED_MODULE_25__.TabsWidget)(jodit, [ { name: 'Map', icon: 'map', content: uiMap }, { name: 'Settings', content: new _ui__WEBPACK_IMPORTED_MODULE_18__.UIMapsPropsForm(jodit, uiMap.state) }, { name: 'Controls', icon: 'menu', content: new _ui__WEBPACK_IMPORTED_MODULE_18__.UIMapsControlsForm(jodit, uiMap.state) } ])).setFooter([ (0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_23__.Button)(jodit, 'cancel', 'Cancel', 'default').onAction(function() { return dialog.close(); }), (0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_23__.Button)(jodit, 'ok', target ? 'Save' : 'Insert', 'primary').onAction(function() { uiMap.destruct(); search.destruct(); dialog.e.off('beforeClose', onCLose); dialog.close(); _this.insertMap(target, uiMap); }) ]).open(); onCLose = function onCLose1() { if (uiMap.state.elements.length && JSON.stringify(uiMap.state.elements) !== JSON.stringify(openState.elements)) { if (!jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_19__.IS_TEST && !confirm(_this.i18n('Are you sure?'))) { return false; } } uiMap.destruct(); search.destruct(); dialog.e.off('beforeClose', onCLose); }; dialog.e.on('beforeClose', onCLose); return [ 2 ]; }); }).call(this); } }, { key: "getDialog", value: function getDialog() { if (!this.dialog) { var dialog = new jodit_esm_modules_dialog_dialog__WEBPACK_IMPORTED_MODULE_24__.Dialog({ language: this.j.o.language }); dialog.container.classList.add(this.getFullElName('')); this.dialog = dialog; } return this.dialog; } }, { key: "insertMap", value: function insertMap(target, uiMap) { var image = target !== null && target !== void 0 ? target : this.jodit.createInside.element('img'); image.src = (0,_helpers_static_url__WEBPACK_IMPORTED_MODULE_16__.staticUrl)(uiMap); image.dataset.googleMaps = btoa(uiMap.json()); target || this.jodit.s.insertImage(image); } }, { key: "onBeforeSetNativeEditorValue", value: function onBeforeSetNativeEditorValue(data) { data.value = data.value.replace(// @ts-ignore RegExp("<script[^>]+jodit-google-maps-init[^>]+>.*?<\\/script>", "gs"), ''); } }, { key: "onAfterGetValueFromEditor", value: function onAfterGetValueFromEditor(data, consumer) { var _this = this; if (this.j.o.googleMaps.useStaticImage || consumer === jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_19__.SOURCE_CONSUMER) { return; } data.value = data.value.replace(// @ts-ignore RegExp("(<img[^>]+)([\"']?)data-google-maps\\2\\s*=([\"'])([^\"']+)\\3([^>]*>)", "gs"), function(_, _1, q, q2, jsonB64, rest) { var json = {}; try { json = JSON.parse(_this.j.ow.atob(jsonB64)); } catch (unused) {} return "".concat(_1, ' id="').concat(json.uid, '" ').concat(q, "data-google-maps").concat(q, "=").concat(q2).concat(jsonB64).concat(q2).concat(rest).concat((0,_helpers_generate_js_script__WEBPACK_IMPORTED_MODULE_14__.generateJSScript)(_this.j, json)); }); } } ]); return googleMaps; }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_8__._)(jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_22__.Plugin)); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(googleMaps, "requires", [ 'license', 'color-picker' ]); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_9__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_20__.watch)('?:openOnDblClick') ], googleMaps.prototype, "onOpenOnDblClick", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_9__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_20__.watch)(':beforeSetNativeEditorValue') ], googleMaps.prototype, "onBeforeSetNativeEditorValue", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_9__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_20__.watch)(':afterGetValueFromEditor') ], googleMaps.prototype, "onAfterGetValueFromEditor", null); jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_26__.JoditPro.plugins.add('google-maps', googleMaps); /***/ }), /***/ 1475: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ initOrUpdateElementFromState: function() { return /* binding */ initOrUpdateElementFromState; } /* harmony export */ }); /* harmony import */ var _on_change_geometries__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(53454); /* harmony import */ var _open_props_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11079); /* harmony import */ var _update_state_and_gme__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(72690); /* harmony import */ var jodit_esm_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(580); /* harmony import */ var jodit_esm_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12153); /* harmony import */ var jodit_pro_plugins_google_maps_helpers_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67912); /*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ function initOrUpdateElementFromState(state, index) { var _this = this; var elm = this.mapElements[index]; if (elm) { if (elm.state.type === state.type) { return _update_state_and_gme__WEBPACK_IMPORTED_MODULE_2__.updateStateAndGme.call(this, state, index); } elm.gme.setMap(null); } var gme; switch(state.type){ case 'text': gme = new google.maps.Marker({ position: new google.maps.LatLng(state.coordinates[0], state.coordinates[1]), draggable: true, title: state.text, map: this.map }); break; case 'marker': gme = new google.maps.Marker({ position: new google.maps.LatLng(state.coordinates[0], state.coordinates[1]), draggable: true, label: state.showCaption ? state.title : '', title: state.title, icon: state.icon ? jodit_esm_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__.Icon.get(state.icon) : undefined, map: this.map }); break; case 'polyline': case 'polygon': { var coordinates = (0,jodit_pro_plugins_google_maps_helpers_helpers__WEBPACK_IMPORTED_MODULE_5__.arrayToPath)(state.coordinates); gme = new google.maps[state.type === 'polygon' ? 'Polygon' : 'Polyline']({ path: coordinates, strokeColor: state.strokeColor, fillColor: state.fillColor, strokeWeight: state.strokeWeight, editable: true, draggable: true, map: this.map, fillOpacity: state.type === 'polygon' ? state.fillOpacity : 1 }); } break; case 'circle': var _state_fillOpacity; gme = new google.maps.Circle({ center: new google.maps.LatLng(state.coordinates[0], state.coordinates[1]), radius: state.radius, strokeColor: state.strokeColor, fillColor: state.fillColor, strokeWeight: state.strokeWeight, editable: true, draggable: true, map: this.map, fillOpacity: (_state_fillOpacity = state.fillOpacity) !== null && _state_fillOpacity !== void 0 ? _state_fillOpacity : 1 }); break; } var newElm = { type: state.type, uid: (0,jodit_esm_core_global__WEBPACK_IMPORTED_MODULE_3__.uniqueUid)(), state: state, gme: gme }; 'dragend radius_changed center_changed'.split(' ').forEach(function(event) { return gme.addListener(event, function() { return _on_change_geometries__WEBPACK_IMPORTED_MODULE_0__.onChangeGeometries.call(_this, newElm, index); }); }); if (newElm.type === 'polygon' || newElm.type === 'polyline') { 'insert_at set_at remove_at'.split(' ').forEach(function(event) { return newElm.gme.getPath().addListener(event, function() { return _on_change_geometries__WEBPACK_IMPORTED_MODULE_0__.onChangeGeometries.call(_this, newElm, index); }); }); } gme.addListener('click', function() { return _open_props_dialog__WEBPACK_IMPORTED_MODULE_1__.openPropsDialog.call(_this, newElm, index); }); this.mapElements[index] = newElm; } /***/ }), /***/ 2868: /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ _: function() { return /* binding */ _instanceof1; } /* harmony export */ }); function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _instanceof1(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else return _instanceof(left, right); } /***/ }), /***/ 4169: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ UIMap: function() { return /* binding */ UIMap; } /* harmony export */ }); /* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77688); /* harmony import */ var _swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80294); /* harmony import */ var _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20616); /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67709); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(82749); /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18766); /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(56075); /* harmony import */ var _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11886); /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(31635); /* harmony import */ var _swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(62361); /* harmony import */ var jodit_pro_plugins_google_maps_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(55029); /* harmony import */ var _modules_add_new_in_state__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(22125); /* harmony import */ var _modules_init_or_update_element_from_state__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1475); /* harmony import */ var jodit_esm_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(81577); /* harmony import */ var jodit_esm_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(97357); /* harmony import */ var jodit_esm_core_decorators_wait_wait__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(13525); /* harmony import */ var jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(37133); /* harmony import */ var jodit_esm_core_global__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(580); /* harmony import */ var jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(38837); /* harmony import */ var jodit_esm_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(41180); /* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(67510); /* harmony import */ var jodit_esm_modules_toolbar_collection_collection__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(11676); /* harmony import */ var jodit_pro_plugins_google_maps_helpers_const__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(17298); /*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ var UIMap = /*#__PURE__*/ function(UIGroup) { "use strict"; (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__._)(UIMap, UIGroup); function UIMap(jodit, state, options) { (0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__._)(this, UIMap); var _this; _this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__._)(this, UIMap, [ jodit ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "options", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "drawingManager", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "toolbar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "mapElements", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "apiLoaded", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "mapInitialized", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "map", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "layers", void 0), _this.options = options, _this.toolbar = new jodit_esm_modules_toolbar_collection_collection__WEBPACK_IMPORTED_MODULE_21__.ToolbarCollection(_this.jodit), _this.state = { uid: 'jd' + (0,jodit_esm_core_global__WEBPACK_IMPORTED_MODULE_17__.uniqueUid)() + new Date().toString().replace(/[^0-9]/g, ''), layer: _this.options.googleMaps.map.layer, center: _this.options.googleMaps.map.defaultCenter, zoom: _this.options.googleMaps.map.defaultZoom, size: _this.options.googleMaps.map.size, type: _this.options.googleMaps.map.type, controls: { zoomControl: true, mapTypeControl: true, scaleControl: true, streetViewControl: true, rotateControl: true, fullscreenControl: true }, mode: 'hand', elements: [] }, _this.mapElements = [], _this.apiLoaded = null, _this.mapInitialized = false, _this.layers = []; Object.assign(_this.state, state); _this.toolbar.build([ 'gm.hand', 'gm.marker', 'gm.polyline', 'gm.polygon', 'gm.circle' ]); var palette = _this.getElm('map-palette'); (0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_18__.assert)(palette != null, 'palette element does not exists'); palette.appendChild(_this.toolbar.container); return _this; } (0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(UIMap, [ { key: "className", value: function className() { return 'UIMap'; } }, { key: "json", value: function json() { return JSON.stringify((0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({}, this.state), { mode: 'hand' })); } }, { key: "onReady", value: function onReady() { return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() { var _this, container; return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_9__._)(this, function(_state) { switch(_state.label){ case 0: _this = this; return [ 4, this.apiLoaded ]; case 1: _state.sent(); container = this.getElm('map-root'); (0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_18__.assert)(container != null, 'map-root element does not exists'); this.map = new google.maps.Map(container, { center: { lat: this.state.center[0], lng: this.state.center[1] }, zoom: this.state.zoom, mapTypeId: this.state.type }); this.map.addListener('zoom_changed', function() { var _this_map_getZoom; _this.state.zoom = (_this_map_getZoom = _this.map.getZoom()) !== null && _this_map_getZoom !== void 0 ? _this_map_getZoom : 10; }); this.map.addListener('center_changed', function() { var _ref, _ref1; var _this_map_getCenter, _this_map, _this_map_getCenter1, _this_map1; _this.state.center = [ (_ref = (_this_map = _this.map) === null || _this_map === void 0 ? void 0 : (_this_map_getCenter = _this_map.getCenter()) === null || _this_map_getCenter === void 0 ? void 0 : _this_map_getCenter.lat()) !== null && _ref !== void 0 ? _ref : 55, (_ref1 = (_this_map1 = _this.map) === null || _this_map1 === void 0 ? void 0 : (_this_map_getCenter1 = _this_map1.getCenter()) === null || _this_map_getCenter1 === void 0 ? void 0 : _this_map_getCenter1.lng()) !== null && _ref1 !== void 0 ? _ref1 : 34 ]; }); this.map.addListener('maptypeid_changed', function() { var type = _this.map.getMapTypeId(); if (type) { _this.state.type = type; } }); this.initDrawManager(); this.onChangeElementsList(); this.onChangeSize(); this.onChangeControls(); this.onChangeLayer(); this.onChangeMapType(); this.onChangeMode(); this.mapInitialized = true; this.j.async.requestIdleCallback(function() { _this.j.e.fire(_this, 'GoogleMapsIsReady'); }); return [ 2 ]; } }); }).call(this); } }, { key: "initDrawManager", value: function initDrawManager() { var _this = this; try { var drawingManager = new google.maps.drawing.DrawingManager(); drawingManager.setMap(this.map); drawingManager.setOptions({ drawingControl: false, polygonOptions: (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({}, this.options.googleMaps.map.defaultStates.polygon), { clickable: true, editable: true }), polylineOptions: (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({}, this.options.googleMaps.map.defaultStates.polyline), { clickable: true, editable: true }), markerOptions: (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({}, this.options.googleMaps.map.defaultStates.marker), { clickable: true }), circleOptions: (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_7__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_6__._)({}, this.options.googleMaps.map.defaultStates.circle), { clickable: true, editable: true }) }); this.drawingManager = drawingManager; google.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) { if (event.overlay) { _modules_add_new_in_state__WEBPACK_IMPORTED_MODULE_11__.addNewInState.call(_this, event.overlay); event.overlay.setMap(null); } }); } catch (unused) {} } }, { key: "changeCreateMode", value: function changeCreateMode(mode) { this.state.mode = this.state.mode === mode ? 'hand' : mode; } }, { key: "onChangeMode", value: function onChangeMode() { var _this_drawingManager; this.j.buffer.set('createMode.gm', this.state.mode); (_this_drawingManager = this.drawingManager) === null || _this_drawingManager === void 0 ? void 0 : _this_drawingManager.setDrawingMode(this.state.mode === 'hand' ? null : this.state.mode); this.j.e.fire('updateToolbar'); } }, { key: "onChangeElementsList", value: function onChangeElementsList() { var _this = this; var _this1 = this, elements = _this1.state.elements, mapElements = _this1.mapElements; if (elements.length < mapElements.length) { mapElements.slice(elements.length).forEach(function(elm) { elm.gme.setMap(null); }); } mapElements.length = elements.length; elements.forEach(function(state, index) { return _modules_init_or_update_element_from_state__WEBPACK_IMPORTED_MODULE_12__.initOrUpdateElementFromState.call(_this, state, index); }); } }, { key: "onChangeCenter", value: function onChangeCenter() { var center = this.map.getCenter(); if ((center === null || center === void 0 ? void 0 : center.lat()) !== this.state.center[0] || (center === null || center === void 0 ? void 0 : center.lng()) !== this.state.center[1]) { this.map.setCenter({ lat: this.state.center[0], lng: this.state.center[1] }); } } }, { key: "onChangeZoom", value: function onChangeZoom() { var _this_map; (_this_map = this.map) === null || _this_map === void 0 ? void 0 : _this_map.setZoom(this.state.zoom); } }, { key: "onChangeControls", value: function onChangeControls() { var key; for(key in this.state.controls){ var _this_map; (_this_map = this.map) === null || _this_map === void 0 ? void 0 : _this_map.set(key, this.state.controls[key]); } } }, { key: "onChangeBound", value: function onChangeBound() { this.options.googleMaps.saveStateInStorage && this.j.storage.set(jodit_pro_plugins_google_maps_helpers_const__WEBPACK_IMPORTED_MODULE_22__.STORAGE_KEY, { center: this.state.center, size: this.state.size, zoom: this.state.zoom, type: this.state.type, layer: this.state.layer, controls: this.state.controls }); } }, { key: "onChangeSize", value: function onChangeSize() { var mapSize = this.getElm('map-size'); (0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_18__.assert)(mapSize != null, 'map-size element does not exists'); (0,jodit_esm_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_19__.css)(mapSize, { width: this.state.size[0], height: this.state.size[1] }); } }, { key: "onChangeMapType", value: function onChangeMapType() { this.map.setMapTypeId(this.state.type); } }, { key: "onChangeLayer", value: function onChangeLayer() { var _this = this; this.layers.forEach(function(layer) { return layer.setMap(null); }); this.layers.length = 0; switch(this.state.layer){ case 'traffic': this.layers.push(new google.maps.TrafficLayer()); break; case 'transit': this.layers.push(new google.maps.TransitLayer()); break; case 'bicycling': this.layers.push(new google.maps.BicyclingLayer()); break; } this.layers.forEach(function(layer) { return layer.setMap(_this.map); }); } }, { key: "render", value: function render() { return "<div>\n <div class='&__map-root'></div>\n <div class='&__map-size'></div>\n <div class='&__map-palette'></div>\n </div>"; } }, { key: "appendChildToContainer", value: function appendChildToContainer() {} } ]); return UIMap; }(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_20__.UIGroup); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_14__.hook)('ready') ], UIMap.prototype, "onReady", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('?:changeCreateMode.gm') ], UIMap.prototype, "changeCreateMode", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.mode') ], UIMap.prototype, "onChangeMode", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.elements') ], UIMap.prototype, "onChangeElementsList", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.center'), (0,jodit_esm_core_decorators_wait_wait__WEBPACK_IMPORTED_MODULE_15__.wait)(function(ctx) { return ctx.mapInitialized; }), (0,jodit_esm_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_13__.debounce)() ], UIMap.prototype, "onChangeCenter", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.zoom'), (0,jodit_esm_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_13__.debounce)() ], UIMap.prototype, "onChangeZoom", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.controls') ], UIMap.prototype, "onChangeControls", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)([ 'state.center', 'state.zoom', 'state.controls', 'state.size', 'state.type', 'state.layer' ]), (0,jodit_esm_core_decorators_wait_wait__WEBPACK_IMPORTED_MODULE_15__.wait)(function(ctx) { return ctx.mapInitialized; }), (0,jodit_esm_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_13__.debounce)() ], UIMap.prototype, "onChangeBound", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.size'), (0,jodit_esm_core_decorators_debounce_debounce__WEBPACK_IMPORTED_MODULE_13__.debounce)() ], UIMap.prototype, "onChangeSize", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.type') ], UIMap.prototype, "onChangeMapType", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([ (0,jodit_esm_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_16__.watch)('state.layer') ], UIMap.prototype, "onChangeLayer", null); /***/ }), /***/ 4774: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ UIMap: function() { return /* reexport safe */ _map_map__WEBPACK_IMPORTED_MODULE_1__.UIMap; }, /* harmony export */ UIMapsControlsForm: function() { return /* reexport safe */ _maps_controls_maps_controls__WEBPACK_IMPORTED_MODULE_2__.UIMapsControlsForm; }, /* harmony export */ UIMapsPropsForm: function() { return /* reexport safe */ _maps_props_maps_props__WEBPACK_IMPORTED_MODULE_3__.UIMapsPropsForm; } /* harmony export */ }); /* harmony import */ var _editors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90835); /* harmony import */ var _map_map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4169); /* harmony import */ var _maps_controls_maps_controls__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8073); /* harmony import */ var _maps_props_maps_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83039); /* harmony import */ var _wysiwyg_wysiwyg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11093); /*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ /***/ }), /***/ 8073: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ UIMapsControlsForm: function() { return /* binding */ UIMapsControlsForm; } /* harmony export */ }); /* harmony import */ var _swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80294); /* harmony import */ var _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20616); /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67709); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82749); /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18766); /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(56075); /* harmony import */ var _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11886); /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635); /* harmony import */ var jodit_esm_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(87325); /* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(67510); /*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ var UIMapsControlsForm = /*#__PURE__*/ function(UIForm) { "use strict"; (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(UIMapsControlsForm, UIForm); function UIMapsControlsForm(jodit, state) { (0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIMapsControlsForm); var _this; _this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIMapsControlsForm, [ jodit ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "state", void 0), _this.state = state; var controlsNames = { zoomControl: 'Zoom control', mapTypeControl: 'Map Type control', scaleControl: 'Scale control', streetViewControl: 'Street View control ', rotateControl: 'Rotate control', fullscreenControl: 'Fullscreen control' }; var controls = Object.keys(controlsNames); _this.append(controls.map(function(key) { return new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_9__.UICheckbox(jodit, { label: controlsNames[key], name: key, checked: _this.state.controls[key], switch: true, type: 'checkbox', onChange: _this.onChangeSize.bind(_this, key) }); })); return _this; } (0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIMapsControlsForm, [ { key: "className", value: function className() { return 'UIMapsControlsForm'; } }, { key: "onChangeSize", value: function onChangeSize(key, value) { this.state.controls = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_6__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_5__._)({}, this.state.controls), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)({}, key, value === 'true')); } } ]); return UIMapsControlsForm; }(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIForm); UIMapsControlsForm = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([ jodit_esm_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__.component ], UIMapsControlsForm); /***/ }), /***/ 11079: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ openPropsDialog: function() { return /* binding */ openPropsDialog; } /* harmony export */ }); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82749); /* harmony import */ va