jodit-pro
Version:
PRO Version of Jodit Editor
1,005 lines (935 loc) • 137 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],{
/***/ 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_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82749);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(67510);
/* harmony import */ var jodit_pro_plugins_finder_ui_preview_preview__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8358);
/* harmony import */ var jodit_pro_plugins_finder_ui_settings_settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60062);
/* harmony import */ var jodit_pro_plugins_finder_ui_sidebar_sidebar__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(70950);
/* harmony import */ var jodit_pro_plugins_finder_ui_sources_sources__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59198);
/* harmony import */ var jodit_pro_plugins_finder_ui_statusbar_statusbar__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17234);
/* harmony import */ var jodit_pro_plugins_finder_ui_virtual_scroll_virtual_scroll__WEBPACK_IMPORTED_MODULE_10__ = __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/
*/
class UIBrowserPanel extends jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_4__.UIGroup {
/** @override */ className() {
return 'UIBrowserPanel';
}
/**
* Count elements in one row for calculate navigation
*/ get countInRow() {
if (this.state.view === 'list') {
return 1;
}
if (!this.items.elements.length) {
return 1;
}
const { container } = this.items.elements[0], margin = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(container, 'marginLeft');
return Math.floor(this.items.container.offsetWidth / (container.offsetWidth + ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isNumber)(margin) ? margin : 0)));
}
/**
* Count elements in one column for calculate navigation
*/ get countInColumn() {
if (!this.items.elements.length) {
return 1;
}
const { container } = this.items.elements[0], margin = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(container, 'marginTop');
return Math.floor(this.items.container.offsetHeight / (container.offsetHeight + ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isNumber)(margin) ? margin : 0)));
}
/** @override */ render() {
return `<div>
<div class='&__content'></div>
<div class='&__footer'></div>
</div>`;
}
onChangeTheme() {
this.setMod('theme', this.stateManager.state.theme);
}
onChangeElements() {
this.items.build(this.stateManager.state.elements);
}
onChangeActiveElements() {
if (!this.state.activeElements.length) {
this.state.info = '';
this.state.metaInfo = null;
}
this.items.elements.forEach((elm)=>{
elm.setMod('active', Boolean(this.stateManager.isActive(elm.item)));
});
this.j.e.fire('changeSelection');
}
onChangeFavorites() {
this.items.elements.forEach((elm)=>{
elm.setMod('favorite', Boolean(this.stateManager.isFavorite(elm.item)));
});
}
onChangeSources() {
this.sources.build(this.stateManager.state.tree);
}
onChangeLastSelectedIndex() {
const container = this.items.elements[this.stateManager.state.lastSelectedIndex]?.container;
if (container) {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_3__.scrollIntoViewIfNeeded)(container, this.items.container, this.j.od);
container.focus();
}
}
onChangeInfo() {
this.statusbar.value(this.state.info, 'center');
}
onChangePathOrSource() {
this.statusbar.value(this.state.currentPath ? `${this.state.currentPath} (${this.state.currentSource})` : this.i18n('Home'), 'left');
}
onChangeShowSettings() {
this.settings.setMod('hidden', !this.stateManager.state.showSettings);
}
onChangeShowPreview() {
this.preview.setMod('hidden', !this.stateManager.state.showPreview);
}
onChangeShowSideBar() {
this.sidebar.setMod('hidden', !this.stateManager.state.showSideBar);
}
onChangeView() {
this.items.setMod('view', this.stateManager.state.view);
}
onChangeTileSize() {
this.items.setMod('size', this.stateManager.state.tileSize);
}
onChangeShowFavorites() {
this.sidebar.setMod('show-favorites', this.stateManager.state.showFavorites);
this.items.setMod('show-favorites', this.stateManager.state.showFavorites);
}
onItemDblClick() {
this.j.e.fire('select.filebrowser');
return false;
}
onItemClick(data, multi) {
this.stateManager.addActive(data, multi);
}
onTogglePreview() {
this.state.showPreview = !this.state.showPreview;
return false;
}
onToggleFavoriteItem(data) {
this.stateManager.toggleFavorite(data);
}
onFolderClick(data) {
this.stateManager.state.currentSource = data.sourceName;
this.stateManager.state.currentPath = data.path || '/';
this.j.e.fire('afterOpenFolder.filebrowser');
}
constructor(jodit, stateManager){
super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "stateManager", void 0), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "syncMod", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sources", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sidebar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "preview", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "statusbar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "items", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "settings", void 0), this.stateManager = stateManager, this.syncMod = true, this.sources = new jodit_pro_plugins_finder_ui_sources_sources__WEBPACK_IMPORTED_MODULE_8__.UIBrowserSources(this.j), this.sidebar = new jodit_pro_plugins_finder_ui_sidebar_sidebar__WEBPACK_IMPORTED_MODULE_7__.UISidebar(this.jodit, [
this.sources
], this.stateManager.state), this.preview = new jodit_pro_plugins_finder_ui_preview_preview__WEBPACK_IMPORTED_MODULE_5__.UIPreview(this.jodit, this.stateManager.state), this.statusbar = new jodit_pro_plugins_finder_ui_statusbar_statusbar__WEBPACK_IMPORTED_MODULE_9__.UIBrowserStatusBar(this.j), this.items = new jodit_pro_plugins_finder_ui_virtual_scroll_virtual_scroll__WEBPACK_IMPORTED_MODULE_10__.UIVirtualScroll(this.j, this.stateManager), this.settings = new jodit_pro_plugins_finder_ui_settings_settings__WEBPACK_IMPORTED_MODULE_6__.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();
}
}
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.theme')
], UIBrowserPanel.prototype, "onChangeTheme", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.elements')
], UIBrowserPanel.prototype, "onChangeElements", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.activeElements')
], UIBrowserPanel.prototype, "onChangeActiveElements", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
'state.favorites',
'state.elements'
])
], UIBrowserPanel.prototype, "onChangeFavorites", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.sources')
], UIBrowserPanel.prototype, "onChangeSources", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.lastSelectedIndex')
], UIBrowserPanel.prototype, "onChangeLastSelectedIndex", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.info')
], UIBrowserPanel.prototype, "onChangeInfo", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
'state.currentPath',
'state.currentSource'
])
], UIBrowserPanel.prototype, "onChangePathOrSource", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.showSettings')
], UIBrowserPanel.prototype, "onChangeShowSettings", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.showPreview')
], UIBrowserPanel.prototype, "onChangeShowPreview", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.showSideBar')
], UIBrowserPanel.prototype, "onChangeShowSideBar", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.view')
], UIBrowserPanel.prototype, "onChangeView", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.tileSize')
], UIBrowserPanel.prototype, "onChangeTileSize", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.showFavorites')
], UIBrowserPanel.prototype, "onChangeShowFavorites", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':dblclickItem.filebrowser')
], UIBrowserPanel.prototype, "onItemDblClick", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':clickItem.filebrowser')
], UIBrowserPanel.prototype, "onItemClick", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':togglePreview.filebrowser')
], UIBrowserPanel.prototype, "onTogglePreview", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':toggleFavoriteItem')
], UIBrowserPanel.prototype, "onToggleFavoriteItem", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':openFolder')
], UIBrowserPanel.prototype, "onFolderClick", null);
UIBrowserPanel = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.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_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82749);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
/* harmony import */ var _ui_assets_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34042);
/* harmony import */ var _helpers_context_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8087);
/* harmony import */ var _helpers_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77841);
/* harmony import */ var _helpers_history_manager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(17578);
/* harmony import */ var _helpers_loading_manager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(97770);
/* harmony import */ var _helpers_persistent_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(42663);
/* harmony import */ var _helpers_state_manager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(55535);
/* harmony import */ var _ui_header_header__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(18250);
/* harmony import */ var _ui_lightboox_lightbox__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(69277);
/* harmony import */ var _ui_panel_panel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4278);
/* harmony import */ var _ui_progress_progress__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(95002);
/* harmony import */ var jodit_esm_config__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(6441);
/* harmony import */ var jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(82758);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(70231);
/* harmony import */ var jodit_esm_modules__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(41409);
/* harmony import */ var jodit_esm_modules_dialog__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(638);
/* harmony import */ var jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(63399);
/* harmony import */ var jodit_esm_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(50050);
/* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(2692);
/* harmony import */ var jodit_pro_plugins_license_license__WEBPACK_IMPORTED_MODULE_23__ = __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/
*/
class FileBrowserPro extends jodit_esm_modules_dialog__WEBPACK_IMPORTED_MODULE_19__.Dialog {
/** @override */ className() {
return 'FileBrowserPro';
}
/** @override */ lock(name = 'any') {
this.container.classList.add('jodit_disabled');
return super.lock(name);
}
unlock() {
this.container.classList.remove('jodit_disabled');
return super.unlock();
}
status(message, success = !(message instanceof Error)) {
if ((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.isAbortError)(message)) {
return;
}
if (!jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.IS_PROD && !(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.isString)(message)) {
console.error(message);
}
this.message.message((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.isString)(message) ? message : message.message, success ? 'success' : 'error', this.options.howLongShowMsg);
}
get progressbar() {
return new _ui_progress_progress__WEBPACK_IMPORTED_MODULE_12__.UIProgress(this, this.stateManager.state);
}
/** @override */ addDisclaimer(elm) {
this.dialog.appendChild(elm);
}
// @ts-ignore
async open(callback = this.o.defaultCallback, onlyImages) {
this.state.onlyImages = Boolean(onlyImages);
this.prepareOpening(callback);
super.open(this.panel.container);
return this.e.fire('update.filebrowser');
}
/**
* Resize handler
*/ onResizeWindow() {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.css)(this.dialog, {
maxWidth: screen.width,
minHeight: Math.min(this.options.height, screen.height),
minWidth: Math.min(this.options.width, screen.width)
});
}
onChangePath() {
const { currentPath, currentSource } = this.state;
this.uploader.setPath(currentPath);
this.uploader.setSource(currentSource);
}
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;
}
onToggleSettings() {
this.state.showSettings = !this.state.showSettings;
}
prepareOpening(callback) {
this.registerGlobalListeners();
if (callback) {
this.state.onSelectCallBack = (data)=>{
this.close();
callback(data);
};
}
this.persistent.syncWithState();
}
registerGlobalListeners() {
this.e.on(this.ow, 'keydown', this.onKeyPress);
}
onKeyPress(e) {
const { activeElement } = this.od;
if (!this.state.activeElements.length || !activeElement || !jodit_esm_modules__WEBPACK_IMPORTED_MODULE_18__.Dom.isOrContains(this.panel.items.container, activeElement)) {
return;
}
const elms = this.state.elements;
switch(e.key){
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_ENTER:
{
return this.onChooseItems();
}
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_DELETE:
{
return this.onFileRemove();
}
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_RIGHT:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_LEFT:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_DOWN:
case jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_UP:
{
const next = e.key === jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_RIGHT || e.key === jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_DOWN, index = this.state.lastSelectedIndex;
let nextIndex;
if ([
jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.KEY_RIGHT,
jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_14__.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 {
const { countInRow } = this.panel;
nextIndex = Math.round(((index + 1) / countInRow + (next ? 1 : -1)) * countInRow - 1);
}
elms[nextIndex] && this.stateManager.addActive(elms[nextIndex], e.shiftKey);
return false;
}
}
}
removeGlobalListeners() {
this.e.off(this.ow, 'keydown', this.onKeyPress);
}
onFileRemove() {
if (this.state.activeElements.length) {
this.confirm('Are you sure?', 'Delete', (yes)=>{
yes && void this.__itemsRemove(this.state.activeElements);
}).bindDestruct(this);
}
}
__itemsRemove(items) {
if (!items.length) {
return Promise.resolve();
}
const promises = [];
items.forEach((item)=>{
promises.push(item.type === 'folder' ? this.__folderRemove((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_4__.parentPath)(item.path), item.name ?? '', item.sourceName) : this.__removeFile(item.file || item.name || '', item.sourceName));
});
this.state.activeElements.forEach((el)=>{
this.stateManager.isFavorite(el) && this.stateManager.toggleFavorite(el);
});
this.state.activeElements = [];
return Promise.allSettled(promises).then(()=>Promise.allSettled([
this.loadingManager.loadItems(),
this.loadingManager.loadFolders()
]));
}
__removeFile(name, source) {
return this.dataProvider.fileRemove(this.state.currentPath, name, source).then((message)=>{
this.status(message || this.i18n('File "%s" was deleted', name), true);
}).catch(this.status);
}
__folderRemove(path, name, sourceName) {
return this.dataProvider.folderRemove(path, name, sourceName).then((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_4__.parentPath)(path);
this.state.currentSource = sourceName;
}
}).catch(this.status);
}
onFileEdit() {
if (this.state.activeElements.length === 1) {
const [file] = this.state.activeElements;
jodit_esm_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_21__.openImageEditor.call(this, file.fileURL, file.file || '', file.path, file.sourceName, undefined, this.status);
}
}
onFolderRename(data) {
this.prompt('Enter new name', 'Rename', (newName)=>{
if (!(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.isValidName)(newName) || newName === data.name) {
this.status(this.i18n('Enter new name'));
return false;
}
this.dataProvider.folderRename((0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_4__.parentPath)(data.path), data.name, newName, data.sourceName).then((message)=>{
this.state.activeElements = [];
this.status(message, true);
this.state.currentPath = (0,_helpers_helpers__WEBPACK_IMPORTED_MODULE_4__.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);
}
onFolderRemove(data) {
this.confirm('Are you sure?', 'Delete', (yes)=>{
yes && void this.__itemsRemove([
{
type: 'folder',
name: data.name,
path: data.path,
sourceName: data.sourceName
}
]);
}).bindDestruct(this);
}
onFolderCreate(data) {
this.prompt('Enter Directory name', 'Create directory', (name)=>{
const path = data.path || '/';
this.dataProvider.createFolder(name, data.path || '/', data.sourceName).then(()=>{
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);
}
onFileRename(item) {
const name = item.file || item.name || '';
if (this.state.activeElements.length === 1 && name) {
this.prompt('Enter new name', 'Rename', (newName)=>{
if (!(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.isValidName)(newName)) {
this.status(this.i18n('Enter new name'));
return false;
}
this.dataProvider.fileRename(this.state.currentPath, name, newName, this.state.currentSource).then((message)=>{
this.state.activeElements = [];
this.status(message, true);
void this.loadingManager.loadItems();
}).catch(this.status);
return;
}, this.i18n('type name'), name).bindDestruct(this);
}
}
onChooseItems() {
const 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]);
}
}
}
onOpenLightBox(item) {
_ui_lightboox_lightbox__WEBPACK_IMPORTED_MODULE_10__.UILightBox.open(this, item, this.state.elements);
}
initUploader() {
const self = this, uploaderOptions = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.ConfigProto)(self.o.uploader || {}, jodit_esm_config__WEBPACK_IMPORTED_MODULE_13__.Config.defaultOptions.uploader);
const uploadHandler = ()=>this.loadingManager.loadItems();
self.uploader = self.getInstance('Uploader', uploaderOptions);
self.uploader.bind(self.panel.container, uploadHandler, self.status);
self.e.on('bindUploader.filebrowser', (button)=>{
self.uploader.bind(button, uploadHandler, self.status);
});
}
/** @override */ destruct() {
this.removeGlobalListeners();
this.header.destruct();
this.panel.destruct();
super.destruct();
}
fullFillOptions() {
const keys = [
'getLocalFileByUrl',
'crop',
'resize',
'create',
'fileMove',
'folderMove',
'fileRename',
'folderRename',
'fileRemove',
'folderRemove',
'folder',
'items',
'permissions'
];
keys.forEach((key)=>{
if (this.options[key] != null) {
this.options[key] = (0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.ConfigProto)(this.options[key], this.o.ajax);
}
});
}
constructor(options){
super((0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_16__.ConfigProto)(Object.assign(options || {}, {
resizable: true,
draggable: true,
toolbarButtons: options?.toolbarButtons || jodit_esm_config__WEBPACK_IMPORTED_MODULE_13__.Config.defaultOptions.filebrowser.buttons,
buttons: jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_22__.JoditPro.atom([
'filebrowser.settings',
'fullsize',
'dialog.close'
])
}), jodit_esm_config__WEBPACK_IMPORTED_MODULE_13__.Config.defaultOptions.filebrowser)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dataProvider", (0,jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_20__.makeDataProvider)(this, this.options)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", (0,jodit_esm_modules__WEBPACK_IMPORTED_MODULE_18__.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_0__._)(this, "persistent", new _helpers_persistent_store__WEBPACK_IMPORTED_MODULE_7__.PersistentStore(this, this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "loadingManager", new _helpers_loading_manager__WEBPACK_IMPORTED_MODULE_6__.LoadingManager(this, this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "stateManager", new _helpers_state_manager__WEBPACK_IMPORTED_MODULE_8__.StateManager(this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "historyManager", new _helpers_history_manager__WEBPACK_IMPORTED_MODULE_5__.HistoryManager(this, this.state)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "contextMenuManager", new _helpers_context_menu__WEBPACK_IMPORTED_MODULE_3__.ContextMenuManager(this)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "header", new _ui_header_header__WEBPACK_IMPORTED_MODULE_9__.UIBrowserHeader(this, this.options, this.stateManager)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "panel", new _ui_panel_panel__WEBPACK_IMPORTED_MODULE_11__.UIBrowserPanel(this, this.stateManager)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "files", this.panel), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tree", this.panel), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "uploader", void 0);
jodit_pro_plugins_license_license__WEBPACK_IMPORTED_MODULE_23__.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((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_22__.JoditPro.prototype.afterInitHook.call(this);
}
}
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.autobind
], FileBrowserPro.prototype, "status", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.cache
], FileBrowserPro.prototype, "progressbar", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':resize', {
context: window
})
], FileBrowserPro.prototype, "onResizeWindow", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)([
'state.currentPath',
'state.currentSource'
])
], FileBrowserPro.prototype, "onChangePath", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)('state.theme')
], FileBrowserPro.prototype, "onChangeTheme", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':toggleSettings.filebrowser')
], FileBrowserPro.prototype, "onToggleSettings", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.autobind
], FileBrowserPro.prototype, "onKeyPress", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.autobind
], FileBrowserPro.prototype, "removeGlobalListeners", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':fileRemove.filebrowser')
], FileBrowserPro.prototype, "onFileRemove", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':edit.filebrowser')
], FileBrowserPro.prototype, "onFileEdit", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':folderRename.filebrowser')
], FileBrowserPro.prototype, "onFolderRename", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':folderRemove.filebrowser')
], FileBrowserPro.prototype, "onFolderRemove", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':folderCreate.filebrowser')
], FileBrowserPro.prototype, "onFolderCreate", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':fileRename.filebrowser')
], FileBrowserPro.prototype, "onFileRename", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':select.filebrowser')
], FileBrowserPro.prototype, "onChooseItems", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.watch)(':openLightBox.filebrowser')
], FileBrowserPro.prototype, "onOpenLightBox", null);
FileBrowserPro = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.component,
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_15__.derive)(jodit_esm_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_17__.Dlgs)
], FileBrowserPro);
Object.defineProperty(jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_22__.JoditPro.modules, 'FileBrowserPro', {
value: FileBrowserPro,
writable: false,
enumerable: true,
configurable: true
});
/***/ }),
/***/ 7307:
/***/ (function(module) {
module.exports = "<svg viewBox=\"0 0 512 512\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M365.4,59.628c60.56,0,109.6,49.03,109.6,109.47c0,109.47-109.6,171.8-219.06,281.271 C146.47,340.898,37,278.568,37,169.099c0-60.44,49.04-109.47,109.47-109.47c54.73,0,82.1,27.37,109.47,82.1 C283.3,86.999,310.67,59.628,365.4,59.628z\"/> </svg>"
/***/ }),
/***/ 8087:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ ContextMenuManager: function() { return /* binding */ ContextMenuManager; }
/* harmony export */ });
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
/* harmony import */ var jodit_esm_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80480);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(63399);
/*!
* 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/
*/
class ContextMenuManager extends jodit_esm_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
/** @override */ className() {
return 'ContextMenuManager';
}
onFolderContext(item, e) {
this.buildContextItemMenu(this.getFolderContextActions(item), e);
return false;
}
onItemContext(item, _, e) {
this.buildContextItemMenu(this.getItemContextActions(item), e);
return false;
}
onSourceContext(item, e) {
this.buildContextItemMenu(this.getSourceContextActions(item), e);
return false;
}
buildContextItemMenu(actions, e) {
if (!this.j.o.contextMenu) {
return;
}
const context = (0,jodit_esm_modules_file_browser_factories__WEBPACK_IMPORTED_MODULE_3__.makeContextMenu)(this.j).setMod('theme', this.j.state.theme);
context.show(e.clientX, e.clientY, actions.filter((a)=>a && a.enabled !== false));
this.j.e.on(this.j, 'afterClose', ()=>{
if (context.isOpened) {
context.close();
}
});
}
getItemContextActions(item) {
if (!this.j.stateManager.isActive(item)) {
this.j.stateManager.addActive(item, this.j.state.activeElements.length > 1);
}
if (item.type === 'folder') {
return this.getFolderContextActions({
type: 'directory',
children: [],
name: item.name || '',
path: item.path,
sourceName: item.sourceName
});
}
const opt = this.j.options, dp = this.j.dataProvider, single = this.j.state.activeElements.length === 1;
return [
{
icon: 'pencil',
title: 'Edit',
enabled: Boolean(item.isImage) && opt.editImage && single && (dp.canI('ImageResize') || dp.canI('ImageCrop')),
exec: ()=>{
this.j.e.fire('edit.filebrowser');
}
},
{
icon: 'italic',
title: 'Rename',
enabled: dp.canI('FileRename') && single,
exec: ()=>this.j.e.fire('fileRename.filebrowser', item)
},
{
icon: 'bin',
title: 'Delete',
enabled: dp.canI('FileRemove'),
exec: ()=>this.j.e.fire('fileRemove.filebrowser', item)
},
{
icon: 'eye',
title: 'Preview',
enabled: Boolean(item.isImage || item.type === 'file') && opt.preview && single,
exec: ()=>this.j.e.fire('openLightBox.filebrowser', item)
},
{
icon: 'upload',
title: 'Download',
exec: ()=>{
// TODO Replace to download action
if (item.fileURL) {
this.j.ow.open(item.fileURL);
}
}
}
];
}
getFolderContextActions(item) {
const dp = this.j.dataProvider;
return [
{
icon: 'pencil',
title: 'Rename',
exec: ()=>{
this.j.e.fire('folderRename.filebrowser', item);
},
enabled: dp.canI('FolderRename')
},
{
icon: 'bin',
title: 'Delete',
exec: ()=>{
this.j.e.fire('folderRemove.filebrowser', item);
},
enabled: dp.canI('FolderRemove')
},
{
icon: 'plus',
title: 'Add folder',
exec: ()=>{
this.j.e.fire('folderCreate.filebrowser', item);
},
enabled: dp.canI('FolderCreate')
}
];
}
getSourceContextActions(item) {
return [
{
icon: 'plus',
title: 'Create folder',
exec: ()=>{
this.j.e.fire('folderCreate.filebrowser', item);
}
}
];
}
}
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':contextmenuFolder.filebrowser')
], ContextMenuManager.prototype, "onFolderContext", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':contextmenuItem.filebrowser')
], ContextMenuManager.prototype, "onItemContext", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':contextmenuSource.filebrowser')
], ContextMenuManager.prototype, "onSourceContext", null);
ContextMenuManager = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.component
], ContextMenuManager);
/***/ }),
/***/ 8358:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIPreview: function() { return /* binding */ UIPreview; }
/* harmony export */ });
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82749);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2748);
/* harmony import */ var jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(43555);
/* harmony import */ var jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38837);
/* harmony import */ var jodit_esm_core_ui_group_group__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62405);
/* harmony import */ var jodit_pro_plugins_finder_ui_item_item__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(21130);
/* harmony import */ var jodit_pro_traits_resize_resize__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(54747);
/*!
* 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/
*/
class UIPreview extends jodit_esm_core_ui_group_group__WEBPACK_IMPORTED_MODULE_6__.UIGroup {
/** @override */ className() {
return 'UIPreview';
}
/**
* Add handle resizer
*/ addResize() {
(0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(this.container, {
width: null,
height: null
});
jodit_pro_traits_resize_resize__WEBPACK_IMPORTED_MODULE_8__.UIResize.remove(this);
jodit_pro_traits_resize_resize__WEBPACK_IMPORTED_MODULE_8__.UIResize.install(this, screen.width > 450 ? 'left' : 'top');
}
/** @override */ render() {
return `<div>
<div class="&__image"></div>
<div class="&__info"></div>
<div class="&__loader"></div>
<div class="&__empty-message">~Select image~</div>
</div>`;
}
afterSetMod(name, value) {
if (name === 'hidden' && value === false) {
this.onChangeMetaInfo();
}
super.afterSetMod(name, value);
}
onChangeMetaInfo() {
if (this.getMod('hidden')) {
return;
}
const { metaInfo } = this.state;
this.setMod('empty', !metaInfo);
const info = this.getElm('info');
(0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__.assert)(info != null, 'info element does not exists');
jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.detach(info);
const image = this.getElm('image');
(0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__.assert)(image != null, 'image element does not exists');
(0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(image, {
backgroundImage: null
});
if (!metaInfo) {
return;
}
this.setMod('is-file', metaInfo.isImage === false).setMod('type', metaInfo.type ?? 'file');
jodit_pro_plugins_finder_ui_item_item__WEBPACK_IMPORTED_MODULE_7__.UIBrowserItem.prototype.setElementValue.call(this, 'name', metaInfo.file);
jodit_pro_plugins_finder_ui_item_item__WEBPACK_IMPORTED_MODULE_7__.UIBrowserItem.prototype.setElementValue.call(this, 'time', metaInfo.time);
jodit_pro_plugins_finder_ui_item_item__WEBPACK_IMPORTED_MODULE_7__.UIBrowserItem.prototype.setElementValue.call(this, 'filesize', metaInfo.size);
this.setMod('loading', true);
this.lastLoadPromise?.rejectCallback();
this.lastLoadPromise = (0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.loadImage)(metaInfo.isImage ? metaInfo.fileURL : metaInfo.imageURL, this.j);
this.lastLoadPromise.then((image)=>{
const elm = this.getElm('image');
(0,jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__.assert)(elm != null, 'image element does not exist');
image && (0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(elm, {
backgroundImage: `url(${image.src})`
});
}).finally(()=>{
this.setMod('loading', false);
}).catch(()=>{});
}
constructor(jodit, state){
super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "lastLoadPromise", void 0), this.state = state, this.lastLoadPromise = null;
this.onChangeMetaInfo();
}
}
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.hook)('ready'),
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':resize', {
context: window
}),
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.debounce)()
], UIPreview.prototype, "addResize", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('state.metaInfo')
], UIPreview.prototype, "onChangeMetaInfo", null);
UIPreview = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_2__.component
], UIPreview);
/***/ }),
/***/ 17234:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIBrowserStatusBar: function() { return /* binding */ UIBrowserStatusBar; }
/* harmony export */ });
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38837);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67510);
/*!
* Jodit Ed