UNPKG

jodit

Version:

Jodit is an awesome and useful wysiwyg editor with filebrowser

1,387 lines (1,357 loc) 1.87 MB
/*! * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/) * Version: v4.12.2 * Url: https://xdsoft.net/jodit/ * License(s): MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("{}")); else if(typeof define === 'function' && define.amd) define(["{}"], factory); else { var a = typeof exports === 'object' ? factory(require("{}")) : factory(root["{}"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(self, function(__WEBPACK_EXTERNAL_MODULE__41324__) { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 5266: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Config: function() { return /* binding */ Config; } /* harmony export */ }); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045); /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937); /*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * Editor options. These can be configured upon the creation of the editor. * ```javascript * const editor = Jodit.make('#editor', { * toolbar: true, * buttons: ['bold', 'italic', 'underline'] * // other options * // ... * }); * ``` * @packageDocumentation * @module config */ let ConfigPrototype = {}; /** * Default Editor's Configuration. * * This class holds all default option values for the Jodit editor. * It uses a **private constructor** and a **lazy singleton** pattern — the single instance * is created on the first access to {@link Config.defaultOptions} (also available as `Jodit.defaultOptions`). * * ## How options are resolved * * When you create an editor with `Jodit.make('#editor', userOptions)`, the library * calls {@link ConfigProto}(userOptions, Config.defaultOptions). `ConfigProto` does * **not** deep-clone the defaults. Instead it creates a new object whose JavaScript * prototype is `Config.defaultOptions`: * * ``` * userOptions ──[[Prototype]]──► Config.defaultOptions * ``` * * Any key present in `userOptions` shadows the default; * any key **not** present falls through to `Config.defaultOptions` via the prototype chain. * Nested plain objects are recursively prototyped in the same way, so partial overrides * of nested options work automatically: * * ```js * // Only override `dialogWidth`; all other `image.*` defaults are still available * Jodit.make('#editor', { * image: { dialogWidth: 500 } * }); * ``` * * ## How plugins extend the config * * Each plugin adds its own defaults by assigning to `Config.prototype` and augmenting * the TypeScript type with `declare module`: * * ```ts * // 1. Type augmentation (compile-time) * declare module 'jodit/config' { * interface Config { * toolbarSticky: boolean; * } * } * * // 2. Runtime default * Config.prototype.toolbarSticky = true; * ``` * * Because the constructor runs `Object.assign(this, ConfigPrototype)` (where * `ConfigPrototype` is captured as `Config.prototype` after the class definition), * all prototype-level values — including those added by plugins — are materialized * as own properties on the singleton. This means `Config.defaultOptions` always * contains every registered option as an own, enumerable property. * * ## Changing global defaults * * You can modify `Jodit.defaultOptions` **before** creating editors to change * defaults globally: * * ```js * Jodit.defaultOptions.language = 'de'; * Jodit.defaultOptions.theme = 'dark'; * * // Both editors inherit the new defaults * Jodit.make('#editor1'); * Jodit.make('#editor2'); * ``` * * ## `Jodit.atom` — preventing deep merge * * By default, `ConfigProto` deep-merges nested plain objects and arrays. * Wrap a value with `Jodit.atom(value)` to make it **atomic** — it will completely * replace the default instead of being merged: * * ```js * Jodit.make('#editor', { * controls: { * fontsize: { * // Replace the entire list rather than merging with the default one * list: Jodit.atom([8, 9, 10]) * } * } * }); * ``` * * `Jodit.atom` calls {@link markAsAtomic}, which sets a non-enumerable * `isAtom` flag on the object. `ConfigProto` checks this flag and skips * recursive merging when it is present. Note: top-level arrays (depth 0) * are always treated as atomic — they replace rather than merge. * * @see {@link ConfigProto} for the full merge algorithm * @see {@link markAsAtomic} / {@link isAtom} for the atom marker implementation */ class Config { static get defaultOptions() { if (!Config.__defaultOptions) { Config.__defaultOptions = new Config(); } return Config.__defaultOptions; } constructor(){ /** * When enabled, the editor caches the results of expensive computations (e.g. toolbar rebuilds) * to improve performance. Disable for debugging or when options change frequently at runtime. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "cache", true); /** * Timeout of all asynchronous methods */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "defaultTimeout", 100); /** * Prefix used for CSS class names and local-storage keys to avoid collisions * when multiple editor instances or applications share the same page. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "namespace", ''); /** * Editor loads completely without plugins. Useful when debugging your own plugin. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "safeMode", false); /** * Editor's width * * ```javascript * Jodit.make('.editor', { * width: '100%', * }) * ``` * ```javascript * Jodit.make('.editor', { * width: 600, // equivalent for '600px' * }) * ``` * ```javascript * Jodit.make('.editor', { * width: 'auto', // autosize * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "width", 'auto'); /** * Editor's height * * ```javascript * Jodit.make('.editor', { * height: '100%', * }) * ``` * ```javascript * Jodit.make('.editor', { * height: 600, // equivalent for '600px' * }) * ``` * ```javascript * Jodit.make('.editor', { * height: 'auto', // default - autosize * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "height", 'auto'); /** * List of plugins that will be initialized in safe mode. * * ```js * Jodit.make('#editor', { * safeMode: true, * safePluginsList: ['about'], * extraPlugins: ['yourPluginDev'] * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "safePluginsList", [ 'about', 'enter', 'backspace', 'size', 'bold', 'hotkeys' ]); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "commandToHotkeys", void 0); /** * Reserved for the paid version of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "license", ''); /** * The name of the preset that will be used to initialize the editor. * The list of available presets can be found here Jodit.defaultOptions.presets * ```javascript * Jodit.make('.editor', { * preset: 'inline' * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "preset", 'custom'); /** * Dictionary of named configuration presets. Each key is a preset name and the value * is a partial options object that will be merged into the editor config when * {@link Config.preset} matches the key. * * ```javascript * // Use a built-in preset * Jodit.make('#editor', { * preset: 'inline' * }); * ``` * * ```javascript * // Define and use a custom preset * Jodit.defaultOptions.presets.myCompact = { * toolbarButtonSize: 'small', * showCharsCounter: false, * showWordsCounter: false, * showXPathInStatusbar: false * }; * * Jodit.make('#editor', { * preset: 'myCompact' * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "presets", { inline: { inline: true, toolbar: false, toolbarInline: true, toolbarInlineForSelection: true, showXPathInStatusbar: false, showCharsCounter: false, showWordsCounter: false, showPlaceholder: false } }); /** * The Document object the editor operates within. Defaults to the current `document`. * Override when the editor is created inside an iframe or a different browsing context. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "ownerDocument", jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.globalDocument); /** * Allows you to specify the window in which the editor will be created. Default - window * This is necessary if you are creating the editor inside an iframe but the code is running in the parent window */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "ownerWindow", jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.globalWindow); /** * Shadow root if Jodit was created in it * * ```html * <div id="editor"></div> * ``` * * ```js * const app = document.getElementById('editor'); * app.attachShadow({ mode: 'open' }); * const root = app.shadowRoot; * * root.innerHTML = ` * <link rel="stylesheet" href="./build/jodit.css"/> * <h1>Jodit example in Shadow DOM</h1> * <div id="edit"></div> * `; * * const editor = Jodit.make(root.getElementById('edit'), { * globalFullSize: false, * shadowRoot: root * }); * editor.value = '<p>start</p>'; * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "shadowRoot", null); /** * Base CSS `z-index` for the editor UI (toolbar, popups, dialogs). * Set to a higher value when other page elements overlap the editor. * `0` means no explicit z-index is applied. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "zIndex", 0); /** * Change the read-only state of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "readonly", false); /** * Change the disabled state of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "disabled", false); /** * In readOnly mode, some buttons can still be useful, for example, the button to view source code or print */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "activeButtonsInReadOnly", [ 'source', 'fullsize', 'print', 'about', 'dots', 'selectall' ]); /** * When the editor is in read-only mode, some commands can still be executed: * ```javascript * const editor = Jodit.make('.editor', { * allowCommandsInReadOnly: ['selectall', 'preview', 'print'] * readonly: true * }); * editor.execCommand('selectall');// will be selected all content * editor.execCommand('delete');// but content will not be deleted * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "allowCommandsInReadOnly", [ 'selectall', 'preview', 'print' ]); /** * Size of icons in the toolbar (can be "small", "middle", "large") * * ```javascript * const editor = Jodit.make(".dark_editor", { * toolbarButtonSize: "small" * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "toolbarButtonSize", 'middle'); /** * Allow navigation in the toolbar of the editor by Tab key */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "allowTabNavigation", false); /** * When enabled, the editor renders without its own container chrome (toolbar, borders, statusbar). * The editable area becomes the element itself. Typically combined with * `toolbarInline: true` so a floating toolbar appears on selection. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "inline", false); /** * Theme (can be "dark") * * ```javascript * const editor = Jodit.make(".dark_editor", { * theme: "dark" * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "theme", 'default'); /** * if set true, then the current mode is saved in a cookie, and is restored after a reload of the page */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "saveModeInStorage", false); /** * Class name that can be appended to the editable area * * @see {@link Config.iframeCSSLinks} * @see {@link Config.iframeStyle} * * ```javascript * Jodit.make('#editor', { * editorClassName: 'some_my_class' * }); * ``` * ```html * <style> * .some_my_class p{ * line-height: 16px; * } * </style> * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "editorClassName", false); /** * Class name that can be appended to the main editor container * * ```javascript * const jodit = Jodit.make('#editor', { * className: 'some_my_class' * }); * * console.log(jodit.container.classList.contains('some_my_class')); // true * ``` * ```html * <style> * .some_my_class { * max-width: 600px; * margin: 0 auto; * } * </style> * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "className", false); /** * The internal styles of the editable area. They are intended to change * not the appearance of the editor, but to change the appearance of the content. * * ```javascript * Jodit.make('#editor', { * style: { * font: '12px Arial', * color: '#0c0c0c' * } * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "style", false); /** * Inline CSS styles applied to the outer editor container element. * Use this to style the editor wrapper (borders, background, etc.) without affecting content. * * ```javascript * Jodit.make('#editor', { * containerStyle: { * border: '1px solid #ccc', * background: '#f9f9f9' * } * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "containerStyle", false); /** * Dictionary of variable values in css, a complete list can be found here * https://github.com/xdan/jodit/blob/main/src/styles/variables.less#L25 * * ```js * const editor = Jodit.make('#editor', { * styleValues: { * 'color-text': 'red', * colorBorder: 'black', * 'color-panel': 'blue' * } * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "styleValues", {}); /** * When enabled, the editor dispatches a native `change` event on the original * `<textarea>` element whenever the content changes, so standard DOM listeners work. * * ```javascript * const editor = Jodit.make('#editor'); * document.getElementById('editor').addEventListener('change', function () { * console.log(this.value); * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "triggerChangeEvent", true); /** * The writing direction of the language which is used to create editor content. Allowed values are: '' * (an empty string) – Indicates that content direction will be the same as either the editor UI direction or * the page element direction. 'ltr' – Indicates a Left-To-Right text direction (like in English). * 'rtl' – Indicates a Right-To-Left text direction (like in Arabic). * * ```javascript * Jodit.make('.editor', { * direction: 'rtl' * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "direction", ''); /** * Language by default. if `auto` language set by document.documentElement.lang || * (navigator.language && navigator.language.substr(0, 2)) || * (navigator.browserLanguage && navigator.browserLanguage.substr(0, 2)) || 'en' * * ```html * <!-- include in you page lang file --> * <script src="jodit/lang/de.js"></script> * <script> * var editor = Jodit.make('.editor', { * language: 'de' * }); * </script> * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "language", 'auto'); /** * if true all Lang.i18n(key) return `{key}` * * ```html * <script> * var editor = Jodit.make('.editor', { * debugLanguage: true * }); * * console.log(editor.i18n("Test")); // {Test} * </script> * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "debugLanguage", false); /** * Collection of language pack data `{en: {'Type something': 'Type something', ...}}` * * ```javascript * const editor = Jodit.make('#editor', { * language: 'ru', * i18n: { * ru: { * 'Type something': 'Начните что-либо вводить' * } * } * }); * console.log(editor.i18n('Type something')) //Начните что-либо вводить * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "i18n", false); /** * The tabindex global attribute is an integer indicating if the element can take * input focus (is focusable), if it should participate to sequential keyboard navigation, * and if so, at what position. It can take several values */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tabIndex", -1); /** * Boolean, whether the toolbar should be shown. * Alternatively, a valid css-selector-string to use an element as toolbar container. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "toolbar", true); /** * Boolean, whether the statusbar should be shown. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "statusbar", true); /** * Show tooltip after mouse enter on the button */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "showTooltip", true); /** * Delay before show tooltip */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "showTooltipDelay", 200); /** * Instead of creating a custom tooltip, use the browser's native title tooltips */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "useNativeTooltip", false); /** * How pasted content is inserted into the editor by default. * Possible values: `insert_as_html`, `insert_as_text`, `insert_only_text`, `insert_clear_html`. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "defaultActionOnPaste", jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INSERT_AS_HTML); // TODO // autosave: false, // false or url // autosaveCallback: false, // function // interval: 60, // seconds // TODO /** * Element that will be created when you press Enter */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "enter", jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.PARAGRAPH); /** * When this option is enabled, the editor's content will be placed in an iframe and isolated from the rest of the page. * * ```javascript * Jodit.make('#editor', { * iframe: true, * iframeStyle: 'html{margin: 0px;}body{padding:10px;background:transparent;color:#000;position:relative;z-index:2;\ * user-select:auto;margin:0px;overflow:hidden;}body:after{content:"";clear:both;display:block}'; * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "iframe", false); /** * Allow editing the entire HTML document(html, head) * \> Works together with the iframe option. * * ```js * const editor = Jodit.make('#editor', { * iframe: true, * editHTMLDocumentMode: true * }); * editor.value = '<!DOCTYPE html><html lang="en" style="overflow-y:hidden">' + * '<head><title>Jodit Editor</title></head>' + * '<body spellcheck="false"><p>Some text</p><p> a </p></body>' + * '</html>'; * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "editHTMLDocumentMode", false); /** * Use when you need to insert new block element * use enter option if not set */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "enterBlock", this.enter !== 'br' ? this.enter : jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.PARAGRAPH); /** * Jodit.MODE_WYSIWYG The HTML editor allows you to write like MSWord, * Jodit.MODE_SOURCE syntax highlighting source editor * * ```javascript * var editor = Jodit.make('#editor', { * defaultMode: Jodit.MODE_SPLIT * }); * console.log(editor.getRealMode()) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "defaultMode", jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_WYSIWYG); /** * When enabled, the editor displays both the WYSIWYG view and the source-code view side by side. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "useSplitMode", false); /** * The colors in HEX representation to select a color for the background and for the text in colorpicker * * ```javascript * Jodit.make('#editor', { * colors: ['#ff0000', '#00ff00', '#0000ff'] * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "colors", { greyscale: [ '#000000', '#434343', '#666666', '#999999', '#B7B7B7', '#CCCCCC', '#D9D9D9', '#EFEFEF', '#F3F3F3', '#FFFFFF' ], palette: [ '#980000', '#FF0000', '#FF9900', '#FFFF00', '#00F0F0', '#00FFFF', '#4A86E8', '#0000FF', '#9900FF', '#FF00FF' ], full: [ '#E6B8AF', '#F4CCCC', '#FCE5CD', '#FFF2CC', '#D9EAD3', '#D0E0E3', '#C9DAF8', '#CFE2F3', '#D9D2E9', '#EAD1DC', '#DD7E6B', '#EA9999', '#F9CB9C', '#FFE599', '#B6D7A8', '#A2C4C9', '#A4C2F4', '#9FC5E8', '#B4A7D6', '#D5A6BD', '#CC4125', '#E06666', '#F6B26B', '#FFD966', '#93C47D', '#76A5AF', '#6D9EEB', '#6FA8DC', '#8E7CC3', '#C27BA0', '#A61C00', '#CC0000', '#E69138', '#F1C232', '#6AA84F', '#45818E', '#3C78D8', '#3D85C6', '#674EA7', '#A64D79', '#85200C', '#990000', '#B45F06', '#BF9000', '#38761D', '#134F5C', '#1155CC', '#0B5394', '#351C75', '#733554', '#5B0F00', '#660000', '#783F04', '#7F6000', '#274E13', '#0C343D', '#1C4587', '#073763', '#20124D', '#4C1130' ] }); /** * The default tab color picker * * ```javascript * Jodit.make('#editor2', { * colorPickerDefaultTab: 'color' * }) * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "colorPickerDefaultTab", 'background'); /** * Default width (in pixels) applied to images inserted into the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageDefaultWidth", 300); /** * Do not display these buttons that are on the list * * ```javascript * Jodit.make('#editor2', { * removeButtons: ['hr', 'source'] * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "removeButtons", []); /** * Do not init these plugins * * ```typescript * var editor = Jodit.make('.editor', { * disablePlugins: 'table,iframe' * }); * //or * var editor = Jodit.make('.editor', { * disablePlugins: ['table', 'iframe'] * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "disablePlugins", []); /** * Init and download extra plugins * * ```typescript * var editor = Jodit.make('.editor', { * extraPlugins: ['emoji'] * }); * ``` * It will try load %SCRIPT_PATH%/plugins/emoji/emoji.js and after load will try init it */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "extraPlugins", []); /** * Base path for download extra plugins */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "basePath", void 0); /** * Additional buttons appended to the {@link Config.buttons} list */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "extraButtons", []); /** * By default, you can only install an icon from the Jodit suite. * You can add your icon to the set using the `Jodit.modules.Icon.set (name, svg Code)` method. * But for a declarative declaration, you can use this option. * * ```js * Jodit.modules.Icon.set('someIcon', '<svg><path.../></svg>'); * const editor = Jodit.make({ * extraButtons: [{ * name: 'someButton', * icon: 'someIcon' * }] * }); * ``` * * ```js * const editor = Jodit.make({ * extraIcons: { * someIcon: '<svg><path.../></svg>' * }, * extraButtons: [{ * name: 'someButton', * icon: 'someIcon' * }] * }); * ``` * * ```js * const editor = Jodit.make({ * extraButtons: [{ * name: 'someButton', * icon: '<svg><path.../></svg>' * }] * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "extraIcons", {}); /** * Default attributes for created inside editor elements * * ```js * const editor2 = Jodit.make('#editor', { * createAttributes: { * div: { * class: 'test' * }, * ul: function (ul) { * ul.classList.add('ui-test'); * } * } * }); * * const div2 = editor2.createInside.div(); * expect(div2.className).equals('test'); * * const ul = editor2.createInside.element('ul'); * expect(ul.className).equals('ui-test'); * ``` * Or JSX in React * * ```jsx * import React, {useState, useRef} from 'react'; * import JoditEditor from "jodit-react"; * * const config = { * createAttributes: { * div: { * class: 'align-center' * } * } * }; * * <JoditEditor config={config}/> * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "createAttributes", { table: { style: 'border-collapse:collapse;width: 100%;' } }); /** * The width of the editor, accepted as the biggest. Used to the responsive version of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sizeLG", 900); /** * The width of the editor, accepted as the medium. Used to the responsive version of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sizeMD", 700); /** * The width of the editor, accepted as the small. Used to the responsive version of the editor */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sizeSM", 400); /** * The list of buttons that appear in the editor's toolbar on large places (≥ options.sizeLG). * Note - this is not the width of the device, the width of the editor * * ```javascript * Jodit.make('#editor', { * buttons: ['bold', 'italic', 'source'], * buttonsMD: ['bold', 'italic'], * buttonsXS: ['bold', 'fullsize'], * }); * ``` * * ```javascript * Jodit.make('#editor2', { * buttons: [{ * name: 'empty', * icon: 'source', * exec: function (editor) { * const dialog = new Jodit.modules.Dialog({}), * text = editor.c.element('textarea'); * * dialog.setHeader('Source code'); * dialog.setContent(text); * dialog.setSize(400, 300); * * Jodit.modules.Helpers.css(elm, { * width: '100%', * height: '100%' * }) * dialog.open(); * } * }] * }); * ``` * * ```javascript * Jodit.make('#editor2', { * buttons: Jodit.defaultOptions.buttons.concat([{ * name: 'listsss', * iconURL: 'stuf/dummy.png', * list: { * h1: 'insert Header 1', * h2: 'insert Header 2', * clear: 'Empty editor', * }, * exec: ({originalEvent, control, btn}) => { * var key = control.args[0], * value = control.args[1]; * if (key === 'clear') { * this.val(''); * return; * } * this.s.insertNode(this.c.element(key, '')); * this.message.info('Was inserted ' + value); * }, * template: function (key, value) { * return '<div>' + value + '</div>'; * } * }); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "buttons", [ { group: 'font-style', buttons: [] }, { group: 'list', buttons: [] }, { group: 'font', buttons: [] }, '---', { group: 'script', buttons: [] }, { group: 'media', buttons: [] }, '\n', { group: 'state', buttons: [] }, { group: 'clipboard', buttons: [] }, { group: 'insert', buttons: [] }, { group: 'indent', buttons: [] }, { group: 'color', buttons: [] }, { group: 'form', buttons: [] }, '---', { group: 'history', buttons: [] }, { group: 'search', buttons: [] }, { group: 'source', buttons: [] }, { group: 'other', buttons: [] }, { group: 'info', buttons: [] } ]); /** * Map of toolbar button names to their control definitions (icon, tooltip, exec handler, etc.). * Plugins extend this object with their own button definitions via `Config.prototype.controls`. */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "controls", void 0); /** * Some events are called when the editor is initialized, for example, the `afterInit` event. * So this code won't work: * ```javascript * const editor = Jodit.make('#editor'); * editor.events.on('afterInit', () => console.log('afterInit')); * ``` * You need to do this: * ```javascript * Jodit.make('#editor', { * events: { * afterInit: () => console.log('afterInit') * } * }); * ``` * The option can use any Jodit events, for example: * ```javascript * const editor = Jodit.make('#editor', { * events: { * hello: (name) => console.log('Hello', name) * } * }); * editor.e.fire('hello', 'Mike'); * ``` */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "events", {}); /** * Buttons in toolbar without SVG - only texts */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "textIcons", false); /** * Element for dialog container */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "popupRoot", null); /** * shows a INPUT[type=color] to open the browser color picker, on the right bottom of widget color picker */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "showBrowserColorPicker", true); Object.assign(this, ConfigPrototype); } } (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Config, "__defaultOptions", void 0); ConfigPrototype = Config.prototype; Config.prototype.controls = {}; /***/ }), /***/ 24735: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Async: function() { return /* binding */ Async; } /* harmony export */ }); /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045); /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937); /* harmony import */ var jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61077); /* harmony import */ var jodit_core_helpers_checker_is_abort_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(72068); /* harmony import */ var jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(91565); /* harmony import */ var jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(72412); /* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62101); /* harmony import */ var jodit_core_helpers_checker_is_promise__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(52100); /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(85932); /* harmony import */ var jodit_core_helpers_checker_is_void__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(18303); /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28712); /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(14228); /*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * [[include:core/async/README.md]] * @packageDocumentation * @module async */ class Async { delay(timeout) { return this.promise((resolve)=>this.setTimeout(resolve, timeout)); } setTimeout(callback, timeout, ...args) { if (this.isDestructed) { return 0; } let options = {}; if ((0,jodit_core_helpers_checker_is_void__WEBPACK_IMPORTED_MODULE_9__.isVoid)(timeout)) { timeout = 0; } if (!(0,jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_5__.isNumber)(timeout)) { options = timeout; timeout = options.timeout || 0; } if (options.label) { this.clearLabel(options.label); } const timer = (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.setTimeout)(callback, timeout, ...args); const key = options.label || timer; this.timers.set(key, timer); this.__callbacks.set(key, callback); return timer; } updateTimeout(label, timeout) { (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(label && this.timers.has(label), 'Label does not exist'); if (!label || !this.timers.has(label)) { return null; } const callback = this.__callbacks.get(label); (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__.isFunction)(callback), 'Callback is not a function'); return this.setTimeout(callback, { label, timeout }); } clearLabel(label) { if (label && this.timers.has(label)) { (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(this.timers.get(label)); this.timers.delete(label); this.__callbacks.delete(label); } } clearTimeout(timerOrLabel) { if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_8__.isString)(timerOrLabel)) { return this.clearLabel(timerOrLabel); } (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(timerOrLabel); this.timers.delete(timerOrLabel); this.__callbacks.delete(timerOrLabel); } /** * Debouncing enforces that a function not be called again until a certain amount of time has passed without * it being called. As in "execute this function only if 100 milliseconds have passed without it being called." * * @example * ```javascript * var jodit = Jodit.make('.editor'); * jodit.e.on('mousemove', jodit.async.debounce(() => { * // Do expensive things * }, 100)); * ``` */ debounce(fn, timeout, firstCallImmediately = false) { let timer = 0, fired = false; const promises = []; const callFn = (...args)=>{ if (!fired) { timer = 0; const res = fn(...args); fired = true; if (promises.length) { const runPromises = ()=>{ promises.forEach((res)=>res()); promises.length = 0; }; (0,jodit_core_helpers_checker_is_promise__WEBPACK_IMPORTED_MODULE_7__.isPromise)(res) ? res.finally(runPromises) : runPromises(); } } }; const onFire = (...args)=>{ fired = false; if (!timeout) { callFn(...args); } else { if (!timer && firstCallImmediately) { callFn(...args); } (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(timer); timer = this.setTimeout(()=>callFn(...args), (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__.isFunction)(timeout) ? timeout() : timeout); this.timers.set(fn, timer); } }; return (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_6__.isPlainObject)(timeout) && timeout.promisify ? (...args)=>{ const promise = this.promise((res)=>{ promises.push(res); }).catch((e)=>{ if ((0,jodit_core_helpers_checker_is_abort_error__WEBPACK_IMPORTED_MODULE_3__.isAbortError)(e)) { return null; } throw e; }); onFire(...args); return promise; } : onFire; } microDebounce(fn, firstCallImmediately = false) { let scheduled = false; let needCall = true; let savedArgs; return (...args)=>{ savedArgs = args; if (scheduled) { needCall = true; return; } needCall = true; if (firstCallImmediately) { needCall = false; fn(...savedArgs); } scheduled = true; this.__queueMicrotaskNative(()=>{ scheduled = false; if (this.isDestructed) { return; } needCall && fn(...savedArgs); }); }; } /** * Throttling enforces a maximum number of times a function can be called over time. * As in "execute this function at most once every 100 milliseconds." * * @example * ```javascript * var jodit = Jodit.make('.editor'); * jodit.e.on(document.body, 'scroll', jodit.async.throttle(function() { * // Do expensive things * }, 100)); * ``` */ throttle(fn, timeout, ignore = false) { let timer = null, needInvoke, callee, lastArgs; return (...args)=>{ needInvoke = true; lastArgs = args; if (!timeout) { fn(...lastArgs); return; } if (!timer) { callee = ()=>{ if (needInvoke) { fn(...lastArgs); needInvoke = false; timer = this.setTimeout(callee, (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__.isFunction)(timeout) ? timeout() : timeout); this.timers.set(callee, timer); } else { timer = null; } }; callee(); } }; } promise(executor) { let rejectCallback = ()=>{}; const promise = new Promise((resolve, reject)=>{ rejectCallback = ()=>reject((0,jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_11__.abort)('Abort async')); this.promisesRejections.add(rejectCallback); executor(resolve, reject); }); if (!promise.finally && typeof process !== 'undefined' && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_ES_NEXT) { promise.finally = (onfinally)=>{ promise.then(onfinally).catch(onfinally); return promise; }; } promise.finally(()=>{ this.promisesRejections.delete(rejectCallback); }).catch(()=>null); promise.rejectCallback = rejectCallback; return promise; } /** * Get Promise status */ promiseState(p) { if (p.status) { return p.status; } // Hi IE11 if (!Promise.race) { return new Promise((resolve)=>{ p.then((v)=>{ resolve('fulfilled'); return v; }, (e)=>{ resolve('rejected'); throw e; }); this.setTimeout(()=>{ resolve('pending'); }, 100); }); } const t = {}; return Promise.race([ p, t ]).then((v)=>v === t ? 'pending' : 'fulfilled', ()=>'rejected'); } requestIdleCallback(callback, options = { timeout: 100 }) { const request = this.__requestIdleCallbackNative(callback, options); this.__requestsIdle.add(request); return request; } requestIdlePromise(options) { return this.promise((res)=>{ const request = this.requestIdleCallback(()=>res(request), options); }); } /** * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/ */ schedulerPostTask(task, options = { delay: 0, priority: 'user-visible' }) { const controller = new AbortController(); if (options.signal) { options.signal.addEventListener('abort', ()=>controller.abort()); } this.__controllers.add(controller); // @ts-ignore if (typeof globalThis.scheduler !== 'undefined') { const scheduler = globalThis.scheduler; const promise = scheduler.postTask(task, { ...options, signal: controller.signal }); promise.finally(()=>{ this.__controllers.delete(controller); }).catch(()=>null); return promise; } return this.promise((resolve, reject)=>{ const timeout = this.setTimeout(()=>{ try { resolve(task()); } catch (e) { reject(e); } this.__controllers.delete(controller); }, options.delay || 1); controller.signal.addEventListener('abort', ()=>{ this.clearTimeout(timeout); this.__controllers.delete(controller); reject((0,jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_11__.abort)()); }); }); } schedulerYield() { return this.schedulerPostTask(()=>{}, { priority: 'user-visible' }); } cancelIdleCallback(request) { this.__requestsIdle.delete(request); return this.__cancelIdleCallbackNative(request); } requestAnimationFrame(callback) { const request = requestAnimationFrame(callback); this.__requestsRaf.add(request); return request; } cancelAnimationFrame(request) { this.__requestsRaf.delete(request); cancelAnimationFrame(request); } clear() { this.__requestsIdle.forEach((key)=>this.cancelIdleCallback(key)); this.__requestsRaf.forEach((key)=>this.cancelAnimationFrame(key)); this.__controllers.forEach((controller)=>controller.abort()); this.timers.forEach((key)=>(0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(this.timers.get(key))); this.timers.clear(); this.promisesRejections.forEach((reject)=>reject()); this.promisesRejections.clear(); } destruct() { this.clear(); this.isDestructed = true; } constructor(){ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "timers", new Map()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__callbacks", new Map()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__queueMicrotaskNative", queueMicrotask?.bind(window) ?? Promise.resolve().then.bind(Promise.resolve())); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "promisesRejections", new Set()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__requestsIdle", new Set()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__controllers", new Set()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__requestsRaf", new Set()); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__requestIdleCallbackNative", window['requestIdleCallback']?.bind(window) ?? ((callback, options)=>{ const start = Date.now(); return this.setTimeout(()=>{ callback({ didTimeout: false, timeRemaining: ()=>Math.max(0, 50 - (Date.now() - start)) }); }, options?.timeout ?? 1); })); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__cancelIdleCallbackNative", window['cancelIdleCallback']?.bind(window) ?? ((request)=>{ this.clearTimeout(request); })); (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isDestructed", false); } } /***/ }), /***/ 91231: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Async: function() { return /* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.Async; } /* harmony export */ }); /* harmony import */ var _async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24735); /*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * @module async */ /***/ }), /***/ 80251: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Component: function() { return /* binding */ Component; } /