jodit 4.12.17 → 4.12.20

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 (74) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +7 -7
  4. package/es2015/jodit.js +338 -79
  5. package/es2015/jodit.min.js +7 -7
  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 +7 -7
  13. package/es2018/jodit.min.js +7 -7
  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 +9 -9
  18. package/es2021/jodit.js +335 -79
  19. package/es2021/jodit.min.js +9 -9
  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 +10 -10
  28. package/es2021.en/jodit.js +335 -79
  29. package/es2021.en/jodit.min.js +9 -9
  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 +367 -85
  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/core/constants.js +1 -1
  51. package/esm/core/helpers/html/apply-styles.js +11 -0
  52. package/esm/core/helpers/html/clean-from-word.js +9 -0
  53. package/esm/core/helpers/html/safe-html.js +71 -19
  54. package/esm/core/helpers/html/strip-tags.d.ts +1 -1
  55. package/esm/core/helpers/html/strip-tags.js +7 -3
  56. package/esm/core/helpers/utils/config-proto.js +15 -0
  57. package/esm/core/helpers/utils/convert-media-url-to-video-embed.js +41 -19
  58. package/esm/jodit.js +20 -0
  59. package/esm/modules/uploader/config.js +11 -1
  60. package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +8 -1
  61. package/esm/plugins/color/config.js +12 -3
  62. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
  63. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +48 -3
  64. package/esm/plugins/enter/enter.js +11 -6
  65. package/esm/plugins/hotkeys/config.js +1 -1
  66. package/esm/plugins/indent/config.js +20 -6
  67. package/esm/plugins/paste/paste.js +6 -1
  68. package/esm/plugins/paste-from-word/paste-from-word.js +1 -1
  69. package/esm/plugins/select/select.d.ts +8 -0
  70. package/esm/plugins/select/select.js +37 -0
  71. package/package.json +1 -1
  72. package/types/core/helpers/html/strip-tags.d.ts +1 -1
  73. package/types/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
  74. package/types/plugins/select/select.d.ts +8 -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.12.17
4
+ * Version: v4.12.20
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2066,7 +2066,7 @@ __webpack_require__.r(__webpack_exports__);
2066
2066
  * @packageDocumentation
2067
2067
  * @module constants
2068
2068
  */
2069
- var APP_VERSION = "4.12.17";
2069
+ var APP_VERSION = "4.12.20";
2070
2070
  // prettier-ignore
2071
2071
  var ES = "es5";
2072
2072
  var IS_ES_MODERN = false;
