jodit 3.13.2 → 3.13.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 (48) hide show
  1. package/.idea/workspace.xml +95 -91
  2. package/CHANGELOG.MD +27 -5
  3. package/build/jodit.css +2 -2
  4. package/build/jodit.es2018.css +1 -1
  5. package/build/jodit.es2018.en.css +1 -1
  6. package/build/jodit.es2018.en.js +147 -53
  7. package/build/jodit.es2018.en.min.js +1 -1
  8. package/build/jodit.es2018.js +147 -53
  9. package/build/jodit.es2018.min.js +1 -1
  10. package/build/jodit.js +346 -211
  11. package/build/jodit.min.css +1 -1
  12. package/build/jodit.min.js +1 -1
  13. package/package.json +16 -16
  14. package/src/core/constants.ts +1 -1
  15. package/src/core/helpers/utils/css.ts +6 -1
  16. package/src/core/selection/style/api/get-suit-parent.ts +18 -4
  17. package/src/core/selection/style/commit-style.ts +10 -0
  18. package/src/core/ui/form/block/block.ts +3 -0
  19. package/src/jodit.ts +25 -6
  20. package/src/modules/file-browser/data-provider.ts +1 -1
  21. package/src/modules/file-browser/file-browser.ts +1 -0
  22. package/src/modules/image-editor/image-editor.ts +14 -26
  23. package/src/modules/status-bar/status-bar.ts +21 -13
  24. package/src/modules/toolbar/button/button.ts +1 -1
  25. package/src/plugins/index.ts +1 -0
  26. package/src/plugins/inline-popup/config/config.ts +1 -0
  27. package/src/plugins/keyboard/tab/README.md +1 -0
  28. package/src/plugins/keyboard/tab/cases/index.ts +6 -0
  29. package/src/plugins/keyboard/tab/cases/on-tab-inside-li.ts +51 -0
  30. package/src/plugins/keyboard/tab/config.ts +26 -0
  31. package/src/plugins/keyboard/tab/tab.ts +32 -0
  32. package/src/plugins/resizer/resizer.ts +1 -0
  33. package/src/types/types.d.ts +1 -1
  34. package/types/core/create/create.d.ts +2 -2
  35. package/types/core/decorators/hook/hook.d.ts +1 -1
  36. package/types/core/helpers/utils/css.d.ts +1 -0
  37. package/types/core/helpers/utils/selector.d.ts +1 -1
  38. package/types/core/selection/style/commit-style.d.ts +4 -0
  39. package/types/core/ui/form/block/block.d.ts +2 -0
  40. package/types/core/ui/group/group.d.ts +2 -2
  41. package/types/jodit.d.ts +6 -0
  42. package/types/modules/file-browser/listeners/native-listeners.d.ts +1 -1
  43. package/types/plugins/index.d.ts +1 -0
  44. package/types/plugins/keyboard/tab/cases/index.d.ts +6 -0
  45. package/types/plugins/keyboard/tab/cases/on-tab-inside-li.d.ts +14 -0
  46. package/types/plugins/keyboard/tab/config.d.ts +16 -0
  47. package/types/plugins/keyboard/tab/tab.d.ts +16 -0
  48. package/types/types/types.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)
4
- * Version: v3.13.2
4
+ * Version: v3.13.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -412,7 +412,7 @@ const INVISIBLE_SPACE_REG_EXP_START = () => /^[\uFEFF]+/g;
412
412
  const SPACE_REG_EXP = () => /[\s\n\t\r\uFEFF\u200b]+/g;
413
413
  const SPACE_REG_EXP_START = () => /^[\s\n\t\r\uFEFF\u200b]+/g;
414
414
  const SPACE_REG_EXP_END = () => /[\s\n\t\r\uFEFF\u200b]+$/g;
415
- const IS_BLOCK = /^(ARTICLE|SCRIPT|STYLE|OBJECT|FOOTER|HEADER|NAV|SECTION|IFRAME|JODIT|JODIT-MEDIA|PRE|DIV|P|LI|UL|OL|H[1-6]|BLOCKQUOTE|TR|TD|TH|TBODY|THEAD|TABLE|BODY|HTML|FIGCAPTION|FIGURE|DT|DD|DL|DFN)$/i;
415
+ const IS_BLOCK = /^(ARTICLE|SCRIPT|STYLE|OBJECT|FOOTER|HEADER|NAV|SECTION|IFRAME|JODIT|JODIT-MEDIA|PRE|DIV|P|LI|UL|OL|H[1-6]|BLOCKQUOTE|TR|TD|TH|TBODY|THEAD|TABLE|BODY|HTML|FIGCAPTION|FIGURE|DT|DD|DL|DFN|FORM)$/i;
416
416
  const IS_INLINE = /^(STRONG|SPAN|I|EM|B|SUP|SUB|A|U)$/i;
