jodit 4.15.16 → 4.15.17

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 (55) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +61 -16
  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 +4 -4
  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 +60 -16
  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 +60 -16
  29. package/es2021.en/jodit.min.js +5 -5
  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 +62 -16
  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/plugins/focus/focus.js +17 -1
  52. package/esm/plugins/image-processor/image-processor.js +20 -1
  53. package/esm/plugins/image-properties/writers/margin.js +5 -3
  54. package/esm/plugins/inline-popup/config/items/img.js +7 -0
  55. package/package.json +1 -1
package/es2021/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.15.16
4
+ * Version: v4.15.17
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1780,7 +1780,7 @@ __webpack_require__.r(__webpack_exports__);
1780
1780
  * ```
1781
1781
  * @packageDocumentation
1782
1782
  * @module constants
1783
- */ const APP_VERSION = "4.15.16";
1783
+ */ const APP_VERSION = "4.15.17";
1784
1784
  // prettier-ignore
1785
1785
  const ES = "es2021";
1786
1786
  const IS_ES_MODERN = true;
@@ -31983,14 +31983,28 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('file', file);
31983
31983
  */ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.saveSelectionOnBlur = true;
31984
31984
  function focus(editor) {
31985
31985
  if (editor.o.saveSelectionOnBlur) {
31986
+ // A click that brings focus back places the caret itself, and Chrome
31987
+ // has already placed it when focus fires, so restoring would move it
31988
+ // back to the old selection. The saved markers are dropped instead.
31989
+ let focusByPointer = false;
31986
31990
  editor.e.on('blur', ()=>{
31991
+ // A press that never brought the focus back must not decide
31992
+ // what the next focus does
31993
+ focusByPointer = false;
31987
31994
  if (editor.isEditorMode()) {
31988
31995
  editor.s.save(true);
31989
31996
  }
31997
+ }).on('mousedown touchstart', ()=>{
31998
+ focusByPointer = !editor.editorIsActive;
31990
31999
  }).on('focus', ()=>{
31991
32000
  if (editor.isEditorMode()) {
31992
- editor.s.restore();
32001
+ if (focusByPointer) {
32002
+ editor.s.removeMarkers();
32003
+ } else {
32004
+ editor.s.restore();
32005
+ }
31993
32006
  }
32007
+ focusByPointer = false;
31994
32008
  });
31995
32009
  }
31996
32010
  const focus = ()=>{
@@ -33016,11 +33030,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33016
33030
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
33017
33031
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
33018
33032
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
33019
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
33020
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
33021
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
33022
- /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23112);
33023
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(51034);
33033
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
33034
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
33035
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
33036
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
33037
+ /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23112);
33038
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51034);
33024
33039
  /*!
33025
33040
  * Jodit Editor (https://xdsoft.net/jodit/)
33026
33041
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33037,11 +33052,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33037
33052
 
33038
33053
 
33039
33054
 
33055
+
33040
33056
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
33041
33057
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33042
33058
  /**
33043
33059
  * Change editor's size after load all images
33044
- */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
33060
+ */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
33045
33061
  afterInit(jodit) {}
33046
33062
  beforeDestruct(jodit) {
33047
33063
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.cached)(jodit, 'buffer');
@@ -33079,9 +33095,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33079
33095
  if (!editor.editor) {
33080
33096
  return;
33081
33097
  }
33082
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.$$)('img', editor.editor).forEach((elm)=>{
33083
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
33084
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
33098
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.$$)('img', editor.editor).forEach((elm)=>{
33099
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
33100
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
33085
33101
  if (!elm.complete) {
33086
33102
  editor.e.on(elm, 'load', function ElementOnLoad() {
33087
33103
  !editor.isInDestruct && editor.e?.fire('resize');
@@ -33092,6 +33108,7 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33092
33108
  replaceDataURIToBlobUUID(editor, elm);
33093
33109
  }
33094
33110
  editor.e.on(elm, 'mousedown touchstart', ()=>{
33111
+ removeCaretText(elm);
33095
33112
  editor.s.select(elm);
33096
33113
  });
33097
33114
  }
@@ -33112,6 +33129,23 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33112
33129
  ]),
33113
33130
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.debounce)()
33114
33131
  ], imageProcessor.prototype, "afterChange", null);
33132
+ /**
33133
+ * Remove the invisible-space text beside an image, which only held a caret.
33134
+ * Selecting the image replaces the caret, and with the text still after a
33135
+ * block image, Safari highlights the rest of the image's line. See #1512
33136
+ */ function removeCaretText(elm) {
33137
+ for (const side of [
33138
+ 'previousSibling',
33139
+ 'nextSibling'
33140
+ ]){
33141
+ let node = elm[side];
33142
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(node) && !node.nodeValue?.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE_REG_EXP)(), '')){
33143
+ const next = node[side];
33144
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
33145
+ node = next;
33146
+ }
33147
+ }
33148
+ }
33115
33149
  function replaceDataURIToBlobUUID(editor, elm) {
33116
33150
  if (!editor.o.imageProcessor.replaceDataURIToBlobIdInView) {
33117
33151
  return;
@@ -33122,7 +33156,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
33122
33156
  const dataUri = elm.src;
33123
33157
  let blob;
33124
33158
  try {
33125
- blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__.dataURItoBlob)(dataUri);
33159
+ blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__.dataURItoBlob)(dataUri);
33126
33160
  } catch {
33127
33161
  // A data URI the browser accepts but we cannot decode is not worth
33128
33162
  // breaking the editor over — keep the image as it is
@@ -33135,7 +33169,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
33135
33169
  list[elm.src] = dataUri;
33136
33170
  editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
33137
33171
  }
33138
- jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('imageProcessor', imageProcessor);
33172
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProcessor', imageProcessor);
33139
33173
 
33140
33174
 
33141
33175
  /***/ }),
@@ -34609,10 +34643,12 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34609
34643
  marginBottom,
34610
34644
  marginLeft
34611
34645
  ];
34646
+ // Compared with the inline value, which is what `readMargins` showed, so a
34647
+ // margin from a stylesheet is not overwritten when the field is unchanged
34612
34648
  const applyMargin = (key, value)=>{
34613
- const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key);
34649
+ const oldValue = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, key) || 0);
34614
34650
  const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)(value);
34615
- if (oldValue.toString() !== v.toString()) {
34651
+ if (oldValue !== v) {
34616
34652
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key, v);
34617
34653
  }
34618
34654
  };
@@ -35437,6 +35473,14 @@ const align = {
35437
35473
  'Normal'
35438
35474
  ],
35439
35475
  tooltip: 'Vertical align',
35476
+ // `vertical-align` only moves an image in the line, not a floated or block one
35477
+ isDisabled: (editor, button)=>{
35478
+ const image = button.target;
35479
+ return Boolean(image && ([
35480
+ 'left',
35481
+ 'right'
35482
+ ].includes((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float')) || (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'display') === 'block'));
35483
+ },
35440
35484
  exec: (editor, image, { control })=>{
35441
35485
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(image, 'img')) {
35442
35486
  return;