UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

1,034 lines (980 loc) 34.6 kB
/*! * 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([[702],{ /***/ 10690: /***/ (function(module) { module.exports = "<svg viewBox=\"0 0 30 29\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M15 0.5L30 15.2625H22V24H8V15.2625H0L15 0.5Z\"/> <rect x=\"8\" y=\"26\" width=\"14\" height=\"3\"/> </svg>" /***/ }), /***/ 11699: /***/ (function(module) { module.exports = "<svg viewBox=\"0 0 30 29\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M15 0.5L30 15.2625H22V29H8V15.2625H0L15 0.5Z\"/> </svg>" /***/ }), /***/ 25241: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ UIKeyboard: function() { return /* binding */ UIKeyboard; } /* 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_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82758); /* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65478); /* harmony import */ var jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(43555); /* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67510); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_backspace_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(27926); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_backspace_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(jodit_pro_plugins_keyboard_ui_assets_backspace_svg__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_caps_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(10690); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_caps_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(jodit_pro_plugins_keyboard_ui_assets_caps_svg__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_dots_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91997); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_dots_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(jodit_pro_plugins_keyboard_ui_assets_dots_svg__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_shift_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(11699); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_shift_svg__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(jodit_pro_plugins_keyboard_ui_assets_shift_svg__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_tab_svg__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(98126); /* harmony import */ var jodit_pro_plugins_keyboard_ui_assets_tab_svg__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(jodit_pro_plugins_keyboard_ui_assets_tab_svg__WEBPACK_IMPORTED_MODULE_10__); /*! * 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 UIKeyboard extends jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_5__.UIElement { /** @override */ className() { return 'UIKeyboard'; } /** @override */ render() { const { layout, keySize } = this.j.options.keyboard, rowCount = layout.length; return `<div>${(()=>{ const rows = []; for(let i = 0; i < rowCount; i += 1){ const row = []; for(let j = 0; j < layout[i].length; j += 1){ row.push(`<div style="width:${keySize * layout[i][j]}px;height:${keySize}px;" class="&__key"></div>`); } rows.push(`<div class='&__row'>${row.join('\n')}</div>`); } return rows.join('\n'); })()}</div>`; } onStateChange() { const { currentLayout, options, shift, caps } = this.state, { keys } = this.j.o.keyboard.layoutList[currentLayout]; let index = 0; for(let i = 0; i < keys.length; i += 1){ for(let j = 0; j < keys[i].length; j += 1){ const values = keys[i][j].split(' '); let value = values[0]; if (shift) { value = values[1]; } if (!shift && caps && values[1] && UIKeyboard.isLetter(values[0])) { value = values[1]; } if (options) { value = values[2]; } this.setKeyValue(index, value ?? values[0]); index += 1; } } } static isLetter(c) { return c.toLowerCase() !== c.toUpperCase(); } setKeyValue(index, value) { const elm = this._keys[index]; if (!elm) { return; } let active = false; const { options, shift, caps } = this.state; switch(value){ case 'Caps': active = caps; break; case 'Options': active = options; break; case 'Shift': active = shift; break; } elm.innerHTML = UIKeyboard.decorate(value); elm.classList.toggle(this.getFullElName('key', 'active', true), active); (0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.attr)(elm, '-key', value); } onKeyUp() { if (this.pressed) { this.stopPress(); } } onReady() { this.j.e.on(this.getElms('key'), 'mouseenter', this.stopPress); } stopPress() { if (this.pressed) { this.pressed = false; this.j.async.clearTimeout(this.reKeyDownTimeout); this._keys.forEach((elm)=>{ elm.classList.remove(this.getFullElName('key', 'pressed', true)); }); } } onKeyDown(e, timeout = 0) { const target = e.target; if (!target || !target.classList.contains(this.getFullElName('key'))) { return false; } this.pressed = true; target.classList.add(this.getFullElName('key', 'pressed', true)); const key = (0,jodit_esm_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.attr)(target, '-key'); switch(key){ case 'Caps': this.state.caps = !this.state.caps; break; case 'Shift': this.state.shift = !this.state.shift; break; case 'Options': this.state.options = !this.state.options; break; case 'Enter': case 'Backspace': this.j.e.fire('keydown', { key, preventDefault () {} }); break; case 'Space': case 'Tab': this.j.s.insertNode(this.j.createInside.text(jodit_esm_core_constants__WEBPACK_IMPORTED_MODULE_2__.NBSP_SPACE)); break; default: if (this.state.shift) { this.state.shift = false; } key && this.j.s.insertNode(this.j.createInside.text(key)); } const { periodKeyRepeat, delayKeyRepeat } = this.j.o.keyboard; this.reKeyDownTimeout = this.j.async.setTimeout(()=>this.onKeyDown(e, periodKeyRepeat), timeout || delayKeyRepeat); return false; } static decorate(value) { switch(value){ case 'Space': return ''; case 'Enter': return jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_5__.Icon.get('enter'); case 'Backspace': return (jodit_pro_plugins_keyboard_ui_assets_backspace_svg__WEBPACK_IMPORTED_MODULE_6___default()); case 'Shift': return (jodit_pro_plugins_keyboard_ui_assets_shift_svg__WEBPACK_IMPORTED_MODULE_9___default()); case 'Caps': return (jodit_pro_plugins_keyboard_ui_assets_caps_svg__WEBPACK_IMPORTED_MODULE_7___default()); case 'Options': return (jodit_pro_plugins_keyboard_ui_assets_dots_svg__WEBPACK_IMPORTED_MODULE_8___default()); case 'Tab': return (jodit_pro_plugins_keyboard_ui_assets_tab_svg__WEBPACK_IMPORTED_MODULE_10___default()); default: return value; } } constructor(jodit){ super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", { caps: false, shift: false, options: false, currentLayout: this.j.o.keyboard.defaultLayoutSet }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "_keys", this.getElms('key')), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "pressed", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "reKeyDownTimeout", 0); this.onStateChange(); } } (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([ 'state.currentLayout', 'state.options', 'state.shift', 'state.caps' ]) ], UIKeyboard.prototype, "onStateChange", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([ 'ow:mouseup' ]) ], UIKeyboard.prototype, "onKeyUp", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.hook)('ready') ], UIKeyboard.prototype, "onReady", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind ], UIKeyboard.prototype, "stopPress", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ (0,jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([ 'container:mousedown', 'container:touchstart' ]) ], UIKeyboard.prototype, "onKeyDown", null); UIKeyboard = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_3__.component ], UIKeyboard); /***/ }), /***/ 27926: /***/ (function(module) { module.exports = "<?xml version=\"1.0\" ?><svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M0 10l7-7h13v14H7l-7-7zm14.41 0l2.13-2.12-1.42-1.42L13 8.6l-2.12-2.13-1.42 1.42L11.6 10l-2.13 2.12 1.42 1.42L13 11.4l2.12 2.13 1.42-1.42L14.4 10z\"/></svg>" /***/ }), /***/ 41113: /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _icon_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63643); /* 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); /*! * 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.keyboard = { defaultLayoutSet: 'en', showLayoutSwitcher: true, extraKeyGroup: 'other', extraKeyButtons: [], delayKeyRepeat: 350, periodKeyRepeat: 100, layoutList: { en: { title: 'English', // prettier-ignore keys: [ [ '` ~ ±', '1 ! §', '2 @', '3 #', '4 $', '5 %', '6 ^', '7 &', '8 *', '9 (', '0 )', '- _', '= +', 'Backspace' ], [ 'Tab', 'q Q', 'w W', 'e E', 'r R', 't T', 'y Y', 'u U', 'i I', 'o O', 'p P', '[ {', '] }', '\\ |' ], [ 'Caps', 'a A', 's S', 'd D', 'f F', 'g G', 'h H', 'j J', 'k K', 'l L', '; :', '\' "', 'Enter' ], [ 'Shift', 'z Z', 'x X', 'c C', 'v V', 'b B', 'n N', 'm M', ', <', '. >', '/ ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, es: { title: 'Español', // prettier-ignore keys: [ [ 'º ` ~', '1 ! §', '2 @', '3 #', '4 $', '5 %', '6 ^', '7 &', '8 *', '9 (', '0 )', '- _ |', '¡ = +', 'Backspace' ], [ 'Tab', 'q Q', 'w W', 'e E', 'r R', 't T', 'y Y', 'u U', 'i I', 'o O', 'p P', '[ {', '] }', 'ç Ç \\' ], [ 'Caps', 'a A', 's S', 'd D', 'f F', 'g G', 'h H', 'j J', 'k K', 'l L', 'ñ Ñ ; :', '\' "', 'Enter' ], [ 'Shift', 'z Z', 'x X', 'c C', 'v V', 'b B', 'n N', 'm M', ', <', '. >', '/ ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, de: { title: 'Deutsch', // prettier-ignore keys: [ [ '` ~ ±', '1 ! §', '2 @', '3 #', '4 $', '5 %', '6 ^', '7 &', '8 * :', '9 ( {', '0 ) }', '- _', '= +', 'Backspace' ], [ 'Tab', 'q Q', 'w W', 'e E', 'r R', 't T', 'z Z', 'u U', 'i I', 'o O', 'p P', 'ü Ü [', '] }', '\\ |' ], [ 'Caps', 'a A', 's S', 'd D', 'f F', 'g G', 'h H', 'j J', 'k K', 'l L', 'ö Ö ;', 'ä Ä \' "', 'Enter' ], [ 'Shift', 'y Y', 'x X', 'c C', 'v V', 'b B', 'n N', 'm M', ', <', '. >', '/ ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, ru: { title: 'Русский', // prettier-ignore keys: [ [ '` ~ ±', '1 ! §', '2 @ "', '3 # :', '4 $ <', '5 % >', '6 ^', '7 &', '8 *', '9 (', '0 )', '- _', '= +', 'Backspace' ], [ 'Tab', 'й Й', 'ц Ц', 'у У', 'к К', 'е Е', 'н Н', 'г Г', 'ш Ш', 'щ Щ', 'з З', 'х Х [', 'ъ ] {', '\\ | }' ], [ 'Caps', 'ф Ф', 'ы Ы', 'в В', 'а А', 'п П', 'р Р', 'о О', 'л Л', 'д Д', 'ж Ж ;', 'э Э \'', 'Enter' ], [ 'Shift', 'я Я', 'ч Ч', 'с С', 'м М', 'и И', 'т Т', 'ь Ь', 'б Б ,', 'ю Ю .', '/ ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, tr: { title: 'Türkçe', // prettier-ignore keys: [ [ '" é` ~', '1 ! §', '2 @ "', '3 # :', '4 $ <', '5 % >', '6 ^ ±', '7 &', '8 *', '9 ( {', '0 ) }', '- _ [', '= + ]', 'Backspace' ], [ 'Tab', 'q Q', 'w W', 'e E', 'r R', 't T', 'y Y', 'u U', 'ı I', 'o O', 'p P', 'ğ Ğ', 'ü Ü', ', \\ |' ], [ 'Caps', 'a A', 's S', 'd D', 'f F', 'g G', 'h H', 'j J', 'k K', 'l L', 'ş Ş', 'i̇ İ', 'Enter' ], [ 'Shift', 'z Z', 'x X', 'c C', 'v V', 'b B', 'n N', 'm M', 'ö Ö <', 'ç Ç >', '. / ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, iw: { title: 'Hebrew', // prettier-ignore keys: [ [ '` ~ ±', '1 ! §', '2 @', '3 #', '4 $', '5 %', '6 ^', '7 &', '8 *', '9 (', '0 )', '- _', '= +', 'Backspace' ], [ 'Tab', '/ q Q', '\' w W', 'ק e E', 'ר r R', 'א t T', 'ט y Y', 'ו u U', 'ן i I', 'ם o O', 'פ p P', '[ {', '] }', '\\ |' ], [ 'Caps', 'ש a A', 'ד s S', 'ג d D', 'כ f F', 'ע g G', 'י h H', 'ח j J', 'ל k K', 'ך l L', 'ף ; :', '\' "', 'Enter' ], [ 'Shift', 'ז z Z', 'ס x X', 'ב c C', 'ה v V', 'נ b B', 'מ n N', 'צ m M', ', <', '. >', '/ ?', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] }, tata: { title: 'Tata', // prettier-ignore keys: [ [ 'һ Һ` ~', '1 ! §', '2 @ "', '3 # :', '4 $ <', '5 % >', '6 ^ ±', '7 &', '8 *', '9 ( {', '0 )', '- _', '= +', 'Backspace' ], [ 'Tab', 'й Й', 'ө Ө', 'у У', 'к К', 'е Е', 'н Н', 'г Г', 'ш Ш', 'ә Ә', 'з З', 'х Х [', 'ү Ү ]', '\\ | }' ], [ 'Caps', 'ф Ф', 'ы Ы', 'в В', 'а А', 'п П', 'р Р', 'о О', 'л Л', 'д Д', 'ң Ң ;', 'э Э \'', 'Enter' ], [ 'Shift', 'я Я', 'ч Ч', 'с С', 'м М', 'и И', 'т Т', 'җ Җ', 'б Б ,', 'ю Ю .', 'ґ Ґ /', 'Shift' ], [ 'Options', 'Space', 'Options' ] ] } }, layoutSwitchList: [ 'en', 'es', 'de', 'ru', 'tr', 'iw', 'tata' ], keySize: 32, // prettier-ignore layout: [ [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ], [ 1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5 ], [ 1.8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2.2 ], [ 2.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2.5 ], [ 3.5, 9, 3.5 ] ] }; jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.controls.keyboard = { tooltip: 'Keyboard', icon: (_icon_svg__WEBPACK_IMPORTED_MODULE_0___default()), isActive (editor) { return Boolean(editor.e.fire('isKeyboardOpened')); }, command: 'toggleKeyboard' }; jodit_esm_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.controls.extraKeyboardButtons = {}; /***/ }), /***/ 63643: /***/ (function(module) { module.exports = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v2h2V6H2zm1 3v2h2V9H3zm-1 3v2h2v-2H2zm3 0v2h10v-2H5zm11 0v2h2v-2h-2zM6 9v2h2V9H6zm3 0v2h2V9H9zm3 0v2h2V9h-2zm3 0v2h2V9h-2zM5 6v2h2V6H5zm3 0v2h2V6H8zm3 0v2h2V6h-2zm3 0v2h4V6h-4z\"/> </svg>" /***/ }), /***/ 91997: /***/ (function(module) { module.exports = "<svg xmlns='http://www.w3.org/2000/svg' viewBox=\"0 0 24 24\" > <circle cy=\"12\" cx=\"12\" r=\"2.2\"/> <circle cy=\"12\" cx=\"5\" r=\"2.2\"/> <circle cy=\"12\" cx=\"19\" r=\"2.2\"/> </svg>" /***/ }), /***/ 95618: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ keyboard: function() { return /* binding */ keyboard; } /* 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__(41113); /* harmony import */ var _ui_keyboard_keyboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25241); /* harmony import */ var jodit_esm_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6441); /* harmony import */ var jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65478); /* harmony import */ var jodit_esm_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(27613); /* harmony import */ var jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50911); /* harmony import */ var jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(67510); /* 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 keyboard extends jodit_esm_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin { /** @override */ afterInit(jodit) { jodit.registerCommand('toggleKeyboard', this.toggleKeyboard).registerCommand('insertChar', this.insertChar); jodit.e.on('isKeyboardOpened', ()=>this.__keyboard?.isOpened); } insertChar(_, _1, insertChar) { this.j.s.insertNode(this.j.createInside.text(insertChar)); } /** * Show or hide virtual Keyboard */ toggleKeyboard() { if (!this.__keyboard) { this.__keyboard = new jodit_esm_modules__WEBPACK_IMPORTED_MODULE_9__.Dialog({ toolbarButtonSize: 'tiny' }); const ui = new _ui_keyboard_keyboard__WEBPACK_IMPORTED_MODULE_3__.UIKeyboard(this.j); this.__keyboard.setMod('slim', true).setMod('adaptive', false).setContent(ui); const { showLayoutSwitcher, layoutSwitchList, layoutList } = this.j.o.keyboard; if (showLayoutSwitcher) { const switcher = new jodit_esm_core_ui__WEBPACK_IMPORTED_MODULE_8__.UISelect(this.__keyboard, { value: ui.state.currentLayout, options: layoutSwitchList.map((key)=>{ const title = layoutList[key]?.title ?? key; return { text: title, value: key }; }), onChange (value) { ui.state.currentLayout = value; } }); switcher.setMod('size', 'tiny').setMod('width', 'auto').setMod('variant', 'outline'); this.__keyboard.setHeader(switcher); } } if (this.__keyboard.isOpened) { this.__keyboard.close(); } else { this.__keyboard.open(); } } /** @override */ beforeDestruct(jodit) { this.__keyboard?.destruct(); } constructor(jodit){ super(jodit), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "hasStyle", !jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_10__.JoditPro.fatMode), /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "buttons", [ { group: 'insert', name: 'keyboard' } ]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keyboard", void 0); const { extraKeyButtons, extraKeyGroup } = jodit.o.keyboard; if (extraKeyButtons.length) { extraKeyButtons.forEach((key, index)=>{ const id = (0,jodit_esm_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isString)(key) ? key : key.key, hotkeys = (0,jodit_esm_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isString)(key) || !key.hotkeys ? [ `ctrl+${index + 1}` ] : key.hotkeys; jodit.registerButton({ name: `extraKeyboardButtons.${id}`, group: extraKeyGroup }); const { extraKeyboardButtons } = jodit_esm_config__WEBPACK_IMPORTED_MODULE_4__.Config.defaultOptions.controls; extraKeyboardButtons[id] = { name: id, tooltip: id, args: [ id ], hotkeys, command: 'insertChar' }; }); } } } /** @override */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(keyboard, "requires", [ 'license' ]); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_5__.autobind ], keyboard.prototype, "insertChar", null); (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([ jodit_esm_core_decorators__WEBPACK_IMPORTED_MODULE_5__.autobind ], keyboard.prototype, "toggleKeyboard", null); jodit_pro_jodit_pro__WEBPACK_IMPORTED_MODULE_10__.JoditPro.plugins.add('keyboard', keyboard); /***/ }), /***/ 98126: /***/ (function(module) { module.exports = "<svg viewBox=\"0 0 48 48\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M23.17 14.83l7.17 7.17h-28.34v4h28.34l-7.17 7.17 2.83 2.83 12-12-12-12-2.83 2.83zm16.83-2.83v24h4v-24h-4z\"/> </svg>" /***/ }) }, /******/ function(__webpack_require__) { // webpackRuntimeModules /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } /******/ var __webpack_exports__ = (__webpack_exec__(95618)); /******/ return __webpack_exports__; /******/ } ]); });