@@ -6719,6 +6719,16 @@ function normalizeCSS(s) {
6719
6719
  iframeDoc.open();
6720
6720
  iframeDoc.write(html);
6721
6721
  iframeDoc.close();
6722
+ // Word marks its auto-generated list markers (the literal
6723
+ // bullet/number, e.g. `1.` or `·`) with `mso-list:Ignore`.
6724
+ // They are display-only and must not be imported, otherwise
6725
+ // the marker text leaks into the content. Drop them before any
6726
+ // style normalization strips the `mso-list` hint. See #948
6727
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.each(iframeDoc.body, function(node) {
6728
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && /mso-list:\s*ignore/i.test(node.getAttribute('style') || '')) {
6729
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(node);
6730
+ }
6731
+ });
6722
6732
  try {
6723
6733
  var _loop = function(i) {
6724
6734
  var _loop = function(idx) {
@@ -6818,6 +6828,15 @@ function normalizeCSS(s) {
6818
6828
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
6819
6829
  break;
6820
6830
  default:
6831
+ // Word marks its auto-generated list markers
6832
+ // (the literal bullet/number, e.g. `1.` or `·`)
6833
+ // with `mso-list:Ignore`. They are display-only
6834
+ // and must not be imported, otherwise the marker
6835
+ // text leaks into the content. See #948
6836
+ if (/mso-list:\s*ignore/i.test(node.getAttribute('style') || '')) {
6837
+ marks.push(node);
6838
+ break;
6839
+ }
6821
6840
  (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_2__.toArray)(node.attributes).forEach(function(attr) {
6822
6841
  if ([
6823
6842
  'src',
@@ -6959,26 +6978,20 @@ function normalizeCSS(s) {
6959
6978
  return;
6960
6979
  }
6961
6980
  var removeEvents = (_options_removeEventAttributes = options.removeEventAttributes) !== null && _options_removeEventAttributes !== void 0 ? _options_removeEventAttributes : options.removeOnError;
6962
- if (removeEvents) {
6963
- removeAllEventAttributes(box);
6964
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.$$)('*', box).forEach(function(elm) {
6965
- return removeAllEventAttributes(elm);
6966
- });
6967
- } else if (options.removeOnError) {
6968
- sanitizeHTMLElement(box, options);
6969
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.$$)('[onerror]', box).forEach(function(elm) {
6970
- return sanitizeHTMLElement(elm, options);
6971
- });
6972
- }
6973
- if (options.safeJavaScriptLink) {
6974
- sanitizeHTMLElement(box, options);
6975
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.$$)('a[href^="javascript"]', box).forEach(function(elm) {
6976
- return sanitizeHTMLElement(elm, options);
6977
- });
6978
- }
6979
- if (options.safeLinksTarget) {
6980
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.$$)('a[target="_blank"]', box).forEach(function(elm) {
6981
- var rel = elm.getAttribute('rel') || '';
6981
+ // Single synchronous traversal of the subtree. Besides removing event
6982
+ // handlers and `javascript:` links, `sanitizeHTMLElement` neutralises
6983
+ // executable `iframe[srcdoc]`, `data:text/html` / SVG `data:` document
6984
+ // sources and dangerous schemes in every URL-bearing attribute.
6985
+ var process = function process(node) {
6986
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node)) {
6987
+ return;
6988
+ }
6989
+ if (removeEvents) {
6990
+ removeAllEventAttributes(node);
6991
+ }
6992
+ sanitizeHTMLElement(node, options);
6993
+ if (options.safeLinksTarget && node.nodeName === 'A' && node.getAttribute('target') === '_blank') {
6994
+ var rel = node.getAttribute('rel') || '';
6982
6995
  var parts = rel.split(/\s+/).filter(Boolean);
6983
6996
  if (!parts.includes('noopener')) {
6984
6997
  parts.push('noopener');
@@ -6986,9 +6999,11 @@ function normalizeCSS(s) {
6986
6999
  if (!parts.includes('noreferrer')) {
6987
7000
  parts.push('noreferrer');
6988
7001
  }
6989
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'rel', parts.join(' '));
6990
- });
6991
- }
7002
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(node, 'rel', parts.join(' '));
7003
+ }
7004
+ };
7005
+ process(box);
7006
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.each(box, process);
6992
7007
  }
6993
7008
  /**
6994
7009
  * Remove all on* event handler attributes from an element
@@ -7026,6 +7041,41 @@ function normalizeCSS(s) {
7026
7041
  }
7027
7042
  return effected;
7028
7043
  }
7044
+ /**
7045
+ * URL-bearing attributes (besides `href`) that can load or execute content.
7046
+ */ var URL_ATTRIBUTES = [
7047
+ 'src',
7048
+ 'data',
7049
+ 'action',
7050
+ 'formaction',
7051
+ 'poster',
7052
+ 'background',
7053
+ 'xlink:href'
7054
+ ];
7055
+ /**
7056
+ * Tags that load their URL as a *document* (scripts inside run). An SVG data
7057
+ * URL is only an XSS vector here — as an `<img>` source it renders inertly.
7058
+ */ var DOCUMENT_EMBED_TAGS = new Set([
7059
+ 'iframe',
7060
+ 'frame',
7061
+ 'object',
7062
+ 'embed'
7063
+ ]);
7064
+ /**
7065
+ * Detects executable / script-bearing URL schemes. The attribute value is
7066
+ * already HTML-entity-decoded by `getAttribute`, so only whitespace and
7067
+ * control characters (which browsers ignore inside a scheme) need stripping.
7068
+ */ function isDangerousUrl(value, tagName) {
7069
+ // eslint-disable-next-line no-control-regex
7070
+ var normalized = value.replace(/[\u0000-\u0020]+/g, '').toLowerCase();
7071
+ if (/^(?:javascript|vbscript|livescript|mocha):/.test(normalized)) {
7072
+ return true;
7073
+ }
7074
+ if (/^data:(?:text\/html|application\/xhtml)/.test(normalized)) {
7075
+ return true;
7076
+ }
7077
+ return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
7078
+ }
7029
7079
  function sanitizeHTMLElement(elm) {
7030
7080
  var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
7031
7081
  safeJavaScriptLink: true,
@@ -7044,6 +7094,39 @@ function sanitizeHTMLElement(elm) {
7044
7094
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'href', location.protocol + '//' + href);
7045
7095
  effected = true;
7046
7096
  }
7097
+ if (safeJavaScriptLink) {
7098
+ // `srcdoc` runs its content as a full HTML document — drop it entirely.
7099
+ if (elm.hasAttribute('srcdoc')) {
7100
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'srcdoc', null);
7101
+ effected = true;
7102
+ }
7103
+ // Strip executable schemes from any other URL-bearing attribute.
7104
+ var tagName = elm.nodeName.toLowerCase();
7105
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7106
+ try {
7107
+ for(var _iterator = URL_ATTRIBUTES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7108
+ var name = _step.value;
7109
+ var value = elm.getAttribute(name);
7110
+ if (value && isDangerousUrl(value, tagName)) {
7111
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, name, null);
7112
+ effected = true;
7113
+ }
7114
+ }
7115
+ } catch (err) {
7116
+ _didIteratorError = true;
7117
+ _iteratorError = err;
7118
+ } finally{
7119
+ try {
7120
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7121
+ _iterator.return();
7122
+ }
7123
+ } finally{
7124
+ if (_didIteratorError) {
7125
+ throw _iteratorError;
7126
+ }
7127
+ }
7128
+ }
7129
+ }
7047
7130
  return effected;
