jodit 4.11.15 → 4.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +151 -14
  5. package/es2015/jodit.min.js +4 -4
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +4 -4
  13. package/es2018/jodit.min.js +24 -24
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +5 -5
  18. package/es2021/jodit.js +151 -14
  19. package/es2021/jodit.min.js +5 -5
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +5 -5
  28. package/es2021.en/jodit.js +151 -14
  29. package/es2021.en/jodit.min.js +6 -6
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +157 -14
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +48 -4
  51. package/esm/config.js +28 -3
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/helpers/utils/config-proto.d.ts +21 -0
  54. package/esm/core/helpers/utils/config-proto.js +32 -0
  55. package/esm/core/ui/icon.d.ts +10 -0
  56. package/esm/core/ui/icon.js +17 -1
  57. package/esm/jodit.d.ts +44 -0
  58. package/esm/jodit.js +47 -1
  59. package/esm/modules/widget/file-selector/file-selector.js +2 -1
  60. package/esm/plugins/link/link.js +2 -1
  61. package/esm/typings.d.ts +1 -0
  62. package/package.json +1 -1
  63. package/types/config.d.ts +48 -4
  64. package/types/core/helpers/utils/config-proto.d.ts +21 -0
  65. package/types/core/ui/icon.d.ts +10 -0
  66. package/types/jodit.d.ts +44 -0
  67. package/types/typings.d.ts +1 -0
package/es5/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.11.15
4
+ * Version: v4.12.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -717,17 +717,61 @@ var ConfigPrototype = {};
717
717
  * ```
718
718
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "disablePlugins", []);
719
719
  /**
720
- * Init and download extra plugins
720
+ * Init and download extra plugins that are **not** already bundled/registered.
721
+ *
722
+ * For every name in this list that is not found in the plugin registry, Jodit
723
+ * loads it **at runtime over the network** from:
724
+ *
725
+ * ```text
726
+ * <basePath>plugins/<name>/<name>(.min).js
727
+ * ```
728
+ *
729
+ * (see {@link Config.basePath} and {@link Config.minified}). If the plugin is
730
+ * already registered — e.g. you imported it statically, or you use a bundle
731
+ * that ships it (such as the `jodit-pro` / `jodit-pro-react` "all plugins"
732
+ * build) — it is **skipped** and no request is made; in that case you don't
733
+ * need `extraPlugins` at all, just add the plugin's button.
721
734
  *
722
735
  * ```typescript
723
- * var editor = Jodit.make('.editor', {
736
+ * // Dynamic loading: fetches <basePath>plugins/emoji/emoji.js
737
+ * const editor = Jodit.make('.editor', {
724
738
  * extraPlugins: ['emoji']
725
739
  * });
726
740
  * ```
727
- * It will try load %SCRIPT_PATH%/plugins/emoji/emoji.js and after load will try init it
741
+ *
742
+ * You can also pass an explicit URL to bypass the `basePath` convention:
743
+ *
744
+ * ```typescript
745
+ * const editor = Jodit.make('.editor', {
746
+ * extraPlugins: [{ name: 'emoji', url: 'https://cdn.example.com/emoji.js' }]
747
+ * });
748
+ * ```
749
+ *
750
+ * Note: if you see a request to a malformed URL (e.g. `.../src/main.tsx?t=...plugins/emoji/emoji.js`),
751
+ * it means `basePath` was auto-detected incorrectly under your bundler — set
752
+ * {@link Config.basePath} explicitly. See the Plugin System docs for details.
728
753
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "extraPlugins", []);
729
754
  /**
730
- * Base path for download extra plugins
755
+ * Base path used to build the URL for dynamically loaded {@link Config.extraPlugins}
756
+ * (and their styles): `<basePath>plugins/<name>/<name>(.min).js`.
757
+ *
758
+ * When not set, Jodit auto-detects it from `document.currentScript`, then the
759
+ * last `<script src>` on the page, then `location.href`. That detection works
760
+ * for classic `<script>` includes, but **fails under ESM bundlers / dev
761
+ * servers** (Vite, Webpack dev, etc.) where there is no script tag for the
762
+ * bundle — it falls back to the entry module URL (e.g. `main.tsx`) and produces
763
+ * a broken plugin URL.
764
+ *
765
+ * Fix: host the plugin files at a public location and point `basePath` there
766
+ * (note the trailing slash):
767
+ *
768
+ * ```typescript
769
+ * const editor = Jodit.make('.editor', {
770
+ * basePath: 'https://your-site.com/jodit-assets/',
771
+ * extraPlugins: ['emoji']
772
+ * // → loads https://your-site.com/jodit-assets/plugins/emoji/emoji.js
773
+ * });
774
+ * ```
731
775
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "basePath", void 0);
732
776
  /**
733
777
  * Additional buttons appended to the {@link Config.buttons} list
@@ -2022,7 +2066,7 @@ __webpack_require__.r(__webpack_exports__);
2022
2066
  * @packageDocumentation
2023
2067
  * @module constants
2024
2068
  */
2025
- var APP_VERSION = "4.11.15";
2069
+ var APP_VERSION = "4.12.3";
2026
2070
  // prettier-ignore
2027
2071
  var ES = "es5";
2028
2072
  var IS_ES_MODERN = false;
@@ -8532,6 +8576,7 @@ var completeUrl = function completeUrl(url) {
8532
8576
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8533
8577
  /* harmony export */ ConfigDeepFlatten: function() { return /* binding */ ConfigDeepFlatten; },
8534
8578
  /* harmony export */ ConfigFlatten: function() { return /* binding */ ConfigFlatten; },
8579
+ /* harmony export */ ConfigMerge: function() { return /* binding */ ConfigMerge; },
8535
8580
  /* harmony export */ ConfigProto: function() { return /* binding */ ConfigProto; }
8536
8581
  /* harmony export */ });
8537
8582
  /* harmony import */ var _swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(42395);
@@ -8642,7 +8687,37 @@ function ConfigFlatten(obj) {
8642
8687
  * const plain = Jodit.modules.Helpers.ConfigDeepFlatten(editor.o.image);
8643
8688
  * console.log(JSON.stringify(plain)); // {"dialogWidth":500, "openOnDblClick": true, "editSrc": true, ...}
8644
8689
  * ```
8645
- */ function ConfigDeepFlatten(obj) {
8690
+ */ /**
8691
+ * Deep-merges `source` into `target` in-place.
8692
+ * Uses the same merge semantics as {@link ConfigProto}:
8693
+ * - Nested plain objects are merged recursively
8694
+ * - {@link isAtom | Atomic} values replace the target entirely
8695
+ * - Everything else (primitives, arrays, class instances) replaces the target value
8696
+ *
8697
+ * Designed for patching `Config.defaultOptions` without losing existing keys:
8698
+ *
8699
+ * ```js
8700
+ * Jodit.configure({
8701
+ * controls: {
8702
+ * someButton: { group: 'custom' }
8703
+ * }
8704
+ * });
8705
+ * // Only `controls.someButton` is touched — all other controls remain intact.
8706
+ * ```
8707
+ *
8708
+ * @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
8709
+ */ function ConfigMerge(target, source) {
8710
+ Object.keys(source).forEach(function(key) {
8711
+ var srcVal = source[key];
8712
+ var tgtVal = target[key];
8713
+ if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(srcVal) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(tgtVal) && !(0,_extend__WEBPACK_IMPORTED_MODULE_6__.isAtom)(srcVal)) {
8714
+ ConfigMerge(tgtVal, srcVal);
8715
+ } else {
8716
+ target[key] = srcVal;
8717
+ }
8718
+ });
8719
+ }
8720
+ function ConfigDeepFlatten(obj) {
8646
8721
  return (0,_utils__WEBPACK_IMPORTED_MODULE_7__.keys)(obj, false).reduce(function(app, key) {
8647
8722
  app[key] = (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(obj[key]) ? ConfigDeepFlatten(obj[key]) : obj[key];
8648
8723
  return app;
@@ -9281,6 +9356,7 @@ __webpack_require__.r(__webpack_exports__);
9281
9356
  /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_23__.$$; },
9282
9357
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
9283
9358
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
9359
+ /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
9284
9360
  /* harmony export */ ConfigProto: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigProto; },
9285
9361
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.ConnectionError; },
9286
9362
  /* harmony export */ LimitedStack: function() { return /* reexport safe */ _stack__WEBPACK_IMPORTED_MODULE_25__.LimitedStack; },
@@ -18646,8 +18722,9 @@ UISpacer = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_4__.__decorate)(
18646
18722
  /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53429);
18647
18723
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25045);
18648
18724
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(81937);
18649
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
18650
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(80991);
18725
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
18726
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
18727
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
18651
18728
  /*!
18652
18729
  * Jodit Editor (https://xdsoft.net/jodit/)
18653
18730
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -18660,6 +18737,7 @@ UISpacer = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_4__.__decorate)(
18660
18737
 
18661
18738
 
18662
18739
 
18740
+
18663
18741
  var Icon = /*#__PURE__*/ function() {
18664
18742
  "use strict";
18665
18743
  function Icon() {
@@ -18672,7 +18750,7 @@ var Icon = /*#__PURE__*/ function() {
18672
18750
  if (/<svg/i.test(name)) {
18673
18751
  return name;
18674
18752
  }
18675
- var icon = Icon.icons[name] || Icon.icons[name.replace(/-/g, '_')] || Icon.icons[name.replace(/_/g, '-')] || Icon.icons[(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.camelCase)(name)] || Icon.icons[(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.kebabCase)(name)] || Icon.icons[name.toLowerCase()];
18753
+ var icon = Icon.icons[name] || Icon.icons[name.replace(/-/g, '_')] || Icon.icons[name.replace(/_/g, '-')] || Icon.icons[(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.camelCase)(name)] || Icon.icons[(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.kebabCase)(name)] || Icon.icons[name.toLowerCase()];
18676
18754
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.IS_PROD && !icon) {
18677
18755
  console.warn('Icon "'.concat(name, '" not found'));
18678
18756
  }
@@ -18728,12 +18806,12 @@ var Icon = /*#__PURE__*/ function() {
18728
18806
  }
18729
18807
  if (iconURL) {
18730
18808
  iconElement = jodit.c.span();
18731
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(iconElement, 'backgroundImage', 'url(' + iconURL.replace('{basePath}', (jodit === null || jodit === void 0 ? void 0 : jodit.basePath) || '') + ')');
18809
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(iconElement, 'backgroundImage', 'url(' + iconURL.replace('{basePath}', (jodit === null || jodit === void 0 ? void 0 : jodit.basePath) || '') + ')');
18732
18810
  } else {
18733
18811
  var _jodit_o_extraIcons;
18734
18812
  var svg = iconFromEvent || Icon.get(name, '') || ((_jodit_o_extraIcons = jodit.o.extraIcons) === null || _jodit_o_extraIcons === void 0 ? void 0 : _jodit_o_extraIcons[name]);
18735
18813
  if (svg) {
18736
- iconElement = jodit.c.fromHTML(svg.trim());
18814
+ iconElement = Icon.toIconElement(jodit, svg.trim());
18737
18815
  if (!/^<svg/i.test(name)) {
18738
18816
  iconElement.classList.add('jodit-icon_' + clearName);
18739
18817
  }
@@ -18749,6 +18827,21 @@ var Icon = /*#__PURE__*/ function() {
18749
18827
  }
18750
18828
  return iconElement;
18751
18829
  }
18830
+ },
18831
+ {
18832
+ key: "toIconElement",
18833
+ value: /**
18834
+ * Turn a raw icon string into an element with a `classList`.
18835
+ *
18836
+ * A plain-text icon (e.g. an emoji/text glyph) makes `fromHTML` return a
18837
+ * Text node, which has no `classList`; wrap it in a span so classes/styles
18838
+ * can be applied and `makeIcon` never crashes on `iconElement.classList`.
18839
+ * Note: SVG icons are `SVGElement` (not `HTMLElement`) but are still Element
18840
+ * nodes with a `classList`, so we check `isElement`, not `isHTMLElement`.
18841
+ */ function toIconElement(jodit, svg) {
18842
+ var node = jodit.c.fromHTML(svg);
18843
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(node) ? node : jodit.c.span('jodit-icon_text', node);
18844
+ }
18752
18845
  }
18753
18846
  ]);
18754
18847
  return Icon;
@@ -21473,6 +21566,54 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
21473
21566
  */ function get() {
21474
21567
  return jodit_config__WEBPACK_IMPORTED_MODULE_18__.Config.defaultOptions;
21475
21568
  }
21569
+ },
21570
+ {
21571
+ key: "configure",
21572
+ value: /**
21573
+ * Deep-merges partial options into the global defaults without replacing
21574
+ * top-level objects. This lets you patch nested settings (e.g. a single
21575
+ * button inside `controls`) without losing the rest:
21576
+ *
21577
+ * ```js
21578
+ * // Add a custom button — all existing controls remain untouched
21579
+ * Jodit.configure({
21580
+ * controls: {
21581
+ * myButton: {
21582
+ * icon: 'pencil',
21583
+ * command: 'selectall'
21584
+ * }
21585
+ * }
21586
+ * });
21587
+ *
21588
+ * // Override only the `group` of an existing button
21589
+ * Jodit.configure({
21590
+ * controls: {
21591
+ * someButton: { group: 'custom' }
21592
+ * }
21593
+ * });
21594
+ *
21595
+ * // Works with any nested option
21596
+ * Jodit.configure({
21597
+ * createAttributes: {
21598
+ * div: { class: 'my-class' }
21599
+ * }
21600
+ * });
21601
+ *
21602
+ * // Use Jodit.atom() to replace a nested value entirely instead of merging
21603
+ * Jodit.configure({
21604
+ * controls: {
21605
+ * fontsize: {
21606
+ * list: Jodit.atom([8, 9, 10])
21607
+ * }
21608
+ * }
21609
+ * });
21610
+ * ```
21611
+ *
21612
+ * @see {@link ConfigMerge} for the merge algorithm
21613
+ * @see {@link ConfigProto} for per-instance prototype-based merge used at editor creation time
21614
+ */ function configure(options) {
21615
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_15__.ConfigMerge)(Jodit.defaultOptions, options);
21616
+ }
21476
21617
  }
