jodit-pro
Version:
PRO Version of Jodit Editor
308 lines (274 loc) • 13.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_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 _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88092);
/* harmony import */ var _ui_iframe_editor_iframe_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29744);
/* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65478);
/* harmony import */ var jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22732);
/* harmony import */ var jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21537);
/* harmony import */ var jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50911);
/* harmony import */ var jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(62843);
/* harmony import */ var jodit_esm_modules__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(41409);
/* harmony import */ var jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_10__ = __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/
*/
class IframeEditor extends jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
afterInit(jodit) {
jodit.e.on('toggleIframeEditor', this.toggleEditor);
// .on('isButtonGeneratorOpened', () => this.__dialog?.isOpened);
}
toggleEditor(target) {
if (!this.__dialog) {
this.__dialog = new jodit_esm_modules__WEBPACK_IMPORTED_MODULE_9__.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_5__.Dom.isTag(target, 'iframe')) {
target = undefined;
}
const ui = new _ui_iframe_editor_iframe_editor__WEBPACK_IMPORTED_MODULE_3__.UIIframeEditor(this.__dialog, {
src: target?.src ?? '',
name: target?.name ?? '',
title: target?.title ?? '',
frameBorder: target?.frameBorder === '1' || target?.frameBorder === 'yes',
width: target?.offsetWidth ?? 700,
height: target?.offsetHeight ?? 400
});
this.__dialog.setContent(ui);
const dlg = this.__dialog;
if (dlg.isOpened) {
dlg.close();
} else {
dlg.setFooter([
(0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_8__.Button)(dlg, 'cancel', 'Cancel', 'default').onAction(()=>dlg.close()),
(0,jodit_esm_core_ui_button__WEBPACK_IMPORTED_MODULE_8__.Button)(dlg, 'ok', target ? 'Update' : 'Insert', 'primary').onAction(()=>{
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_6__.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_5__.Dom.isTag(target.parentElement, 'jodit')) {
(0,jodit_esm_core_helpers__WEBPACK_IMPORTED_MODULE_6__.css)(target.parentElement, {
width: ui.state.width,
height: ui.state.height
});
}
this.jodit.e.fire('synchro');
dlg.close();
})
]).open();
this.jodit.async.requestIdleCallback(()=>{
ui.srcField.focus();
});
}
}
/**
* DBLClick handler
*/ onDblClick(e) {
if (jodit_esm_core_dom__WEBPACK_IMPORTED_MODULE_5__.Dom.isTag(e.target, 'iframe')) {
this.toggleEditor(e.target);
}
}
beforeDestruct(jodit) {
this.__dialog?.destruct();
}
constructor(...args){
super(...args), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "buttons", [
{
group: 'form',
name: 'iframeEditor'
}
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__dialog", void 0);
}
}
/** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(IframeEditor, "requires", [
'license',
'color-picker'
]);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_4__.autobind
], IframeEditor.prototype, "toggleEditor", null);
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
(0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_4__.watch)(':dblclick')
], IframeEditor.prototype, "onDblClick", null);
jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_10__.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_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_component_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87325);
/* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __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/
*/
class UIIframeEditor extends jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIGroup {
className() {
return 'UIIframeEditor';
}
constructor(jodit, opt){
super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", {
src: '',
className: '',
width: 400,
height: 200,
frameBorder: false,
enableScrollbars: false,
name: '',
title: ''
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "srcField", void 0);
Object.assign(this.state, opt);
this.srcField = new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIInput(jodit, {
label: 'URL',
type: 'url',
required: true,
value: this.state.src,
onChange: (src)=>{
this.state.src = src;
}
});
this.append([
this.srcField,
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIBlock(jodit, [
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIInput(jodit, {
label: 'Width',
type: 'number',
value: this.state.width,
onChange: (v)=>{
this.state.width = parseInt(v, 10) || 0;
}
}),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIInput(jodit, {
label: 'Height',
type: 'number',
value: this.state.height,
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_3__.UIBlock(jodit, [
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UICheckbox(jodit, {
label: 'Show frame border',
checked: Boolean(opt.frameBorder),
onChange: (value)=>{
this.state.frameBorder = value === 'true';
}
})
]),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIInput(jodit, {
label: 'Name',
value: this.state.name,
type: 'text',
onChange: (v)=>{
this.state.name = v;
}
}),
new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_3__.UIInput(jodit, {
label: 'Title',
value: this.state.title,
type: 'text',
onChange: (v)=>{
this.state.title = v;
}
})
]);
}
}
UIIframeEditor = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
jodit_esm_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_2__.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: (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__;
/******/ }
]);
});