7048
7131
  }
7049
7132
 
@@ -7095,7 +7178,7 @@ var ALONE_TAGS = new Set([
7095
7178
  /**
7096
7179
  * Extract plain text from HTML text
7097
7180
  */ function stripTags(html) {
7098
- var doc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : document, exclude = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
7181
+ var doc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : document, exclude = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, blockBr = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
7099
7182
  var tmp = doc.createElement('div');
7100
7183
  if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(html)) {
7101
7184
  tmp.innerHTML = html;
@@ -7109,7 +7192,7 @@ var ALONE_TAGS = new Set([
7109
7192
  }
7110
7193
  if (exclude && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(p, exclude)) {
7111
7194
  var tag = p.nodeName.toLowerCase();
7112
- var text = !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(p, ALONE_TAGS) ? "%%%jodit-".concat(tag, "%%%").concat(stripTags(p.innerHTML, doc, exclude), "%%%/jodit-").concat(tag, "%%%") : "%%%jodit-single-".concat(tag, "%%%");
7195
+ var text = !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(p, ALONE_TAGS) ? "%%%jodit-".concat(tag, "%%%").concat(stripTags(p.innerHTML, doc, exclude, blockBr), "%%%/jodit-").concat(tag, "%%%") : "%%%jodit-single-".concat(tag, "%%%");
7113
7196
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.before(p, doc.createTextNode(text));
7114
7197
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(p);
7115
7198
  return;
@@ -7126,7 +7209,11 @@ var ALONE_TAGS = new Set([
7126
7209
  return;
7127
7210
  }
7128
7211
  if (nx) {
7129
- pr.insertBefore(doc.createTextNode(' '), nx);
7212
+ // By default blocks are joined with a single space (single-line
7213
+ // plain text). When `blockBr` is set, separate them with a line
7214
+ // break instead, so paragraph structure survives — e.g. the
7215
+ // "Insert only Text" paste option. See #1232
7216
+ pr.insertBefore(doc.createTextNode(blockBr ? '%%%jodit-single-br%%%' : ' '), nx);
7130
7217
  }
7131
7218
  });
7132
7219
  return restoreTags((0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trim)(tmp.innerText));
@@ -8658,6 +8745,18 @@ var completeUrl = function completeUrl(url) {
8658
8745
 
8659
8746
 
8660
8747
 
8748
+ /**
8749
+ * Keys that must never be copied from a (potentially untrusted) config object —
8750
+ * assigning them during a recursive merge can reach and mutate
8751
+ * `Object.prototype` (prototype pollution, CWE-1321).
8752
+ */ var UNSAFE_PROTO_KEYS = [
8753
+ '__proto__',
8754
+ 'constructor',
8755
+ 'prototype'
8756
+ ];
8757
+ function isUnsafeProtoKey(key) {
8758
+ return UNSAFE_PROTO_KEYS.indexOf(key) !== -1;
8759
+ }
8661
8760
  /**
8662
8761
  * @example
8663
8762
  * ```js
@@ -8707,6 +8806,9 @@ var completeUrl = function completeUrl(url) {
8707
8806
  }
8708
8807
  var newOpt = {};
8709
8808
  Object.keys(options).forEach(function(key) {
8809
+ if (isUnsafeProtoKey(key)) {
8810
+ return;
8811
+ }
8710
8812
  var opt = options[key], protoKey = proto ? proto[key] : null;
8711
8813
  if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(opt) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(protoKey) && !(0,_extend__WEBPACK_IMPORTED_MODULE_6__.isAtom)(opt)) {
8712
8814
  newOpt[key] = ConfigProto(opt, protoKey, deep + 1);
@@ -8765,6 +8867,9 @@ function ConfigFlatten(obj) {
8765
8867
  * @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
8766
8868
  */ function ConfigMerge(target, source) {
8767
8869
  Object.keys(source).forEach(function(key) {
8870
+ if (isUnsafeProtoKey(key)) {
8871
+ return;
8872
+ }
8768
8873
  var srcVal = source[key];
8769
8874
  var tgtVal = target[key];
8770
8875
  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)) {
@@ -8811,7 +8916,6 @@ function ConfigDeepFlatten(obj) {
8811
8916
  return url;
8812
8917
  }
8813
8918
  var parser = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.globalDocument.createElement('a');
8814
- var pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
8815
8919
  parser.href = url;
8816
8920
  if (!width) {
8817
8921
  width = 400;
@@ -8823,19 +8927,43 @@ function ConfigDeepFlatten(obj) {
8823
8927
  switch(parser.hostname){
8824
8928
  case 'www.vimeo.com':
8825
8929
  case 'vimeo.com':
8826
- return pattern1.test(url) ? url.replace(pattern1, '<iframe width="' + width + '" height="' + height + '" src="' + protocol + '//player.vimeo.com/video/$1" frameborder="0" allowfullscreen></iframe>') : url;
8930
+ {
8931
+ // The numeric video id can be preceded by `channels/<name>/` or
8932
+ // `groups/<name>/videos/` and followed by tracking params (e.g.
8933
+ // `?share=copy`). Unlisted videos keep a hash right after the id
8934
+ // (`vimeo.com/<id>/<hash>`). Extract the id (+ hash) from the path
8935
+ // so all of those forms produce a valid embed. See #1209
8936
+ var segments = parser.pathname.split('/').filter(Boolean);
8937
+ var idIndex = segments.findIndex(function(s) {
8938
+ return /^\d+$/.test(s);
8939
+ });
8940
+ if (idIndex === -1) {
8941
+ return url;
8942
+ }
8943
+ var path = segments[idIndex];
8944
+ var hash = segments[idIndex + 1];
8945
+ if (hash && idIndex === 0) {
8946
+ path += '/' + hash;
8947
+ }
8948
+ return '<iframe width="' + width + '" height="' + height + '" src="' + protocol + '//player.vimeo.com/video/' + path + '" frameborder="0" allowfullscreen></iframe>';
8949
+ }
8827
8950
  case 'youtube.com':
8828
8951
  case 'www.youtube.com':
8952
+ case 'm.youtube.com':
8953
+ case 'music.youtube.com':
8829
8954
  case 'youtu.be':
8830
8955
  case 'www.youtu.be':
8831
8956
  {
8832
- var query = parser.search ? (0,_parse_query__WEBPACK_IMPORTED_MODULE_2__.parseQuery)(parser.search) : {
8833
- v: parser.pathname.substring(1)
8834
- };
8835
- if (/^embed\/.*/.test(query.v)) {
8836
- query.v = query.v.substring(6);
8837
- }
8838
- return query.v ? '<iframe width="' + width + '" height="' + height + '" src="' + protocol + '//www.youtube.com/embed/' + query.v + '" frameborder="0" allowfullscreen></iframe>' : url;
8957
+ var query = parser.search ? (0,_parse_query__WEBPACK_IMPORTED_MODULE_2__.parseQuery)(parser.search) : {};
8958
+ // `youtube.com/watch` keeps the video id in the `v` query
8959
+ // parameter, while the short `youtu.be/<id>` links and the
8960
+ // `/embed/`, `/shorts/`, `/live/` paths keep it in the pathname.
8961
+ // Modern share urls add tracking params (e.g. `?si=`, `?t=`), so
8962
+ // the pathname must still be used as a fallback when there is no
8963
+ // `v`. See #1209
8964
+ var v = query.v || parser.pathname.substring(1);
8965
+ v = v.replace(/^(watch|embed|shorts|live|v)\//, '').replace(/\/$/, '');
8966
+ return v ? '<iframe width="' + width + '" height="' + height + '" src="' + protocol + '//www.youtube.com/embed/' + v + '" frameborder="0" allowfullscreen></iframe>' : url;
8839
8967
  }
8840
8968
  }
8841
8969
  return url;
@@ -21493,6 +21621,23 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
21493
21621
  }
21494
21622
  _this.synchronizeValues();
21495
21623
  }
21624
+ }).on(this.ow, 'mouseup', function(event) {
21625
+ if (_this.o.readonly || _this.__isSilentChange) {
21626
+ return;
21627
+ }
21628
+ // When a selection is started inside the editor and the
21629
+ // mouse button is released outside of it, the editable
21630
+ // area never receives the `mouseup` event, so the toolbar
21631
+ // state (active buttons) is not recalculated. Re-fire the
21632
+ // event manually for that case while the selection still
21633
+ // belongs to the editor. See #1251
21634
+ var target = event.target;
21635
+ var insideEditor = Boolean(target && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_15__.isNumber)(target.nodeType) && editor.contains(target));
21636
+ if (insideEditor || !_this.s.isInsideArea) {
21637
+ return;
21638
+ }
21639
+ _this.e.fire('changeSelection');
21640
+ _this.synchronizeValues();
21496
21641
  });
21497
21642
  }
21498
21643
  },
@@ -29263,9 +29408,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
29263
29408
  insertImageAsBase64URI: false,
29264
29409
  imagesExtensions: [
29265
29410
  'jpg',
29266
- 'png',
29267
29411
  'jpeg',
29268
- 'gif'
29412
+ 'png',
29413
+ 'gif',
29414
+ 'webp',
29415
+ 'bmp',
29416
+ 'svg',
29417
+ 'tiff',
29418
+ 'avif'
29269
29419
  ],
29270
29420
  headers: null,
29271
29421
  data: null,
@@ -33621,7 +33771,11 @@ function filterStyleProperties(style, allowed) {
33621
33771
  if (!jodit.o.cleanHTML.removeEmptyElements) {
33622
33772
  return false;
33623
33773
  }
33624
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current));
33774
+ // Never drop an empty inline element that currently holds the caret it is
33775
+ // a pending-format marker the user is about to type into (#1291). `current`
33776
+ // is captured before a click moves the caret, so also check the live caret.
33777
+ var liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
33778
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current)) && (liveCaret == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, liveCaret));
33625
33779
  }
33626
33780
 
33627
33781
 
@@ -33970,8 +34124,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
33970
34124
  var update = function update(key, value) {
33971
34125
  if (value && value !== (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(editor.editor, key).toString()) {
33972
34126
  button.state.icon.fill = value;
33973
- return;
34127
+ return true;
33974
34128
  }
34129
+ return false;
33975
34130
  };
33976
34131
  if (color) {
33977
34132
  var mode = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.dataBind)(button, 'color');
@@ -33981,8 +34136,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
33981
34136
  var current = editor.s.current();
33982
34137
  if (current && !button.state.disabled) {
33983
34138
  var currentBpx = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor) || editor.editor;
33984
- update('color', (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentBpx, 'color').toString());
33985
- update('background-color', (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentBpx, 'background-color').toString());
34139
+ // The icon's fill mirrors the current text/background color so the
34140
+ // button reflects the formatting under the caret. Both calls run so
34141
+ // that a background color (the second call) wins over the text color
34142
+ // when both are set. Keep the computed fill instead of resetting it
34143
+ // below. See #195, #182
34144
+ var hasColor = update('color', (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentBpx, 'color').toString());
34145
+ var hasBackground = update('background-color', (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.css)(currentBpx, 'background-color').toString());
34146
+ if (hasColor || hasBackground) {
34147
+ return;
34148
+ }
33986
34149
  }
