jodit-pro
Version:
PRO Version of Jodit Editor
768 lines (680 loc) • 35 kB
JavaScript
/*!
* 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([[736],{
/***/ 6183:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIBackupList: function() { return /* binding */ UIBackupList; }
/* 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_get__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54816);
/* harmony import */ var _swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84669);
/* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(18766);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
/* harmony import */ var _item__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(38512);
/* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(82758);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_12__ = __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 UIBackupList = /*#__PURE__*/ function(UIGroup) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__._)(UIBackupList, UIGroup);
function UIBackupList(jodit) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIBackupList);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIBackupList, [
jodit
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "elements", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "currentSelection", -1);
jodit.e.on(_this.container, 'keydown', function(e) {
switch(e.key){
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_9__.KEY_ENTER:
e.preventDefault();
e.stopPropagation();
_this.onChoose(_this.currentSelection);
break;
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_9__.KEY_DOWN:
_this.selectNext();
break;
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_9__.KEY_UP:
_this.selectPrevious();
break;
}
});
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIBackupList, [
{
key: "className",
value: /** @override */ function className() {
return 'UIBackupList';
}
},
{
key: "createContainer",
value: /** @override */ function createContainer(options) {
var div = (0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_4__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_5__._)(UIBackupList.prototype), "createContainer", this).call(this, options);
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_11__.attr)(div, 'tabIndex', '-1');
return div;
}
},
{
key: "build",
value: function build(items) {
var _this = this;
this.clear();
items.forEach(function(data, index) {
var item = new _item__WEBPACK_IMPORTED_MODULE_8__.UIBackupItem(_this.jodit, data);
_this.append(item);
_this.j.e.on(item.container, 'focus', function() {
return _this.onSelect(index);
}).on(item.container, 'click', function() {
return _this.onSelect(index);
}).on(item.container, 'dblclick', function() {
return _this.onChoose(index);
});
});
this.currentSelection = 0;
this.onChangeCurrentSelection(void 0, -1, 0);
}
},
{
key: "onChangeCurrentSelection",
value: function onChangeCurrentSelection(_, old, index) {
var _this_elements_old, _this_elements_index, _this_elements_index1;
(_this_elements_old = this.elements[old]) === null || _this_elements_old === void 0 ? void 0 : _this_elements_old.setMod('active', false);
(_this_elements_index = this.elements[index]) === null || _this_elements_index === void 0 ? void 0 : _this_elements_index.setMod('active', true);
(_this_elements_index1 = this.elements[index]) === null || _this_elements_index1 === void 0 ? void 0 : _this_elements_index1.focus();
this.j.e.fire(this, 'select', this.elements[index].data);
}
},
{
key: "onSelect",
value: function onSelect(index) {
this.currentSelection = index;
}
},
{
key: "onChoose",
value: function onChoose(index) {
this.j.e.fire(this, 'choose', this.elements[index !== null && index !== void 0 ? index : this.currentSelection].data);
}
},
{
key: "selectNext",
value: function selectNext() {
if (this.currentSelection + 1 <= this.elements.length - 1) {
this.currentSelection += 1;
} else {
this.currentSelection = 0;
}
}
},
{
key: "selectPrevious",
value: function selectPrevious() {
if (this.currentSelection - 1 >= 0) {
this.currentSelection -= 1;
} else {
this.currentSelection = this.elements.length - 1;
}
}
}
]);
return UIBackupList;
}(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_12__.UIGroup);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_10__.watch)('currentSelection')
], UIBackupList.prototype, "onChangeCurrentSelection", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_10__.autobind
], UIBackupList.prototype, "onSelect", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_10__.autobind
], UIBackupList.prototype, "onChoose", null);
UIBackupList = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_10__.component
], UIBackupList);
/***/ }),
/***/ 29243:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DefaultStorage: function() { return /* binding */ DefaultStorage; }
/* harmony export */ });
/* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77688);
/* 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_ts_generator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(62361);
/*!
* 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 DefaultStorage = /*#__PURE__*/ function() {
"use strict";
function DefaultStorage(jodit) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, DefaultStorage);
(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "jodit", void 0);
(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "key", void 0);
this.jodit = jodit;
this.key = 'backup.default.storage';
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(DefaultStorage, [
{
key: "add",
value: function add(item) {
return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() {
var items;
return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_4__._)(this, function(_state) {
if (!item.html.trim().length) {
return [
2,
false
];
}
items = this.jodit.storage.get(this.key) || [];
if (items.find(function(elm) {
return elm.html === item.html;
})) {
return [
2,
false
];
}
items.unshift(item);
if (items.length > this.jodit.o.backup.limit) {
items.length = this.jodit.o.backup.limit;
}
this.jodit.storage.set(this.key, items);
return [
2,
false
];
});
}).call(this);
}
},
{
key: "items",
value: function items() {
return Promise.resolve(this.jodit.storage.get(this.key) || []);
}
},
{
key: "clear",
value: function clear() {
this.jodit.storage.delete(this.key);
return Promise.resolve(false);
}
}
]);
return DefaultStorage;
}();
/***/ }),
/***/ 29402:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/*!
* 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/
*/
/***/ }),
/***/ 38512:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIBackupItem: function() { return /* binding */ UIBackupItem; }
/* 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 jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_6__ = __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 UIBackupItem = /*#__PURE__*/ function(UIElement) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(UIBackupItem, UIElement);
function UIBackupItem(jodit, data) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIBackupItem);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIBackupItem, [
jodit
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "data", void 0), _this.data = data;
_this.container.innerHTML = _this.formatDate(data.created);
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(_this.container, 'tabIndex', 0);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIBackupItem, [
{
/** @override */ key: "className",
value: function className() {
return 'UIBackupItem';
}
},
{
key: "formatDate",
value: function formatDate(timestamp) {
var now = new Date();
var date = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(timestamp) ? new Date(timestamp) : timestamp, diff = (now.getTime() - date.getTime()) / 1000;
if ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isFunction)(this.j.o.backup.formatDate)) {
return this.j.o.backup.formatDate(date);
}
if (diff < 0.2) {
return this.j.i18n('Current');
}
if (diff < 60) {
return this.j.i18n('Less minute');
}
if (diff <= 3600) {
return this.j.i18n('%s minutes ago', Math.floor(diff / 60));
}
if (diff <= 3600 * 24) {
return this.j.i18n('%s hours ago', Math.floor(diff / 3600));
}
return "".concat(date.toDateString(), " ").concat(date.toLocaleTimeString());
}
},
{
key: "focus",
value: function focus() {
this.container.focus();
}
}
]);
return UIBackupItem;
}(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_6__.UIElement);
/***/ }),
/***/ 57056:
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _assets_restore_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68583);
/* harmony import */ var _assets_restore_svg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_assets_restore_svg__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _langs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29402);
/* harmony import */ var jodit_esm_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6441);
/* 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);
/*!
* 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
jodit_esm_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.backup = {
interval: 30,
limit: 50,
dialogWidth: 700,
hotkeys: [
'ctrl+shift+b',
'cmd+shift+b'
]
};
jodit_esm_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.backup = {
store: {
command: 'saveBackup',
text: 'Save backup now'
},
restore: {
tooltip: 'Restore',
list: [
'backup.store'
],
exec: function exec(editor) {
editor.execCommand('openBackupDialog');
}
}
};
jodit_esm_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__.Icon.set('restore', (_assets_restore_svg__WEBPACK_IMPORTED_MODULE_0___default()));
(0,jodit_esm_core_global__WEBPACK_IMPORTED_MODULE_3__.extendLang)(_langs__WEBPACK_IMPORTED_MODULE_1__);
/***/ }),
/***/ 61328:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ backup: function() { return /* binding */ backup; }
/* 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_to_consumable_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94899);
/* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23078);
/* 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 _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57056);
/* harmony import */ var _modules_store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29243);
/* harmony import */ var _ui_box__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(64262);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(50911);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(67510);
/* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_16__ = __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/
*/
var backup = /*#__PURE__*/ function(Plugin) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__._)(backup, Plugin);
function backup() {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__._)(this, backup);
var _this;
var _this_jodit_o_backup_remoteStore;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__._)(this, backup, arguments), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "hasStyle", !jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_16__.JoditPro.fatMode), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "buttons", [
{
name: 'backup.restore',
group: 'history'
}
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "__box", new _ui_box__WEBPACK_IMPORTED_MODULE_12__.UIBackupBox(_this.j)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "__dialog", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "__storage", (_this_jodit_o_backup_remoteStore = _this.jodit.o.backup.remoteStore) !== null && _this_jodit_o_backup_remoteStore !== void 0 ? _this_jodit_o_backup_remoteStore : new _modules_store__WEBPACK_IMPORTED_MODULE_11__.DefaultStorage(_this.jodit)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "timeout", 0);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(backup, [
{
key: "afterInit",
value: /** @override */ function afterInit(jodit) {
var _this = this;
jodit.registerCommand('saveBackup', this.onSaveBackup).registerCommand('openBackupDialog', {
exec: this.onOpenBackupDialog,
hotkeys: jodit.o.backup.hotkeys
});
var startInterval = function startInterval1() {
_this.timeout = jodit.async.setTimeout(function() {
_this.onSaveBackup();
startInterval();
}, jodit.o.backup.interval * 1000);
};
startInterval();
jodit.e.on(this.__box, 'choose', this.onSelectItem).on(jodit.ow, 'beforeunload.backup', function() {
_this.onSaveBackup();
});
}
},
{
key: "prepareDialog",
value: function prepareDialog() {
if (!this.__dialog) {
this.__dialog = this.j.dlg({
minWidth: this.j.o.backup.dialogWidth,
buttons: [
'fullsize',
'dialog.close'
]
}).setContent(this.__box.container);
}
this.__dialog.setHeader(this.jodit.i18n('Restore'));
this.addButtonsToDialog();
}
},
{
key: "onSaveBackup",
value: function onSaveBackup() {
this.__storage.add({
created: new Date(),
html: this.j.value
});
}
},
{
key: "onOpenBackupDialog",
value: function onOpenBackupDialog() {
return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() {
var __dialog, items;
return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_9__._)(this, function(_state) {
switch(_state.label){
case 0:
this.prepareDialog();
__dialog = this.__dialog;
if (!__dialog) {
return [
2
];
}
__dialog.open().setModal(true);
return [
4,
this.__storage.items()
];
case 1:
items = _state.sent();
this.__box.build([
{
created: new Date(),
html: this.j.value
}
].concat((0,_swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_6__._)(items)));
__dialog.calcAutoSize();
__dialog.setPosition();
return [
2
];
}
});
}).call(this);
}
},
{
key: "onSelectItem",
value: function onSelectItem(data) {
var _this___dialog;
(_this___dialog = this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.close();
this.j.value = data.html;
this.j.s.focus();
}
},
{
key: "addButtonsToDialog",
value: function addButtonsToDialog() {
var _this = this;
var _this___dialog;
var jodit = this.jodit;
var ok = (0,jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_15__.Button)(jodit, {
name: 'ok',
tabIndex: 0,
variant: 'primary',
text: 'Ok'
}), cancel = (0,jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_15__.Button)(jodit, {
variant: 'secondary',
tabIndex: 0,
text: 'Cancel'
}), clear = (0,jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_15__.Button)(jodit, {
name: 'clear',
tabIndex: 0,
variant: 'secondary',
text: 'Remove all'
});
ok.onAction(function() {
_this.__box.chooseSelected();
});
cancel.onAction(function() {
var _this___dialog;
(_this___dialog = _this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.close();
});
clear.onAction(function() {
jodit.confirm('Are you sure?', undefined, function(confirm) {
if (confirm) {
var _this___dialog;
_this.__storage.clear();
(_this___dialog = _this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.close();
}
});
});
var block = new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_15__.UIBlock(jodit, [
clear,
cancel,
ok
]);
block.container.style.margin = '0';
block.container.style.justifyContent = 'flex-end';
block.container.style.width = '100%';
(_this___dialog = this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.setFooter(block);
}
},
{
key: "beforeDestruct",
value: /** @override */ function beforeDestruct() {
var _this___dialog;
var j = this.j;
j.async.clearTimeout(this.timeout);
j.e.off(this.__box, 'choose', this.onSelectItem).off(j.ow, 'beforeunload.backup');
this.__box.destruct();
(_this___dialog = this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.destruct();
}
}
]);
return backup;
}((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_7__._)(jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_14__.Plugin));
/** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(backup, "requires", [
'license'
]);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_13__.autobind
], backup.prototype, "onSaveBackup", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_13__.autobind
], backup.prototype, "onOpenBackupDialog", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_8__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_13__.autobind
], backup.prototype, "onSelectItem", null);
jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_16__.JoditPro.plugins.add('backup', backup);
/***/ }),
/***/ 64262:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIBackupBox: function() { return /* binding */ UIBackupBox; }
/* 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_get__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54816);
/* harmony import */ var _swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84669);
/* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(18766);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
/* harmony import */ var _list__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6183);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_ui_element__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(48538);
/*!
* 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 UIBackupBox = /*#__PURE__*/ function(UIElement) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__._)(UIBackupBox, UIElement);
function UIBackupBox(jodit) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIBackupBox);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIBackupBox, [
jodit
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "list", new _list__WEBPACK_IMPORTED_MODULE_8__.UIBackupList(_this.j)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "preview", _this.j.c.div(_this.getFullElName('preview'))), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "latestSelected", void 0);
_this.container.appendChild(_this.list.container);
_this.container.appendChild(_this.preview);
_this.list.container.classList.add(_this.getFullElName('list'));
jodit.e.on(_this.list, 'select', _this.onSelectItem).on(_this.list, 'choose', _this.onChooseItem);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIBackupBox, [
{
key: "className",
value: /** @override */ function className() {
return 'UIBackupBox';
}
},
{
key: "build",
value: function build(items) {
this.preview.innerHTML = '';
this.list.build(items);
}
},
{
key: "destruct",
value: /** @override */ function destruct() {
this.j.e.off(this.list, 'select', this.onSelectItem);
this.list.destruct();
return (0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_4__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_5__._)(UIBackupBox.prototype), "destruct", this).call(this);
}
},
{
key: "onSelectItem",
value: /**
* On select item inside list
*/ function onSelectItem(item) {
this.latestSelected = item;
this.preview.innerHTML = item.html || '<div class="'.concat(this.getFullElName('empty'), '">').concat(this.j.i18n('Empty'), "</div>");
}
},
{
key: "onChooseItem",
value: /**
* On choose item inside list
*/ function onChooseItem(item) {
this.j.e.fire(this, 'choose', item);
}
},
{
key: "chooseSelected",
value: function chooseSelected() {
this.onChooseItem(this.latestSelected);
}
}
]);
return UIBackupBox;
}(jodit_esm_core_ui_element__WEBPACK_IMPORTED_MODULE_10__.UIElement);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
], UIBackupBox.prototype, "onSelectItem", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
], UIBackupBox.prototype, "onChooseItem", null);
UIBackupBox = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__.component
], UIBackupBox);
/***/ }),
/***/ 68583:
/***/ (function(module) {
module.exports = "<?xml version=\"1.0\" ?><svg viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\"><title/><g id=\"Upload\"><path d=\"M16,26h8V50a2,2,0,0,0,2,2H38a2,2,0,0,0,2-2V26h8a2,2,0,0,0,1.4946-3.3291l-16-18a2,2,0,0,0-2.9892,0l-16,18A2,2,0,0,0,16,26ZM32,9.0107,43.5464,22H38a2,2,0,0,0-2,2V48H28V24a2,2,0,0,0-2-2H20.4536Z\"/><path d=\"M53,42a2,2,0,0,0-2,2V54a2.0023,2.0023,0,0,1-2,2H15a2.0023,2.0023,0,0,1-2-2V44a2,2,0,0,0-4,0V54a6.0066,6.0066,0,0,0,6,6H49a6.0066,6.0066,0,0,0,6-6V44A2,2,0,0,0,53,42Z\"/></g></svg>"
/***/ })
},
/******/ function(__webpack_require__) { // webpackRuntimeModules
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
/******/ var __webpack_exports__ = (__webpack_exec__(61328));
/******/ return __webpack_exports__;
/******/ }
]);
});