417
417
  const INSEPARABLE_TAGS = [
418
418
  'img',
@@ -4768,11 +4768,18 @@ function getSuitChild(style, font) {
4768
4768
 
4769
4769
  function getSuitParent(style, node, root) {
4770
4770
  const { parentNode } = node;
4771
- if (dom/* Dom.isHTMLElement */.i.isHTMLElement(parentNode) &&
4772
- !dom/* Dom.next */.i.next(node, isNormalNode, parentNode) &&
4773
- !dom/* Dom.prev */.i.prev(node, isNormalNode, parentNode) &&
4774
- isSuitElement(style, parentNode, false) &&
4775
- parentNode !== root &&
4771
+ if (parentNode === root ||
4772
+ !dom/* Dom.isHTMLElement */.i.isHTMLElement(parentNode) ||
4773
+ dom/* Dom.next */.i.next(node, isNormalNode, parentNode) ||
4774
+ dom/* Dom.prev */.i.prev(node, isNormalNode, parentNode)) {
4775
+ return null;
4776
+ }
4777
+ if (style.isElementCommit &&
4778
+ style.elementIsBlock &&
4779
+ !dom/* Dom.isBlock */.i.isBlock(parentNode)) {
4780
+ return getSuitParent(style, parentNode, root);
4781
+ }
4782
+ if (isSuitElement(style, parentNode, false) &&
4776
4783
  (!dom/* Dom.isBlock */.i.isBlock(parentNode) || style.elementIsBlock)) {
4777
4784
  return parentNode;
4778
4785
  }
@@ -5164,6 +5171,10 @@ class CommitStyle {
5164
5171
  get elementIsBlock() {
5165
5172
  return Boolean(this.options.element && constants.IS_BLOCK.test(this.options.element));
5166
5173
  }
5174
+ get isElementCommit() {
5175
+ return Boolean(this.options.element &&
5176
+ this.options.element !== this.options.defaultTag);
5177
+ }
5167
5178
  get defaultTag() {
5168
5179
  if (this.options.defaultTag) {
5169
5180
  return this.options.defaultTag;
@@ -9149,6 +9160,8 @@ let UIBlock = class UIBlock extends group/* UIGroup */.qe {
9149
9160
  this.setMod('align', this.options.align || 'left');
9150
9161
  this.setMod('width', this.options.width || '');
9151
9162
  this.options.mod && this.setMod(this.options.mod, true);
9163
+ this.options.className &&
9164
+ this.container.classList.add(this.options.className);
9152
9165
  (0,utils/* attr */.Lj)(this.container, 'data-ref', options.ref);
9153
9166
  (0,utils/* attr */.Lj)(this.container, 'ref', options.ref);
9154
9167
  }
@@ -10493,6 +10506,7 @@ __webpack_require__.d(plugins_namespaceObject, {
10493
10506
  "stat": function() { return stat; },
10494
10507
  "sticky": function() { return sticky; },
10495
10508
  "symbols": function() { return symbols; },
10509
+ "tab": function() { return tab; },
10496
10510
  "table": function() { return table; },
10497
10511
  "tableKeyboardNavigation": function() { return tableKeyboardNavigation; },
10498
10512
  "tooltip": function() { return tooltip; },
@@ -11228,7 +11242,7 @@ class View extends component/* Component */.wA {
11228
11242
  this.isView = true;
11229
11243
  this.mods = {};
11230
11244
  this.components = new Set();
11231
- this.version = "3.13.2";
11245
+ this.version = "3.13.3";
11232
11246
  this.async = new Async();
11233
11247
  this.buffer = Storage.makeStorage();
11234
11248
  this.storage = Storage.makeStorage(true, this.componentName);
@@ -11326,10 +11340,10 @@ class View extends component/* Component */.wA {
11326
11340
  return this.__isFullSize;
11327
11341
  }
11328
11342
  getVersion() {
11329
- return "3.13.2";
11343
+ return "3.13.3";
11330
11344
  }
11331
11345
  static getVersion() {
11332
- return "3.13.2";
11346
+ return "3.13.3";
11333
11347
  }
11334
11348
  initOptions(options) {
11335
11349
  this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions));
@@ -13254,7 +13268,7 @@ const possibleRules = (/* unused pure expression or super */ null && ([
13254
13268
  'allowImageResize',
13255
13269
  'allowImageCrop'
13256
13270
  ]));
13257
- class DataProvider {
13271
+ let DataProvider = class DataProvider {
13258
13272
  constructor(parent, options) {
13259
13273
  this.parent = parent;
13260
13274
  this.options = options;
@@ -13519,10 +13533,11 @@ class DataProvider {
13519
13533
  this.ajaxInstances.forEach(a => a.destruct());
13520
13534
  this.ajaxInstances.clear();
13521
13535
  }
13522
- }
13523
- (0,tslib_es6/* __decorate */.gn)([
13536
+ };
13537
+ DataProvider = (0,tslib_es6/* __decorate */.gn)([
13524
13538
  decorators.autobind
13525
- ], DataProvider.prototype, "isSuccess", null);
13539
+ ], DataProvider);
13540
+ /* harmony default export */ var data_provider = (DataProvider);
13526
13541
 
13527
13542
  ;// CONCATENATED MODULE: ./src/modules/file-browser/factories.ts
13528
13543
  /*!
@@ -13533,7 +13548,7 @@ class DataProvider {
13533
13548
 
13534
13549
 
13535
13550
  function makeDataProvider(parent, options) {
13536
- return new DataProvider(parent, options);
13551
+ return new data_provider(parent, options);
13537
13552
  }
13538
13553
  function makeContextMenu(parent) {
13539
13554
  return new ContextMenu(parent);
@@ -14134,7 +14149,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends component/* ViewComp
14134
14149
  }
14135
14150
  (0,helpers.$$)(`.${image_editor_jie}__slider,.${image_editor_jie}__area`, self.editor).forEach(elm => elm.classList.remove(`${image_editor_jie}_active`));
14136
14151
  slide.classList.add(`${image_editor_jie}_active`);
14137
- self.activeTab = (0,helpers.attr)(slide, '-area') || TABS.resize;
14152
+ this.activeTab = (0,helpers.attr)(slide, '-area') || TABS.resize;
14138
14153
  const tab = self.editor.querySelector(`.${image_editor_jie}__area.${image_editor_jie}__area_` + self.activeTab);
14139
14154
  if (tab) {
14140
14155
  tab.classList.add(`${image_editor_jie}_active`);
@@ -14375,30 +14390,23 @@ ImageEditor = ImageEditor_1 = (0,tslib_es6/* __decorate */.gn)([
14375
14390
  ], ImageEditor);
14376
14391
 
14377
14392
  function openImageEditor(href, name, path, source, onSuccess, onFailed) {
14378
- return this.getInstance('ImageEditor', this.o).open(href, (newname, box, success, failed) => {
14379
- let promise;
14380
- if (box.action === 'resize') {
14381
- promise = this.dataProvider.resize(path, source, name, newname, box.box);
14393
+ return this.getInstance('ImageEditor', this.o).open(href, (newname, box, success, failed) => (0,helpers.call)(box.action === 'resize'
14394
+ ? this.dataProvider.resize
14395
+ : this.dataProvider.crop, path, source, name, newname, box.box)
14396
+ .then(ok => {
14397
+ if (ok) {
14398
+ success();
14399
+ if (onSuccess) {
14400
+ onSuccess();
14401
+ }
14382
14402
  }
14383
- else {
14384
- promise = this.dataProvider.crop(path, source, name, newname, box.box);
14403
+ })
14404
+ .catch(error => {
14405
+ failed(error);
14406
+ if (onFailed) {
14407
+ onFailed(error);
14385
14408
  }
14386
- promise
14387
- .then(ok => {
14388
- if (ok) {
14389
- success();
14390
- if (onSuccess) {
14391
- onSuccess();
14392
- }
14393
- }
14394
- })
14395
- .catch(error => {
14396
- failed(error);
14397
- if (onFailed) {
14398
- onFailed(error);
14399
- }
14400
- });
14401
- });
14409
+ }));
14402
14410
  }
14403
14411
 
14404
14412
  ;// CONCATENATED MODULE: ./src/modules/file-browser/fetch/delete-file.ts
@@ -15473,7 +15481,9 @@ var selection = __webpack_require__(16);
15473
15481
 
15474
15482
 
15475
15483
 
15476
- class StatusBar extends component/* ViewComponent */.Hr {
15484
+
15485
+
15486
+ let StatusBar = class StatusBar extends component/* ViewComponent */.Hr {
15477
15487
  constructor(jodit, target) {
15478
15488
  super(jodit);
15479
15489
  this.target = target;
@@ -15506,23 +15516,20 @@ class StatusBar extends component/* ViewComponent */.Hr {
15506
15516
  return (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
15507
15517
  }
15508
15518
  findEmpty(inTheRight = false) {
15509
- var _a;
15510
- const items = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.jodit-status-bar__item' +
15511
- (inTheRight ? '.jodit-status-bar__item-right' : ''));
15512
- if (items) {
15513
- for (let i = 0; i < items.length; i += 1) {
15514
- if (!items[i].innerHTML.trim().length) {
15515
- return items[i];
15516
- }
15519
+ const items = traits/* Elms.getElms.call */.F.getElms.call(this, inTheRight ? 'item-right' : 'item');
15520
+ for (let i = 0; i < items.length; i += 1) {
15521
+ if (!items[i].innerHTML.trim().length) {
15522
+ return items[i];
15517
15523
  }
15518
15524
  }
15525
+ return;
15519
15526
  }
15520
15527
  append(child, inTheRight = false) {
15521
15528
  var _a;
15522
15529
  const wrapper = this.findEmpty(inTheRight) ||
15523
- this.j.c.div('jodit-status-bar__item');
15530
+ this.j.c.div(this.getFullElName('item'));
15524
15531
  if (inTheRight) {
15525
- wrapper.classList.add('jodit-status-bar__item-right');
15532
+ wrapper.classList.add(this.getFullElName('item-right'));
15526
15533
  }
15527
15534
  wrapper.appendChild(child);
15528
15535
  (_a = this.container) === null || _a === void 0 ? void 0 : _a.appendChild(wrapper);
@@ -15536,7 +15543,11 @@ class StatusBar extends component/* ViewComponent */.Hr {
15536
15543
  dom/* Dom.safeRemove */.i.safeRemove(this.container);
15537
15544
  super.destruct();
15538
15545
  }
15539
- }
15546
+ };
15547
+ StatusBar = (0,tslib_es6/* __decorate */.gn)([
15548
+ decorators.component
15549
+ ], StatusBar);
15550
+
15540
15551
 
15541
15552
  ;// CONCATENATED MODULE: ./src/modules/table/table.ts
15542
15553
  /*!
@@ -16607,7 +16618,10 @@ class Jodit extends ViewWithToolbar {
16607
16618
  this.isSilentChange = false;
16608
16619
  this.elementToPlace = new Map();
16609
16620
  try {
16610
- (0,helpers.resolveElement)(element, this.o.shadowRoot || this.od);
16621
+ const elementSource = (0,helpers.resolveElement)(element, this.o.shadowRoot || this.od);
16622
+ if (Jodit.isJoditAssigned(elementSource)) {
16623
+ return elementSource.component;
16624
+ }
16611
16625
  }
16612
16626
  catch (e) {
16613
16627
  this.destruct();
@@ -16682,6 +16696,11 @@ class Jodit extends ViewWithToolbar {
16682
16696
  static make(element, options) {
16683
16697
  return new Jodit(element, options);
16684
16698
  }
16699
+ static isJoditAssigned(element) {
16700
+ return (element &&
16701
+ (0,helpers.isJoditObject)(element.component) &&
16702
+ !element.component.isInDestruct);
16703
+ }
16685
16704
  static get defaultOptions() {
16686
16705
  return config/* Config.defaultOptions */.D.defaultOptions;
16687
16706
  }
@@ -17153,7 +17172,6 @@ class Jodit extends ViewWithToolbar {
17153
17172
  contenteditable: false
17154
17173
  });
17155
17174
  container.appendChild(workplace);
17156
- const statusbar = new StatusBar(this, container);
17157
17175
  if (element.parentNode && element !== container) {
17158
17176
  element.parentNode.insertBefore(container, element);
17159
17177
  }
@@ -17173,7 +17191,7 @@ class Jodit extends ViewWithToolbar {
17173
17191
  element,
17174
17192
  container,
17175
17193
  workplace,
17176
- statusbar,
17194
+ statusbar: new StatusBar(this, container),
17177
17195
  options: this.isReady
17178
17196
  ? (0,helpers.ConfigProto)(options || {}, config/* Config.defaultOptions */.D.defaultOptions)
17179
17197
  : this.options,
@@ -21915,6 +21933,7 @@ config/* Config.prototype.popup */.D.prototype.popup = {
21915
21933
  cells: (__webpack_require__(52)/* ["default"] */ .Z),
21916
21934
  toolbar: (__webpack_require__(53)/* ["default"] */ .Z),
21917
21935
  jodit: (__webpack_require__(54)/* ["default"] */ .Z),
21936
+ iframe: (__webpack_require__(54)/* ["default"] */ .Z),
21918
21937
  'jodit-media': (__webpack_require__(54)/* ["default"] */ .Z),
21919
21938
  selection: [
21920
21939
  'bold',
@@ -23640,6 +23659,7 @@ class resizer extends Plugin {
23640
23659
  }
23641
23660
  })
23642
23661
  .on(editor.ow, 'resize.resizer', this.updateSize)
23662
+ .on('resize.resizer', this.updateSize)
23643
23663
  .on(editor.ow, 'mouseup.resizer keydown.resizer touchend.resizer', this.onClickOutside)
23644
23664
  .on([editor.ow, editor.editor], 'scroll.resizer', () => {
23645
23665
  if (this.isShown && !this.isResized) {
@@ -26719,6 +26739,79 @@ class tooltip extends Plugin {
26719
26739
  decorators.autobind
26720
26740
  ], tooltip.prototype, "close", null);
26721
26741
 
26742
+ ;// CONCATENATED MODULE: ./src/plugins/keyboard/tab/cases/on-tab-inside-li.ts
26743
+ /*!
26744
+ * Jodit Editor (https://xdsoft.net/jodit/)
26745
+ * Released under MIT see LICENSE.txt in the project root for license information.
26746
+ * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
26747
+ */
26748
+
26749
+ function onTabInsideLi(jodit) {
26750
+ if (!jodit.o.tab.tabInsideLiInsertNewList || !jodit.s.isCollapsed()) {
26751
+ return false;
26752
+ }
26753
+ const fake = jodit.createInside.fake();
26754
+ jodit.s.insertNode(fake);
26755
+ const li = dom/* Dom.closest */.i.closest(fake, 'li', jodit.editor);
26756
+ if (li &&
26757
+ jodit.s.cursorOnTheLeft(li) &&
26758
+ dom/* Dom.isTag */.i.isTag(li.previousElementSibling, 'li')) {
26759
+ const list = dom/* Dom.closest */.i.closest(li, ['ol', 'ul'], jodit.editor);
26760
+ if (list) {
26761
+ const newList = jodit.createInside.element(list.tagName);
26762
+ const previousLi = li.previousElementSibling;
26763
+ newList.appendChild(li);
26764
+ previousLi.appendChild(newList);
26765
+ jodit.s.setCursorAfter(fake);
26766
+ dom/* Dom.safeRemove */.i.safeRemove(fake);
26767
+ return true;
26768
+ }
26769
+ }
26770
+ dom/* Dom.safeRemove */.i.safeRemove(fake);
26771
+ return false;
26772
+ }
26773
+
26774
+ ;// CONCATENATED MODULE: ./src/plugins/keyboard/tab/cases/index.ts
26775
+
26776
+
26777
+ ;// CONCATENATED MODULE: ./src/plugins/keyboard/tab/config.ts
26778
+ /*!
26779
+ * Jodit Editor (https://xdsoft.net/jodit/)
26780
+ * Released under MIT see LICENSE.txt in the project root for license information.
26781
+ * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
26782
+ */
26783
+
26784
+ config/* Config.prototype.tab */.D.prototype.tab = {
26785
+ tabInsideLiInsertNewList: true
26786
+ };
26787
+
26788
+ ;// CONCATENATED MODULE: ./src/plugins/keyboard/tab/tab.ts
26789
+ /*!
26790
+ * Jodit Editor (https://xdsoft.net/jodit/)
26791
+ * Released under MIT see LICENSE.txt in the project root for license information.
26792
+ * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
26793
+ */
26794
+
26795
+
26796
+
26797
+
26798
+
26799
+
26800
+ class tab extends Plugin {
26801
+ afterInit(jodit) { }
26802
+ onTab(event) {
26803
+ if (event.key === constants.KEY_TAB) {
26804
+ if (onTabInsideLi(this.j)) {
26805
+ return false;
26806
+ }
26807
+ }
26808
+ }
26809
+ beforeDestruct(jodit) { }
26810
+ }
26811
+ (0,tslib_es6/* __decorate */.gn)([
26812
+ (0,decorators.watch)(':keydown.tab')
26813
+ ], tab.prototype, "onTab", null);
26814
+
26722
26815
  ;// CONCATENATED MODULE: ./src/plugins/print/preview.ts
26723
26816
  /*!
26724
26817
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -27078,6 +27171,7 @@ class xpath extends Plugin {
27078
27171
 
27079
27172
 
27080
27173
 
27174
+
27081
27175
 
27082
27176
 
27083
27177
  // EXTERNAL MODULE: ./src/styles/icons/about.svg