33987
34150
  button.state.icon.fill = '';
33988
34151
  button.state.activated = false;
@@ -34866,12 +35029,37 @@ var DragState = /*#__PURE__*/ function(DragState) {
34866
35029
  this.dragList = this.j.o.draggableTags ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.splitArray)(this.j.o.draggableTags).filter(Boolean).map(function(item) {
34867
35030
  return item.toLowerCase();
34868
35031
  }) : [];
35032
+ // Allow another plugin (e.g. a drag handle/anchor) to start dragging
35033
+ // an element programmatically, regardless of the `draggableTags` list.
35034
+ this.j.e.on('startDragElement', this.onStartDragElement);
34869
35035
  if (!this.dragList.length) {
34870
35036
  return;
34871
35037
  }
34872
35038
  this.j.e.on('mousedown dragstart', this.onDragStart);
34873
35039
  }
34874
35040
  },
35041
+ {
35042
+ key: "onStartDragElement",
35043
+ value: /**
35044
+ * Start dragging a specific element programmatically.
35045
+ *
35046
+ * Allows a separate UI element (for example a drag handle/anchor shown next
35047
+ * to a block) to initiate the drag without the user pressing directly on the
35048
+ * draggable element itself.
35049
+ *
35050
+ * @example
35051
+ * ```js
35052
+ * handle.addEventListener('mousedown', e => {
35053
+ * editor.e.fire('startDragElement', preBlock, e);
35054
+ * });
35055
+ * ```
35056
+ */ function onStartDragElement(element, event) {
35057
+ if (this.isInDestruct || this.state > 0 || !element) {
35058
+ return;
35059
+ }
35060
+ this.startDragging(element, event);
35061
+ }
35062
+ },
34875
35063
  {
34876
35064
  key: "onDragStart",
34877
35065
  value: /**
@@ -34898,11 +35086,21 @@ var DragState = /*#__PURE__*/ function(DragState) {
34898
35086
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(lastTarget.parentElement, 'a') && lastTarget.parentElement.firstChild === lastTarget && lastTarget.parentElement.lastChild === lastTarget) {
34899
35087
  lastTarget = lastTarget.parentElement;
34900
35088
  }
35089
+ this.startDragging(lastTarget, event);
35090
+ }
35091
+ },
35092
+ {
35093
+ key: "startDragging",
35094
+ value: /**
35095
+ * Prepare the ghost element and switch to the waiting state.
35096
+ * Shared by the native mousedown handler and the programmatic
35097
+ * `startDragElement` event handler.
35098
+ */ function startDragging(target, event) {
34901
35099
  this.startX = event.clientX;
34902
35100
  this.startY = event.clientY;
34903
35101
  this.isCopyMode = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.ctrlKey)(event); // we can move only element from editor
34904
- this.draggable = lastTarget.cloneNode(true);
34905
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.dataBind)(this.draggable, 'target', lastTarget);
35102
+ this.draggable = target.cloneNode(true);
35103
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.dataBind)(this.draggable, 'target', target);
34906
35104
  this.state = 1;
