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/es2015/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
  */
@@ -1786,7 +1786,7 @@ __webpack_require__.r(__webpack_exports__);
1786
1786
  * ```
1787
1787
  * @packageDocumentation
1788
1788
  * @module constants
1789
- */ const APP_VERSION = "4.15.16";
1789
+ */ const APP_VERSION = "4.15.17";
1790
1790
  // prettier-ignore
1791
1791
  const ES = "es2015";
1792
1792
  const IS_ES_MODERN = true;
@@ -32204,14 +32204,28 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('file', file);
32204
32204
  */ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.saveSelectionOnBlur = true;
32205
32205
  function focus(editor) {
32206
32206
  if (editor.o.saveSelectionOnBlur) {
32207
+ // A click that brings focus back places the caret itself, and Chrome
32208
+ // has already placed it when focus fires, so restoring would move it
32209
+ // back to the old selection. The saved markers are dropped instead.
32210
+ let focusByPointer = false;
32207
32211
  editor.e.on('blur', ()=>{
32212
+ // A press that never brought the focus back must not decide
32213
+ // what the next focus does
32214
+ focusByPointer = false;
32208
32215
  if (editor.isEditorMode()) {
32209
32216
  editor.s.save(true);
32210
32217
  }
32218
+ }).on('mousedown touchstart', ()=>{
32219
+ focusByPointer = !editor.editorIsActive;
32211
32220
  }).on('focus', ()=>{
32212
32221
  if (editor.isEditorMode()) {
32213
- editor.s.restore();
32222
+ if (focusByPointer) {
32223
+ editor.s.removeMarkers();
32224
+ } else {
32225
+ editor.s.restore();
32226
+ }
32214
32227
  }
32228
+ focusByPointer = false;
32215
32229
  });
32216
32230
  }
32217
32231
  const focus = ()=>{
@@ -33251,11 +33265,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33251
33265
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
33252
33266
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
33253
33267
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
33254
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
33255
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
33256
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
33257
- /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23112);
33258
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51034);
33268
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
33269
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
33270
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
33271
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
33272
+ /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23112);
33273
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(51034);
33259
33274
  /*!
33260
33275
  * Jodit Editor (https://xdsoft.net/jodit/)
33261
33276
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33273,11 +33288,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33273
33288
 
33274
33289
 
33275
33290
 
33291
+
33276
33292
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
33277
33293
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33278
33294
  /**
33279
33295
  * Change editor's size after load all images
33280
- */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
33296
+ */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
33281
33297
  afterInit(jodit) {}
33282
33298
  beforeDestruct(jodit) {
33283
33299
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.cached)(jodit, 'buffer');
@@ -33316,9 +33332,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33316
33332
  if (!editor.editor) {
33317
33333
  return;
33318
33334
  }
33319
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.$$)('img', editor.editor).forEach((elm)=>{
33320
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
33321
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
33335
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('img', editor.editor).forEach((elm)=>{
33336
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
33337
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
33322
33338
  if (!elm.complete) {
33323
33339
  editor.e.on(elm, 'load', function ElementOnLoad() {
33324
33340
  var _editor_e;
@@ -33330,6 +33346,7 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33330
33346
  replaceDataURIToBlobUUID(editor, elm);
33331
33347
  }
33332
33348
  editor.e.on(elm, 'mousedown touchstart', ()=>{
33349
+ removeCaretText(elm);
33333
33350
  editor.s.select(elm);
33334
33351
  });
33335
33352
  }
@@ -33351,6 +33368,24 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33351
33368
  ]),
33352
33369
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.debounce)()
33353
33370
  ], imageProcessor.prototype, "afterChange", null);
33371
+ /**
33372
+ * Remove the invisible-space text beside an image, which only held a caret.
33373
+ * Selecting the image replaces the caret, and with the text still after a
33374
+ * block image, Safari highlights the rest of the image's line. See #1512
33375
+ */ function removeCaretText(elm) {
33376
+ for (const side of [
33377
+ 'previousSibling',
33378
+ 'nextSibling'
33379
+ ]){
33380
+ var _node_nodeValue;
33381
+ let node = elm[side];
33382
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && !((_node_nodeValue = node.nodeValue) === null || _node_nodeValue === void 0 ? void 0 : _node_nodeValue.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE_REG_EXP)(), ''))){
33383
+ const next = node[side];
33384
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(node);
33385
+ node = next;
33386
+ }
33387
+ }
33388
+ }
33354
33389
  function replaceDataURIToBlobUUID(editor, elm) {
33355
33390
  if (!editor.o.imageProcessor.replaceDataURIToBlobIdInView) {
33356
33391
  return;
@@ -33361,7 +33396,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
33361
33396
  const dataUri = elm.src;
33362
33397
  let blob;
33363
33398
  try {
33364
- blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__.dataURItoBlob)(dataUri);
33399
+ blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_8__.dataURItoBlob)(dataUri);
33365
33400
  } catch (unused) {
33366
33401
  // A data URI the browser accepts but we cannot decode is not worth
33367
33402
  // breaking the editor over — keep the image as it is
@@ -33374,7 +33409,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
33374
33409
  list[elm.src] = dataUri;
33375
33410
  editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
33376
33411
  }
33377
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProcessor', imageProcessor);
33412
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProcessor', imageProcessor);
33378
33413
 
33379
33414
 
33380
33415
  /***/ }),
@@ -34868,10 +34903,12 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34868
34903
  marginBottom,
34869
34904
  marginLeft
34870
34905
  ];
34906
+ // Compared with the inline value, which is what `readMargins` showed, so a
34907
+ // margin from a stylesheet is not overwritten when the field is unchanged
34871
34908
  const applyMargin = (key, value)=>{
34872
- const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key);
34909
+ const oldValue = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, key) || 0);
34873
34910
  const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)(value);
34874
- if (oldValue.toString() !== v.toString()) {
34911
+ if (oldValue !== v) {
34875
34912
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key, v);
34876
34913
  }
34877
34914
  };
@@ -35699,6 +35736,14 @@ const align = {
35699
35736
  'Normal'
35700
35737
  ],
35701
35738
  tooltip: 'Vertical align',
35739
+ // `vertical-align` only moves an image in the line, not a floated or block one
35740
+ isDisabled: (editor, button)=>{
35741
+ const image = button.target;
35742
+ return Boolean(image && ([
35743
+ 'left',
35744
+ 'right'
35745
+ ].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'));
35746
+ },
35702
35747
  exec: (editor, image, { control })=>{
35703
35748
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(image, 'img')) {
35704
35749
  return;