jodit-pro
Version:
PRO Version of Jodit Editor
962 lines (901 loc) • 203 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([[916],{
/***/ 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);
}
/***/ }),
/***/ 4278:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIBrowserPanel: function() { return /* binding */ UIBrowserPanel; }
/* 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_ts_decorate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(31635);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(67510);
/* harmony import */ var jodit_pro_plugins_finder_ui_preview_preview__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(8358);
/* harmony import */ var jodit_pro_plugins_finder_ui_settings_settings__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(60062);
/* harmony import */ var jodit_pro_plugins_finder_ui_sidebar_sidebar__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(70950);
/* harmony import */ var jodit_pro_plugins_finder_ui_sources_sources__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(59198);
/* harmony import */ var jodit_pro_plugins_finder_ui_statusbar_statusbar__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(17234);
/* harmony import */ var jodit_pro_plugins_finder_ui_virtual_scroll_virtual_scroll__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(43778);
/*!
* 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 UIBrowserPanel = /*#__PURE__*/ function(UIGroup) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(UIBrowserPanel, UIGroup);
function UIBrowserPanel(jodit, stateManager) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIBrowserPanel);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIBrowserPanel, [
jodit
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "stateManager", void 0), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "syncMod", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "sources", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "sidebar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "preview", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "statusbar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "items", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "settings", void 0), _this.stateManager = stateManager, _this.syncMod = true, _this.sources = new jodit_pro_plugins_finder_ui_sources_sources__WEBPACK_IMPORTED_MODULE_12__.UIBrowserSources(_this.j), _this.sidebar = new jodit_pro_plugins_finder_ui_sidebar_sidebar__WEBPACK_IMPORTED_MODULE_11__.UISidebar(_this.jodit, [
_this.sources
], _this.stateManager.state), _this.preview = new jodit_pro_plugins_finder_ui_preview_preview__WEBPACK_IMPORTED_MODULE_9__.UIPreview(_this.jodit, _this.stateManager.state), _this.statusbar = new jodit_pro_plugins_finder_ui_statusbar_statusbar__WEBPACK_IMPORTED_MODULE_13__.UIBrowserStatusBar(_this.j), _this.items = new jodit_pro_plugins_finder_ui_virtual_scroll_virtual_scroll__WEBPACK_IMPORTED_MODULE_14__.UIVirtualScroll(_this.j, _this.stateManager), _this.settings = new jodit_pro_plugins_finder_ui_settings_settings__WEBPACK_IMPORTED_MODULE_10__.UIBrowserSettings(_this.jodit, _this.stateManager.state);
_this.state = stateManager.state;
_this.append(_this.sidebar, 'content');
_this.append(_this.items, 'content');
_this.append(_this.settings, 'content');
_this.append(_this.preview, 'content');
_this.append(_this.statusbar, 'footer');
_this.onChangeElements();
_this.onChangeSources();
_this.onChangeView();
_this.onChangeTileSize();
_this.onChangeShowFavorites();
_this.onChangeActiveElements();
_this.onChangeFavorites();
_this.onChangeShowSideBar();
_this.onChangeShowSettings();
_this.onChangeShowPreview();
_this.onChangeTheme();
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIBrowserPanel, [
{
key: "className",
value: /** @override */ function className() {
return 'UIBrowserPanel';
}
},
{
key: "countInRow",
get: /**
* Count elements in one row for calculate navigation
*/ function get() {
if (this.state.view === 'list') {
return 1;
}
if (!this.items.elements.length) {
return 1;
}
var container = this.items.elements[0].container, margin = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__.css)(container, 'marginLeft');
return Math.floor(this.items.container.offsetWidth / (container.offsetWidth + ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__.isNumber)(margin) ? margin : 0)));
}
},
{
key: "countInColumn",
get: /**
* Count elements in one column for calculate navigation
*/ function get() {
if (!this.items.elements.length) {
return 1;
}
var container = this.items.elements[0].container, margin = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__.css)(container, 'marginTop');
return Math.floor(this.items.container.offsetHeight / (container.offsetHeight + ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__.isNumber)(margin) ? margin : 0)));
}
},
{
key: "render",
value: /** @override */ function render() {
return "<div>\n <div class='&__content'></div>\n <div class='&__footer'></div>\n </div>";
}
},
{
key: "onChangeTheme",
value: function onChangeTheme() {
this.setMod('theme', this.stateManager.state.theme);
}
},
{
key: "onChangeElements",
value: function onChangeElements() {
this.items.build(this.stateManager.state.elements);
}
},
{
key: "onChangeActiveElements",
value: function onChangeActiveElements() {
var _this = this;
if (!this.state.activeElements.length) {
this.state.info = '';
this.state.metaInfo = null;
}
this.items.elements.forEach(function(elm) {
elm.setMod('active', Boolean(_this.stateManager.isActive(elm.item)));
});
this.j.e.fire('changeSelection');
}
},
{
key: "onChangeFavorites",
value: function onChangeFavorites() {
var _this = this;
this.items.elements.forEach(function(elm) {
elm.setMod('favorite', Boolean(_this.stateManager.isFavorite(elm.item)));
});
}
},
{
key: "onChangeSources",
value: function onChangeSources() {
this.sources.build(this.stateManager.state.tree);
}
},
{
key: "onChangeLastSelectedIndex",
value: function onChangeLastSelectedIndex() {
var _this_items_elements_this_stateManager_state_lastSelectedIndex;
var container = (_this_items_elements_this_stateManager_state_lastSelectedIndex = this.items.elements[this.stateManager.state.lastSelectedIndex]) === null || _this_items_elements_this_stateManager_state_lastSelectedIndex === void 0 ? void 0 : _this_items_elements_this_stateManager_state_lastSelectedIndex.container;
if (container) {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_7__.scrollIntoViewIfNeeded)(container, this.items.container, this.j.od);
container.focus();
}
}
},
{
key: "onChangeInfo",
value: function onChangeInfo() {
this.statusbar.value(this.state.info, 'center');
}
},
{
key: "onChangePathOrSource",
value: function onChangePathOrSource() {
this.statusbar.value(this.state.currentPath ? "".concat(this.state.currentPath, " (").concat(this.state.currentSource, ")") : this.i18n('Home'), 'left');
}
},
{
key: "onChangeShowSettings",
value: function onChangeShowSettings() {
this.settings.setMod('hidden', !this.stateManager.state.showSettings);
}
},
{
key: "onChangeShowPreview",
value: function onChangeShowPreview() {
this.preview.setMod('hidden', !this.stateManager.state.showPreview);
}
},
{
key: "onChangeShowSideBar",
value: function onChangeShowSideBar() {
this.sidebar.setMod('hidden', !this.stateManager.state.showSideBar);
}
},
{
key: "onChangeView",
value: function onChangeView() {
this.items.setMod('view', this.stateManager.state.view);
}
},
{
key: "onChangeTileSize",
value: function onChangeTileSize() {
this.items.setMod('size', this.stateManager.state.tileSize);
}
},
{
key: "onChangeShowFavorites",
value: function onChangeShowFavorites() {
this.sidebar.setMod('show-favorites', this.stateManager.state.showFavorites);
this.items.setMod('show-favorites', this.stateManager.state.showFavorites);
}
},
{
key: "onItemDblClick",
value: function onItemDblClick() {
this.j.e.fire('select.filebrowser');
return false;
}
},
{
key: "onItemClick",
value: function onItemClick(data, multi) {
this.stateManager.addActive(data, multi);
}
},
{
key: "onTogglePreview",
value: function onTogglePreview() {
this.state.showPreview = !this.state.showPreview;
return false;
}
},
{
key: "onToggleFavoriteItem",
value: function onToggleFavoriteItem(data) {
this.stateManager.toggleFavorite(data);
}
},
{
key: "onFolderClick",
value: function onFolderClick(data) {
this.stateManager.state.currentSource = data.sourceName;
this.stateManager.state.currentPath = data.path || '/';
this.j.e.fire('afterOpenFolder.filebrowser');
}
}
]);
return UIBrowserPanel;
}(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIGroup);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.theme')
], UIBrowserPanel.prototype, "onChangeTheme", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.elements')
], UIBrowserPanel.prototype, "onChangeElements", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.activeElements')
], UIBrowserPanel.prototype, "onChangeActiveElements", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)([
'state.favorites',
'state.elements'
])
], UIBrowserPanel.prototype, "onChangeFavorites", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.sources')
], UIBrowserPanel.prototype, "onChangeSources", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.lastSelectedIndex')
], UIBrowserPanel.prototype, "onChangeLastSelectedIndex", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.info')
], UIBrowserPanel.prototype, "onChangeInfo", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)([
'state.currentPath',
'state.currentSource'
])
], UIBrowserPanel.prototype, "onChangePathOrSource", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.showSettings')
], UIBrowserPanel.prototype, "onChangeShowSettings", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.showPreview')
], UIBrowserPanel.prototype, "onChangeShowPreview", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.showSideBar')
], UIBrowserPanel.prototype, "onChangeShowSideBar", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.view')
], UIBrowserPanel.prototype, "onChangeView", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.tileSize')
], UIBrowserPanel.prototype, "onChangeTileSize", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)('state.showFavorites')
], UIBrowserPanel.prototype, "onChangeShowFavorites", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)(':dblclickItem.filebrowser')
], UIBrowserPanel.prototype, "onItemDblClick", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)(':clickItem.filebrowser')
], UIBrowserPanel.prototype, "onItemClick", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)(':togglePreview.filebrowser')
], UIBrowserPanel.prototype, "onTogglePreview", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)(':toggleFavoriteItem')
], UIBrowserPanel.prototype, "onToggleFavoriteItem", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.watch)(':openFolder')
], UIBrowserPanel.prototype, "onFolderClick", null);
UIBrowserPanel = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_6__.component
], UIBrowserPanel);
/***/ }),
/***/ 5422:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FileBrowserPro: function() { return /* binding */ FileBrowserPro; }
/* 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_get__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(54816);
/* harmony import */ var _swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84669);
/* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(18766);
/* harmony import */ var _swc_helpers_instanceof__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2868);
/* harmony import */ var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(43284);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(31635);
/* harmony import */ var _swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(62361);
/* harmony import */ var _ui_assets_icons__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(34042);
/* harmony import */ var _helpers_context_menu__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(8087);
/* harmony import */ var _helpers_helpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(77841);
/* harmony import */ var _helpers_history_manager__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(17578);
/* harmony import */ var _helpers_loading_manager__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(97770);
/* harmony import */ var _helpers_persistent_store__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(42663);
/* harmony import */ var _helpers_state_manager__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(55535);
/* harmony import */ var _ui_header_header__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(18250);
/* harmony import */ var _ui_lightboox_lightbox__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(69277);
/* harmony import */ var _ui_panel_panel__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(4278);
/* harmony import */ var _ui_progress_progress__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(95002);
/* harmony import */ var jodit_esm_config__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(6441);
/* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(82758);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(70231);
/* harmony import */ var jodit_esm_modules__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(41409);
/* harmony import */ var jodit_esm_modules_dialog__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(638);
/* harmony import */ var jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(63399);
/* harmony import */ var jodit_esm_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(50050);
/* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(2692);
/* harmony import */ var jodit_pro_plugins_license_license__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(21246);
/*!
* 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 FileBrowserPro = /*#__PURE__*/ function(Dialog) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__._)(FileBrowserPro, Dialog);
function FileBrowserPro(options) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_2__._)(this, FileBrowserPro);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_1__._)(this, FileBrowserPro, [
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.ConfigProto)(Object.assign(options || {}, {
resizable: true,
draggable: true,
toolbarButtons: (options === null || options === void 0 ? void 0 : options.toolbarButtons) || jodit_esm_config__WEBPACK_IMPORTED_MODULE_23__.Config.defaultOptions.filebrowser.buttons,
buttons: jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_32__.JoditPro.atom([
'filebrowser.settings',
'fullsize',
'dialog.close'
])
}), jodit_esm_config__WEBPACK_IMPORTED_MODULE_23__.Config.defaultOptions.filebrowser)
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "dataProvider", (0,jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_30__.makeDataProvider)(_this, _this.options)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "state", (0,jodit_esm_modules__WEBPACK_IMPORTED_MODULE_28__.observable)({
onSelectCallBack: null,
theme: 'default',
showSideBar: true,
showFavorites: true,
showSettings: false,
showPreview: false,
withFolders: true,
foldersPosition: 'bottom',
info: '',
metaInfo: null,
currentPath: '',
currentSource: '',
currentBaseUrl: '',
tree: [],
activeElements: [],
favorites: [],
progress: 0,
lastSelectedIndex: 0,
elements: [],
messages: [],
sources: [],
view: 'tiles',
tileSize: 'default',
sortBy: 'name-asc',
filterWord: '',
onlyImages: false
})), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "persistent", new _helpers_persistent_store__WEBPACK_IMPORTED_MODULE_17__.PersistentStore(_this, _this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "loadingManager", new _helpers_loading_manager__WEBPACK_IMPORTED_MODULE_16__.LoadingManager(_this, _this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "stateManager", new _helpers_state_manager__WEBPACK_IMPORTED_MODULE_18__.StateManager(_this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "historyManager", new _helpers_history_manager__WEBPACK_IMPORTED_MODULE_15__.HistoryManager(_this, _this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "contextMenuManager", new _helpers_context_menu__WEBPACK_IMPORTED_MODULE_13__.ContextMenuManager(_this)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "header", new _ui_header_header__WEBPACK_IMPORTED_MODULE_19__.UIBrowserHeader(_this, _this.options, _this.stateManager)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "panel", new _ui_panel_panel__WEBPACK_IMPORTED_MODULE_21__.UIBrowserPanel(_this, _this.stateManager)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "files", _this.panel), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "tree", _this.panel), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_4__._)(_this, "uploader", void 0);
jodit_pro_plugins_license_license__WEBPACK_IMPORTED_MODULE_33__.license.make(_this);
if (!_this.persistent.theme && _this.options.theme) {
_this.persistent.theme = _this.options.theme;
}
_this.panel.append(_this.progressbar);
_this.toolbar.setMod('mode', 'header');
_this.setSize(Math.min(_this.options.width, screen.width), Math.min(_this.options.height, screen.height)).setHeader(_this.header);
_this.onResizeWindow();
_this.initUploader();
_this.onChangeTheme();
_this.fullFillOptions();
_this.dataProvider.onProgress(function(percentage) {
if (percentage === 0) {
percentage = 30;
}
_this.state.progress = percentage;
});
_this.e.on('beforeClose', _this.removeGlobalListeners);
_this.e.fire('afterInit');
jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_32__.JoditPro.prototype.afterInitHook.call(_this);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(FileBrowserPro, [
{
key: "className",
value: /** @override */ function className() {
return 'FileBrowserPro';
}
},
{
key: "lock",
value: /** @override */ function lock() {
var name = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'any';
this.container.classList.add('jodit_disabled');
return (0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_5__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_6__._)(FileBrowserPro.prototype), "lock", this).call(this, name);
}
},
{
key: "unlock",
value: function unlock() {
this.container.classList.remove('jodit_disabled');
return (0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_5__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_6__._)(FileBrowserPro.prototype), "unlock", this).call(this);
}
},
{
key: "status",
value: function status(message) {
var success = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !(0,_swc_helpers_instanceof__WEBPACK_IMPORTED_MODULE_8__._)(message, Error);
if ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.isAbortError)(message)) {
return;
}
if (!jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.IS_PROD && !(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.isString)(message)) {
console.error(message);
}
this.message.message((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.isString)(message) ? message : message.message, success ? 'success' : 'error', this.options.howLongShowMsg);
}
},
{
key: "progressbar",
get: function get() {
return new _ui_progress_progress__WEBPACK_IMPORTED_MODULE_22__.UIProgress(this, this.stateManager.state);
}
},
{
key: "addDisclaimer",
value: /** @override */ function addDisclaimer(elm) {
this.dialog.appendChild(elm);
}
},
{
key: "open",
value: // @ts-ignore
function open(_0) {
var _this = this;
var _this1 = this, _superprop_get_open = function _superprop_get_open() {
return (0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_5__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_6__._)(FileBrowserPro.prototype), "open", _this);
};
return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() {
var callback, onlyImages;
var _arguments = arguments;
return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_11__._)(this, function(_state) {
callback = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : this.o.defaultCallback, onlyImages = _arguments.length > 1 ? _arguments[1] : void 0;
this.state.onlyImages = Boolean(onlyImages);
this.prepareOpening(callback);
_superprop_get_open().call(_this1, this.panel.container);
return [
2,
this.e.fire('update.filebrowser')
];
});
}).apply(this, arguments);
}
},
{
key: "onResizeWindow",
value: /**
* Resize handler
*/ function onResizeWindow() {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.css)(this.dialog, {
maxWidth: screen.width,
minHeight: Math.min(this.options.height, screen.height),
minWidth: Math.min(this.options.width, screen.width)
});
}
},
{
key: "onChangePath",
value: function onChangePath() {
var _this_state = this.state, currentPath = _this_state.currentPath, currentSource = _this_state.currentSource;
this.uploader.setPath(currentPath);
this.uploader.setSource(currentSource);
}
},
{
key: "onChangeTheme",
value: function onChangeTheme() {
this.setMod('theme', this.state.theme);
this.header.setMod('theme', this.state.theme);
this.panel.setMod('theme', this.state.theme);
this.options.theme = this.state.theme;
}
},
{
key: "onToggleSettings",
value: function onToggleSettings() {
this.state.showSettings = !this.state.showSettings;
}
},
{
key: "prepareOpening",
value: function prepareOpening(callback) {
var _this = this;
this.registerGlobalListeners();
if (callback) {
this.state.onSelectCallBack = function(data) {
_this.close();
callback(data);
};
}
this.persistent.syncWithState();
}
},
{
key: "registerGlobalListeners",
value: function registerGlobalListeners() {
this.e.on(this.ow, 'keydown', this.onKeyPress);
}
},
{
key: "onKeyPress",
value: function onKeyPress(e) {
var activeElement = this.od.activeElement;
if (!this.state.activeElements.length || !activeElement || !jodit_esm_modules__WEBPACK_IMPORTED_MODULE_28__.Dom.isOrContains(this.panel.items.container, activeElement)) {
return;
}
var elms = this.state.elements;
switch(e.key){
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_ENTER:
{
return this.onChooseItems();
}
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_DELETE:
{
return this.onFileRemove();
}
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_RIGHT:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_LEFT:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_DOWN:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_UP:
{
var next = e.key === jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_RIGHT || e.key === jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_DOWN, index = this.state.lastSelectedIndex;
var nextIndex;
if ([
jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_RIGHT,
jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_24__.KEY_LEFT
].includes(e.key)) {
if (next) {
nextIndex = !elms[index + 1] ? 0 : index + 1;
} else {
nextIndex = !elms[index - 1] ? elms.length - 1 : index - 1;
}
} else {
var countInRow = this.panel.countInRow;
nextIndex = Math.round(((index + 1) / countInRow + (next ? 1 : -1)) * countInRow - 1);
}
elms[nextIndex] && this.stateManager.addActive(elms[nextIndex], e.shiftKey);
return false;
}
}
}
},
{
key: "removeGlobalListeners",
value: function removeGlobalListeners() {
this.e.off(this.ow, 'keydown', this.onKeyPress);
}
},
{
key: "onFileRemove",
value: function onFileRemove() {
var _this = this;
if (this.state.activeElements.length) {
this.confirm('Are you sure?', 'Delete', function(yes) {
yes && void _this.__itemsRemove(_this.state.activeElements);
}).bindDestruct(this);
}
}
},
{
key: "__itemsRemove",
value: function __itemsRemove(items) {
var _this = this;
if (!items.length) {
return Promise.resolve();
}
var promises = [];
items.forEach(function(item) {
var _item_name;
promises.push(item.type === 'folder' ? _this.__folderRemove((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_14__.parentPath)(item.path), (_item_name = item.name) !== null && _item_name !== void 0 ? _item_name : '', item.sourceName) : _this.__removeFile(item.file || item.name || '', item.sourceName));
});
this.state.activeElements.forEach(function(el) {
_this.stateManager.isFavorite(el) && _this.stateManager.toggleFavorite(el);
});
this.state.activeElements = [];
return Promise.allSettled(promises).then(function() {
return Promise.allSettled([
_this.loadingManager.loadItems(),
_this.loadingManager.loadFolders()
]);
});
}
},
{
key: "__removeFile",
value: function __removeFile(name, source) {
var _this = this;
return this.dataProvider.fileRemove(this.state.currentPath, name, source).then(function(message) {
_this.status(message || _this.i18n('File "%s" was deleted', name), true);
}).catch(this.status);
}
},
{
key: "__folderRemove",
value: function __folderRemove(path, name, sourceName) {
var _this = this;
return this.dataProvider.folderRemove(path, name, sourceName).then(function(message) {
_this.status(message || _this.i18n('Folder "%s" was deleted', name), true);
if (_this.state.currentPath === path) {
_this.state.currentPath = (0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_14__.parentPath)(path);
_this.state.currentSource = sourceName;
}
}).catch(this.status);
}
},
{
key: "onFileEdit",
value: function onFileEdit() {
if (this.state.activeElements.length === 1) {
var _this_state_activeElements = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_9__._)(this.state.activeElements, 1), file = _this_state_activeElements[0];
jodit_esm_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_31__.openImageEditor.call(this, file.fileURL, file.file || '', file.path, file.sourceName, undefined, this.status);
}
}
},
{
key: "onFolderRename",
value: function onFolderRename(data) {
var _this = this;
this.prompt('Enter new name', 'Rename', function(newName) {
if (!(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.isValidName)(newName) || newName === data.name) {
_this.status(_this.i18n('Enter new name'));
return false;
}
_this.dataProvider.folderRename((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_14__.parentPath)(data.path), data.name, newName, data.sourceName).then(function(message) {
_this.state.activeElements = [];
_this.status(message, true);
_this.state.currentPath = (0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_14__.parentPath)(data.path) + '/' + newName;
_this.state.currentSource = data.sourceName;
_this.historyManager.updateCurrent();
_this.loadingManager.loadFolders();
}).catch(_this.status);
return;
}, this.i18n('type name'), data.name).bindDestruct(this);
}
},
{
key: "onFolderRemove",
value: function onFolderRemove(data) {
var _this = this;
this.confirm('Are you sure?', 'Delete', function(yes) {
yes && void _this.__itemsRemove([
{
type: 'folder',
name: data.name,
path: data.path,
sourceName: data.sourceName
}
]);
}).bindDestruct(this);
}
},
{
key: "onFolderCreate",
value: function onFolderCreate(data) {
var _this = this;
this.prompt('Enter Directory name', 'Create directory', function(name) {
var path = data.path || '/';
_this.dataProvider.createFolder(name, data.path || '/', data.sourceName).then(function() {
if (_this.state.currentSource === data.sourceName && _this.state.currentPath === path) {
_this.e.fire('update.filebrowser');
} else {
_this.state.currentSource = data.sourceName;
_this.state.currentPath = path;
}
_this.historyManager.updateCurrent();
}, _this.status);
}, this.i18n('type name')).bindDestruct(this);
}
},
{
key: "onFileRename",
value: function onFileRename(item) {
var _this = this;
var name = item.file || item.name || '';
if (this.state.activeElements.length === 1 && name) {
this.prompt('Enter new name', 'Rename', function(newName) {
if (!(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.isValidName)(newName)) {
_this.status(_this.i18n('Enter new name'));
return false;
}
_this.dataProvider.fileRename(_this.state.currentPath, name, newName, _this.state.currentSource).then(function(message) {
_this.state.activeElements = [];
_this.status(message, true);
void _this.loadingManager.loadItems();
}).catch(_this.status);
return;
}, this.i18n('type name'), name).bindDestruct(this);
}
}
},
{
key: "onChooseItems",
value: function onChooseItems() {
var act = this.stateManager.state.activeElements;
if (act.length) {
if (act[0].type === 'folder') {
this.state.currentPath = this.state.currentPath + '/' + act[0].name;
this.state.currentSource = act[0].sourceName;
this.e.fire('afterOpenFolder.filebrowser');
return;
}
if (this.state.onSelectCallBack) {
this.stateManager.callSelectHandler();
} else {
this.onOpenLightBox(act[0]);
}
}
}
},
{
key: "onOpenLightBox",
value: function onOpenLightBox(item) {
_ui_lightboox_lightbox__WEBPACK_IMPORTED_MODULE_20__.UILightBox.open(this, item, this.state.elements);
}
},
{
key: "initUploader",
value: function initUploader() {
var _this = this;
var self = this, uploaderOptions = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.ConfigProto)(self.o.uploader || {}, jodit_esm_config__WEBPACK_IMPORTED_MODULE_23__.Config.defaultOptions.uploader);
var uploadHandler = function uploadHandler() {
return _this.loadingManager.loadItems();
};
self.uploader = self.getInstance('Uploader', uploaderOptions);
self.uploader.bind(self.panel.container, uploadHandler, self.status);
self.e.on('bindUploader.filebrowser', function(button) {
self.uploader.bind(button, uploadHandler, self.status);
});
}
},
{
key: "destruct",
value: /** @override */ function destruct() {
this.removeGlobalListeners();
this.header.destruct();
this.panel.destruct();
(0,_swc_helpers_get__WEBPACK_IMPORTED_MODULE_5__._)((0,_swc_helpers_get_prototype_of__WEBPACK_IMPORTED_MODULE_6__._)(FileBrowserPro.prototype), "destruct", this).call(this);
}
},
{
key: "fullFillOptions",
value: function fullFillOptions() {
var _this = this;
var keys = [
'getLocalFileByUrl',
'crop',
'resize',
'create',
'fileMove',
'folderMove',
'fileRename',
'folderRename',
'fileRemove',
'folderRemove',
'folder',
'items',
'permissions'
];
keys.forEach(function(key) {
if (_this.options[key] != null) {
_this.options[key] = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_26__.ConfigProto)(_this.options[key], _this.o.ajax);
}
});
}
}
]);
return FileBrowserPro;
}(jodit_esm_modules_dialog__WEBPACK_IMPORTED_MODULE_29__.Dialog);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.autobind
], FileBrowserPro.prototype, "status", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.cache
], FileBrowserPro.prototype, "progressbar", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':resize', {
context: window
})
], FileBrowserPro.prototype, "onResizeWindow", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)([
'state.currentPath',
'state.currentSource'
])
], FileBrowserPro.prototype, "onChangePath", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)('state.theme')
], FileBrowserPro.prototype, "onChangeTheme", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':toggleSettings.filebrowser')
], FileBrowserPro.prototype, "onToggleSettings", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.autobind
], FileBrowserPro.prototype, "onKeyPress", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.autobind
], FileBrowserPro.prototype, "removeGlobalListeners", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':fileRemove.filebrowser')
], FileBrowserPro.prototype, "onFileRemove", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':edit.filebrowser')
], FileBrowserPro.prototype, "onFileEdit", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':folderRename.filebrowser')
], FileBrowserPro.prototype, "onFolderRename", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':folderRemove.filebrowser')
], FileBrowserPro.prototype, "onFolderRemove", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':folderCreate.filebrowser')
], FileBrowserPro.prototype, "onFolderCreate", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':fileRename.filebrowser')
], FileBrowserPro.prototype, "onFileRename", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':select.filebrowser')
], FileBrowserPro.prototype, "onChooseItems", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.watch)(':openLightBox.filebrowser')
], FileBrowserPro.prototype, "onOpenLightBox", null);
FileBrowserPro = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.component,
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_25__.derive)(jodit_esm_core_traits_dlgs__WEBPACK_IMPORTED_MODUL