34907
35105
  this.addDragListeners();
34908
35106
  }
@@ -34981,6 +35179,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
34981
35179
  }
34982
35180
  var parentElement = fragment.parentElement;
34983
35181
  this.j.s.insertNode(fragment, true, false);
35182
+ // Dropping a non-editable block (e.g. a `<pre>` code sample) can leave an
35183
+ // invisible filler text node beside it. Remove it so the drop does not
35184
+ // introduce a stray empty line (which clean-html would otherwise strip
35185
+ // later, causing a flash).
35186
+ [
35187
+ fragment.previousSibling,
35188
+ fragment.nextSibling
35189
+ ].forEach(function(node) {
35190
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmptyTextNode(node)) {
35191
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(node);
35192
+ }
35193
+ });
34984
35194
  if (parentElement && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(parentElement) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isCell(parentElement)) {
34985
35195
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(parentElement);
34986
35196
  }
@@ -35016,13 +35226,16 @@ var DragState = /*#__PURE__*/ function(DragState) {
35016
35226
  key: "beforeDestruct",
35017
35227
  value: /** @override */ function beforeDestruct() {
35018
35228
  this.onDragEnd();
35019
- this.j.e.off('mousedown dragstart', this.onDragStart);
35229
+ this.j.e.off('mousedown dragstart', this.onDragStart).off('startDragElement', this.onStartDragElement);
35020
35230
  this.removeDragListeners();
35021
35231
  }
35022
35232
  }
35023
35233
  ]);
35024
35234
  return dragAndDropElement;
35025
35235
  }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__.Plugin));
35236
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
35237
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
35238
+ ], dragAndDropElement.prototype, "onStartDragElement", null);
35026
35239
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
35027
35240
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
35028
35241
  ], dragAndDropElement.prototype, "onDragStart", null);
@@ -35631,18 +35844,24 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_7__.pluginSystem.add('dtd', dtd);
35631
35844
  {
35632
35845
  key: "onEnterKeyDown",
35633
35846
  value: function onEnterKeyDown(event) {
35847
+ var _this = this;
35634
35848
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.KEY_ENTER) {
35635
35849
  var editor = this.j;
35636
35850
  var beforeEnter = editor.e.fire('beforeEnter', event);
35637
35851
  if (beforeEnter !== undefined) {
35638
35852
  return beforeEnter;
35639
35853
  }
35640
- if (!editor.s.isCollapsed()) {
35641
- editor.execCommand('Delete');
35642
- }
35643
- editor.s.focus();
35644
- this.onEnter(event);
35645
- editor.e.fire('afterEnter', event);
35854
+ // Delete-of-selection + new block must be a single history step,
35855
+ // otherwise pressing Enter over a selection needs two Ctrl+Z to undo
35856
+ // (the first only reverts to the intermediate empty state). #1292
35857
+ editor.history.snapshot.transaction(function() {
35858
+ if (!editor.s.isCollapsed()) {
35859
+ editor.execCommand('Delete');
35860
+ }
35861
+ editor.s.focus();
35862
+ _this.onEnter(event);
35863
+ editor.e.fire('afterEnter', event);
35864
+ });
35646
35865
  editor.synchronizeValues(); // fire change
35647
35866
  return false;
35648
35867
  }
@@ -36791,7 +37010,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
36791
37010
  'cmd+shift+7'
36792
37011
  ],
36793
37012
  insertUnorderedList: [
36794
- 'ctrl+shift+8, cmd+shift+8'
37013
+ 'ctrl+shift+8',
37014
+ 'cmd+shift+8'
36795
37015
  ],
36796
37016
  selectall: [
36797
37017
  'ctrl+a',
@@ -39492,14 +39712,31 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.indent = {
39492
39712
  };
39493
39713
  jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.outdent = {
39494
39714
  isDisabled: function isDisabled(editor) {
39715
+ var _editor_o_tab;
39495
39716
  var current = editor.s.current();
39496
- if (current) {
39497
- var currentBox = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock, editor.editor);
39498
- if (currentBox) {
39499
- var arrow = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getKey)(editor.o.direction, currentBox);
39500
- return !currentBox.style[arrow] || parseInt(currentBox.style[arrow], 10) <= 0;
39717
+ if (!current) {
39718
+ return true;
39719
+ }
39720
+ // A list item whose list is nested inside another list item can be
39721
+ // outdented (un-nested) by the `tab` plugin, even without an inline
39722
+ // indent margin. Keep the button enabled in that case. See #1247
39723
+ if ((_editor_o_tab = editor.o.tab) === null || _editor_o_tab === void 0 ? void 0 : _editor_o_tab.tabInsideLiInsertNewList) {
39724
+ var li = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, 'li', editor.editor);
39725
+ if (li) {
39726
+ var list = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(li, [
39727
+ 'ul',
39728
+ 'ol'
39729
+ ], editor.editor);
39730
+ if (list && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(list, 'li', editor.editor)) {
39731
+ return false;
39732
+ }
39501
39733
  }
39502
39734
  }
39735
+ var currentBox = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock, editor.editor);
39736
+ if (currentBox) {
39737
+ var arrow = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getKey)(editor.o.direction, currentBox);
39738
+ return !currentBox.style[arrow] || parseInt(currentBox.style[arrow], 10) <= 0;
39739
+ }
39503
39740
  return true;
39504
39741
  },
39505
39742
  tooltip: 'Decrease Indent'
@@ -42697,7 +42934,7 @@ var pasteFromWord = /*#__PURE__*/ function(Plugin) {
42697
42934
  }
42698
42935
  case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.INSERT_ONLY_TEXT:
42699
42936
  {
42700
- html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.stripTags)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.cleanFromWord)(html));
42937
+ html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.stripTags)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.cleanFromWord)(html), this.j.ed, new Set(this.j.o.pasteExcludeStripTags), this.j.o.nl2brInPlainText);
42701
42938
  break;
42702
42939
  }
42703
42940
  }
@@ -43434,10 +43671,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.paste = {
43434
43671
  html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.cleanFromWord)(html);
43435
43672
  break;
43436
43673
  case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.INSERT_ONLY_TEXT:
43437
- html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.stripTags)(html, this.j.ed, new Set(this.j.o.pasteExcludeStripTags));
43674
+ html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.stripTags)(html, this.j.ed, new Set(this.j.o.pasteExcludeStripTags), this.j.o.nl2brInPlainText);
43438
43675
  break;
43439
43676
  case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.INSERT_AS_TEXT:
43440
43677
  html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.htmlspecialchars)(html);
43678
+ // Keep the source line breaks instead of letting the raw
43679
+ // newlines collapse into spaces when rendered. See #1093
43680
+ if (this.j.o.nl2brInPlainText) {
43681
+ html = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.nl2br)(html);
43682
+ }
43441
43683
  break;
43442
43684
  default:
43443
43685
  {
@@ -46850,13 +47092,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46850
47092
  /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34918);
46851
47093
  /* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38574);
46852
47094
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31635);
46853
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(84839);
46854
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23211);
46855
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(28077);
46856
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57821);
46857
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(91206);
46858
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4099);
46859
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(47670);
47095
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81937);
47096
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(84839);
47097
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23211);
47098
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28077);
47099
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57821);
47100
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(91206);
47101
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4099);
47102
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47670);
46860
47103
  /*!
46861
47104
  * Jodit Editor (https://xdsoft.net/jodit/)
46862
47105
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -46879,6 +47122,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46879
47122
 
46880
47123
 
46881
47124
 
47125
+
46882
47126
  /**
46883
47127
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
46884
47128
  *
@@ -46929,7 +47173,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46929
47173
  var j = this.j;
46930
47174
  var result, target = e.target;
46931
47175
  while(result === undefined && target && target !== j.editor){
46932
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_10__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
47176
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46933
47177
  target = target.parentElement;
46934
47178
  }
46935
47179
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -46944,12 +47188,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46944
47188
  */ function onOutsideClick(e) {
46945
47189
  var _this = this;
46946
47190
  var node = e.target;
46947
- if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.up(node, function(elm) {
47191
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.up(node, function(elm) {
46948
47192
  return elm === _this.j.editor;
46949
47193
  })) {
46950
47194
  return;
46951
47195
  }
46952
- var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__.Popup);
47196
+ var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup);
46953
47197
  if (!box) {
46954
47198
  this.j.e.fire('outsideClick', e);
46955
47199
  }
@@ -46961,7 +47205,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46961
47205
  var s = this.j.s;
46962
47206
  if (!s.isCollapsed()) {
46963
47207
  var current = s.current();
46964
- if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(this.j.editor, current)) {
47208
+ if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isOrContains(this.j.editor, current)) {
46965
47209
  this.onCopyNormalizeSelectionBound();
46966
47210
  }
46967
47211
  }
@@ -46986,14 +47230,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46986
47230
  */ function onClickRightOfNestedListItem(e) {
46987
47231
  var s = this.j.s;
46988
47232
  var range = s.range;
46989
- if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(range.startContainer)) {
47233
+ if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(range.startContainer)) {
46990
47234
  return;
46991
47235
  }
46992
47236
  var text = range.startContainer;
46993
47237
  var li = text.parentNode;
46994
47238
  // The text must be the direct content of a list item that has a nested
46995
47239
  // list (the last level has no nested list and behaves correctly).
46996
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
47240
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
46997
47241
  return;
46998
47242
  }
46999
47243
  var measure = this.j.ed.createRange();
@@ -47005,6 +47249,39 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
47005
47249
  }
47006
47250
  }
47007
47251
  },
47252
+ {
47253
+ key: "onClickKeepPendingFormat",
47254
+ value: /**
47255
+ * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
47256
+ * a collapsed cursor leaves empty marker elements with the caret inside; a
47257
+ * click puts the caret right before them (outside), so they get cleaned up
47258
+ * and the formatting is lost. Move the caret back into the innermost marker
47259
+ * so the next typed character keeps every pending format (#1291).
47260
+ */ function onClickKeepPendingFormat() {
47261
+ var _ref;
47262
+ var _text_nodeValue;
47263
+ var s = this.j.s;
47264
+ var range = s.range;
47265
+ if (!range.collapsed || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(range.startContainer)) {
47266
+ return;
47267
+ }
47268
+ var text = range.startContainer;
47269
+ // Caret must sit at the very end of the text, right before the markers.
47270
+ if (range.startOffset !== ((_ref = (_text_nodeValue = text.nodeValue) === null || _text_nodeValue === void 0 ? void 0 : _text_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0)) {
47271
+ return;
47272
+ }
47273
+ var marker = text.nextSibling;
47274
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isElement(marker) || !marker.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.IS_INLINE) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isEmpty(marker)) {
47275
+ return;
47276
+ }
47277
+ var inner = marker;
47278
+ // Descend into the innermost empty formatting marker.
47279
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isElement(inner.firstElementChild) && inner.firstElementChild.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.IS_INLINE)){
47280
+ inner = inner.firstElementChild;
47281
+ }
47282
+ s.setCursorIn(inner);
47283
+ }
47284
+ },
47008
47285
  {
47009
47286
  key: "onTripleClickNormalizeSelection",
47010
47287
  value: /**
@@ -47015,8 +47292,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
47015
47292
  }
47016
47293
  var s = this.j.s;
47017
47294
  var _s_range = s.range, startContainer = _s_range.startContainer, startOffset = _s_range.startOffset;
47018
- if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(startContainer)) {
47019
- s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock, this.j.editor) || startContainer, true);
47295
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(startContainer)) {
47296
+ s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isBlock, this.j.editor) || startContainer, true);
47020
47297
  }
47021
47298
  }
47022
47299
  },
@@ -47027,7 +47304,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
47027
47304
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
47028
47305
  return;
47029
47306
  }
47030
- if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(editor, e.target))) {
47307
+ if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isOrContains(editor, e.target))) {
47031
47308
  return;
47032
47309
  }
47033
47310
  this.jodit.s.expandSelection();
@@ -47035,40 +47312,45 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
47035
47312
  }
47036
47313
  ]);
47037
47314
  return select;
47038
- }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__.Plugin));
47315
+ }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__.Plugin));
47039
47316
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47040
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
47317
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
47041
47318
  ], select.prototype, "onStartSelection", null);
47042
47319
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47043
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)('ow:click')
47320
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)('ow:click')
47044
47321
  ], select.prototype, "onOutsideClick", null);
47045
47322
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47046
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)([
47323
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47047
47324
  ':beforeCommandCut'
47048
47325
  ])
47049
47326
  ], select.prototype, "beforeCommandCut", null);
47050
47327
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47051
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)([
47328
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47052
47329
  ':beforeCommandSelectall'
47053
47330
  ])
47054
47331
  ], select.prototype, "beforeCommandSelectAll", null);
47055
47332
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47056
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)([
47333
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47057
47334
  ':click'
47058
47335
  ])
47059
47336
  ], select.prototype, "onClickRightOfNestedListItem", null);
47060
47337
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47061
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)([
47338
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47339
+ ':click'
47340
+ ])
47341
+ ], select.prototype, "onClickKeepPendingFormat", null);
47342
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47343
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47062
47344
  ':click'
47063
47345
  ])
47064
47346
  ], select.prototype, "onTripleClickNormalizeSelection", null);
47065
47347
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
47066
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.watch)([
47348
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
47067
47349
  ':copy',
47068
47350
  ':cut'
47069
47351
  ])
47070
47352
  ], select.prototype, "onCopyNormalizeSelectionBound", null);
47071
- jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('select', select);
47353
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_10__.pluginSystem.add('select', select);
47072
47354
 
47073
47355
 
47074
47356
  /***/ }),