21477
21618
  ]);
21478
21619
  return Jodit;
@@ -29923,7 +30064,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
29923
30064
  type: 'submit',
29924
30065
  variant: 'primary',
29925
30066
  text: 'Insert'
29926
- }), form = new jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIForm(editor, [
30067
+ });
30068
+ var form = new jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIForm(editor, [
29927
30069
  new jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIInput(editor, {
29928
30070
  required: true,
29929
30071
  label: 'URL',
@@ -41459,7 +41601,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41459
41601
  key: "__generateForm",
41460
41602
  value: function __generateForm(current, close) {
41461
41603
  var jodit = this.jodit;
41462
- var i18n = jodit.i18n.bind(jodit), _jodit_o_link = jodit.o.link, openInNewTabCheckbox = _jodit_o_link.openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked = _jodit_o_link.openInNewTabCheckboxDefaultChecked, noFollowCheckbox = _jodit_o_link.noFollowCheckbox, formTemplate = _jodit_o_link.formTemplate, formClassName = _jodit_o_link.formClassName, modeClassName = _jodit_o_link.modeClassName;
41604
+ var i18n = jodit.i18n.bind(jodit);
41605
+ var _jodit_o_link = jodit.o.link, openInNewTabCheckbox = _jodit_o_link.openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked = _jodit_o_link.openInNewTabCheckboxDefaultChecked, noFollowCheckbox = _jodit_o_link.noFollowCheckbox, formTemplate = _jodit_o_link.formTemplate, formClassName = _jodit_o_link.formClassName, modeClassName = _jodit_o_link.modeClassName;
41463
41606
  var html = formTemplate(jodit);
41464
41607
  var form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.isString)(html) ? jodit.c.fromHTML(html, {
41465
41608
  target_checkbox_box: openInNewTabCheckbox,
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.11.15
4
+ * Version: v4.12.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.11.15
11
+ * Version: v4.12.3
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */