jodit 4.19.4 → 4.19.5

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 (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +40 -3
  5. package/es2015/jodit.min.js +3 -3
  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 +3 -3
  13. package/es2018/jodit.min.js +3 -3
  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 +3 -3
  18. package/es2021/jodit.js +40 -3
  19. package/es2021/jodit.min.js +3 -3
  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 +3 -3
  28. package/es2021.en/jodit.js +40 -3
  29. package/es2021.en/jodit.min.js +3 -3
  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 +41 -3
  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/file/file.js +39 -3
  52. package/package.json +1 -1
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.19.4
4
+ * Version: v4.19.5
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2154,7 +2154,7 @@ __webpack_require__.r(__webpack_exports__);
2154
2154
  * @packageDocumentation
2155
2155
  * @module constants
2156
2156
  */
2157
- var APP_VERSION = "4.19.4";
2157
+ var APP_VERSION = "4.19.5";
2158
2158
  // prettier-ignore
2159
2159
  var ES = "es5";
2160
2160
  var IS_ES_MODERN = false;
@@ -40474,12 +40474,37 @@ function brBefore(start) {
40474
40474
 
40475
40475
 
40476
40476
 
40477
+ /**
40478
+ * Selected text becomes the link's text, as the Link button does, instead
40479
+ * of being replaced by the file's name. Returns false with nothing selected
40480
+ */ function wrapSelectionInLink(editor, href) {
40481
+ var title = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : '';
40482
+ if (editor.s.isCollapsed()) {
40483
+ return false;
40484
+ }
40485
+ var links = editor.s.wrapInTag('a');
40486
+ if (!links.length) {
40487
+ return false;
40488
+ }
40489
+ links.forEach(function(link) {
40490
+ ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', href);
40491
+ if (title) {
40492
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'title', title);
40493
+ }
40494
+ });
40495
+ editor.s.setCursorAfter(links[links.length - 1]);
40496
+ return true;
40497
+ }
40477
40498
  function insertLinks(data) {
40478
40499
  var _this = this;
40479
40500
  var _data_files;
40480
40501
  (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach(function(file) {
40502
+ var href = data.baseurl + file;
40503
+ if (wrapSelectionInLink(_this, href)) {
40504
+ return;
40505
+ }
40481
40506
  var link = _this.createInside.element('a', {
40482
- href: data.baseurl + file
40507
+ href: href
40483
40508
  });
40484
40509
  link.textContent = _this.o.uploader.getDisplayName.call(_this.uploader, data.baseurl, file);
40485
40510
  _this.s.insertNode(link);
@@ -40490,8 +40515,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
40490
40515
  };
40491
40516
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
40492
40517
  popup: function popup(editor, current, close) {
40518
+ // The popup's first field takes the focus, so the selection the
40519
+ // popup was opened for is kept and put back before the link goes in
40520
+ var selected = editor.s.isCollapsed() ? null : editor.s.range;
40521
+ var restoreSelection = function restoreSelection() {
40522
+ if (selected) {
40523
+ editor.s.selectRange(selected);
40524
+ }
40525
+ };
40493
40526
  var insert = function insert(url) {
40494
40527
  var title = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
40528
+ restoreSelection();
40529
+ if (wrapSelectionInLink(editor, url, title)) {
40530
+ return;
40531
+ }
40495
40532
  editor.s.insertNode(editor.createInside.fromHTML('<a href="'.concat(url, '" title="').concat(title, '">').concat(title || url, "</a>")));
40496
40533
  };
40497
40534
  var sourceAnchor = null;
@@ -40508,6 +40545,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
40508
40545
  upload: function upload(data) {
40509
40546
  var _ref;
40510
40547
  var _editor_o_file;
40548
+ restoreSelection();
40511
40549
  ((_ref = (_editor_o_file = editor.o.file) === null || _editor_o_file === void 0 ? void 0 : _editor_o_file.defaultHandlerSuccess) !== null && _ref !== void 0 ? _ref : insertLinks).call(editor, data);
40512
40550
  },
40513
40551
  url: function url(url, text) {
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.19.4
4
+ * Version: v4.19.5
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.19.4
11
+ * Version: v4.19.5
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */