jodit-pro
Version:
PRO Version of Jodit Editor
364 lines (321 loc) • 17.4 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([[122],{
/***/ 1050:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
;
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ IframeEditor: function() { return /* binding */ IframeEditor; }
/* 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_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23078);
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31635);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(88092);
/* harmony import */ var _ui_iframe_editor_iframe_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(29744);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(22732);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(50911);
/* harmony import */ var jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(62843);
/* harmony import */ var jodit_esm_modules__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(41409);
/* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_15__ = __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 IframeEditor = /*#__PURE__*/ function(Plugin) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(IframeEditor, Plugin);
function IframeEditor() {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, IframeEditor);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, IframeEditor, arguments), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "buttons", [
{
group: 'form',
name: 'iframeEditor'
}
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__dialog", void 0);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(IframeEditor, [
{
key: "afterInit",
value: function afterInit(jodit) {
jodit.e.on('toggleIframeEditor', this.toggleEditor);
// .on('isButtonGeneratorOpened', () => this.__dialog?.isOpened);
}
},
{
key: "toggleEditor",
value: function toggleEditor(target) {
var _this = this;
var _ref, _ref1, _ref2, _ref3, _ref4;
if (!this.__dialog) {
this.__dialog = new jodit_esm_modules__WEBPACK_IMPORTED_MODULE_14__.Dialog({
language: this.j.o.language,
theme: this.j.o.theme
});
this.__dialog.setHeader('Iframe Properties').setSize(470, 400);
}
if (target && !jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(target, 'iframe')) {
target = undefined;
}
var ui = new _ui_iframe_editor_iframe_editor__WEBPACK_IMPORTED_MODULE_8__.UIIframeEditor(this.__dialog, {
src: (_ref = target === null || target === void 0 ? void 0 : target.src) !== null && _ref !== void 0 ? _ref : '',
name: (_ref1 = target === null || target === void 0 ? void 0 : target.name) !== null && _ref1 !== void 0 ? _ref1 : '',
title: (_ref2 = target === null || target === void 0 ? void 0 : target.title) !== null && _ref2 !== void 0 ? _ref2 : '',
frameBorder: (target === null || target === void 0 ? void 0 : target.frameBorder) === '1' || (target === null || target === void 0 ? void 0 : target.frameBorder) === 'yes',
width: (_ref3 = target === null || target === void 0 ? void 0 : target.offsetWidth) !== null && _ref3 !== void 0 ? _ref3 : 700,
height: (_ref4 = target === null || target === void 0 ? void 0 : target.offsetHeight) !== null && _ref4 !== void 0 ? _ref4 : 400
});
this.__dialog.setContent(ui);
var dlg = this.__dialog;
if (dlg.isOpened) {
dlg.close();
} else {
dlg.setFooter([
(0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_13__.Button)(dlg, 'cancel', 'Cancel', 'default').onAction(function() {
return dlg.close();
}),
(0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_13__.Button)(dlg, 'ok', target ? 'Update' : 'Insert', 'primary').onAction(function() {
if (!ui.srcField.value) {
ui.srcField.validate();
ui.srcField.focus();
return;
}
if (!target) {
target = _this.j.createInside.element('iframe');
_this.j.s.insertNode(target, true, false);
}
target.className = ui.state.className || '';
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_11__.attr)(target, {
src: ui.state.src,
title: ui.state.title,
name: ui.state.name,
frameborder: ui.state.frameBorder ? '1' : '0',
width: ui.state.width,
height: ui.state.height
});
if (jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(target.parentElement, 'jodit')) {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_11__.css)(target.parentElement, {
width: ui.state.width,
height: ui.state.height
});
}
_this.jodit.e.fire('synchro');
dlg.close();
})
]).open();
this.jodit.async.requestIdleCallback(function() {
ui.srcField.focus();
});
}
}
},
{
key: "onDblClick",
value: /**
* DBLClick handler
*/ function onDblClick(e) {
if (jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(e.target, 'iframe')) {
this.toggleEditor(e.target);
}
}
},
{
key: "beforeDestruct",
value: function beforeDestruct(jodit) {
var _this___dialog;
(_this___dialog = this.__dialog) === null || _this___dialog === void 0 ? void 0 : _this___dialog.destruct();
}
}
]);
return IframeEditor;
}((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_12__.Plugin));
/** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(IframeEditor, "requires", [
'license',
'color-picker'
]);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
], IframeEditor.prototype, "toggleEditor", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':dblclick')
], IframeEditor.prototype, "onDblClick", null);
jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_15__.JoditPro.plugins.add('iframe-editor', IframeEditor);
/***/ }),
/***/ 29744:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
;
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ UIIframeEditor: function() { return /* binding */ UIIframeEditor; }
/* 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_component_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(87325);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__ = __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 UIIframeEditor = /*#__PURE__*/ function(UIGroup) {
"use strict";
(0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(UIIframeEditor, UIGroup);
function UIIframeEditor(jodit, opt) {
(0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, UIIframeEditor);
var _this;
_this = (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, UIIframeEditor, [
jodit
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "state", {
src: '',
className: '',
width: 400,
height: 200,
frameBorder: false,
enableScrollbars: false,
name: '',
title: ''
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "srcField", void 0);
Object.assign(_this.state, opt);
_this.srcField = new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIInput(jodit, {
label: 'URL',
type: 'url',
required: true,
value: _this.state.src,
onChange: function onChange(src) {
_this.state.src = src;
}
});
_this.append([
_this.srcField,
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIBlock(jodit, [
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIInput(jodit, {
label: 'Width',
type: 'number',
value: _this.state.width,
onChange: function onChange(v) {
_this.state.width = parseInt(v, 10) || 0;
}
}),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIInput(jodit, {
label: 'Height',
type: 'number',
value: _this.state.height,
onChange: function onChange(v) {
_this.state.height = parseInt(v, 10) || 0;
}
})
], {
// @ts-ignore
className: _this.getFullElName('block'),
align: 'center'
}),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIBlock(jodit, [
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UICheckbox(jodit, {
label: 'Show frame border',
checked: Boolean(opt.frameBorder),
onChange: function onChange(value) {
_this.state.frameBorder = value === 'true';
}
})
]),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIInput(jodit, {
label: 'Name',
value: _this.state.name,
type: 'text',
onChange: function onChange(v) {
_this.state.name = v;
}
}),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIInput(jodit, {
label: 'Title',
value: _this.state.title,
type: 'text',
onChange: function onChange(v) {
_this.state.title = v;
}
})
]);
return _this;
}
(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(UIIframeEditor, [
{
key: "className",
value: function className() {
return 'UIIframeEditor';
}
}
]);
return UIIframeEditor;
}(jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIGroup);
UIIframeEditor = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
jodit_esm_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_6__.component
], UIIframeEditor);
/***/ }),
/***/ 67008:
/***/ (function(module) {
module.exports = "<svg viewBox=\"0 0 32 32\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"> <rect fill=\"none\" height=\"32\" width=\"32\"/> <path d=\"M28,14H18v2h10V14z M28,18H18v2h10V18z M24,22h-6v2h6V22z M14,14H4v10h10V14z M0,6v26h32V6H0z M30,30H2l0.08-20H30V30z\"/> </svg>"
/***/ }),
/***/ 88092:
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
;
/* harmony import */ var _icon_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67008);
/* harmony import */ var _icon_svg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_icon_svg__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6441);
/* harmony import */ var jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2748);
/* harmony import */ var jodit_esm_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68345);
/*!
* 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/
*/
jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.controls.iframeEditor = {
icon: (_icon_svg__WEBPACK_IMPORTED_MODULE_0___default()),
tooltip: 'Iframe Editor',
exec: function exec(editor, iframe) {
if (jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(iframe, 'jodit') && jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(iframe.firstElementChild, 'iframe')) {
iframe = iframe.firstElementChild;
}
editor.e.fire('toggleIframeEditor', jodit_esm_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(iframe, 'iframe') ? iframe : null);
}
};
// @ts-ignore
if ((0,jodit_esm_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_3__.isArray)(jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.popup.iframe)) {
// @ts-ignore
jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.popup.iframe.push('iframeEditor');
}
/***/ })
},
/******/ function(__webpack_require__) { // webpackRuntimeModules
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
/******/ var __webpack_exports__ = (__webpack_exec__(1050));
/******/ return __webpack_exports__;
/******/ }
]);
});