jodit-pro-react 5.5.78 → 5.5.80

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JoditEditor_default
3
- } from "./chunk-KZHDMEIW.mjs";
3
+ } from "./chunk-E2AZLYYJ.mjs";
4
4
  export {
5
5
  JoditEditor_default as default
6
6
  };
@@ -193,7 +193,7 @@ var APP_VERSION, ES, IS_ES_MODERN, IS_ES_NEXT, IS_PROD, IS_TEST, FAT_MODE, HOMEP
193
193
  var init_constants = __esm({
194
194
  "node_modules/jodit/esm/core/constants.js"() {
195
195
  "use strict";
196
- APP_VERSION = "4.13.17";
196
+ APP_VERSION = "4.13.19";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -4303,7 +4303,7 @@ function inView(elm, root, doc) {
4303
4303
  while (el && el !== root && el.parentNode) {
4304
4304
  el = el.parentNode;
4305
4305
  rect = el.getBoundingClientRect();
4306
- if (top + height > rect.bottom && top > rect.top) {
4306
+ if (top + height > rect.bottom + SUBPIXEL_TOLERANCE && top > rect.top) {
4307
4307
  return false;
4308
4308
  }
4309
4309
  if (top + height <= rect.top) {
@@ -4311,7 +4311,7 @@ function inView(elm, root, doc) {
4311
4311
  }
4312
4312
  }
4313
4313
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
4314
- return (top + height <= clientHeight || top <= 0) && top + height >= 0;
4314
+ return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
4315
4315
  }
4316
4316
  function scrollIntoViewIfNeeded(elm, root, doc) {
4317
4317
  if (Dom.isHTMLElement(elm) && !inView(elm, root, doc)) {
@@ -4324,10 +4324,12 @@ function scrollIntoViewIfNeeded(elm, root, doc) {
4324
4324
  }
4325
4325
  }
4326
4326
  }
4327
+ var SUBPIXEL_TOLERANCE;
4327
4328
  var init_scroll_into_view = __esm({
4328
4329
  "node_modules/jodit/esm/core/helpers/utils/scroll-into-view.js"() {
4329
4330
  "use strict";
4330
4331
  init_dom();
4332
+ SUBPIXEL_TOLERANCE = 1;
4331
4333
  }
4332
4334
  });
4333
4335
 
@@ -15859,6 +15861,7 @@ var instance = (j10) => j10.getInstance("Table", j10.o);
15859
15861
 
15860
15862
  // node_modules/jodit/esm/modules/toolbar/button/button.js
15861
15863
  init_statuses();
15864
+ init_constants();
15862
15865
  init_autobind();
15863
15866
  init_cache();
15864
15867
  init_component();
@@ -15963,6 +15966,7 @@ var ToolbarButton = class ToolbarButton2 extends UIButton {
15963
15966
  }
15964
15967
  onChangeTabIndex() {
15965
15968
  attr(this.button, "tabindex", this.state.tabIndex);
15969
+ attr(this.trigger, "tabindex", this.state.tabIndex);
15966
15970
  }
15967
15971
  createContainer() {
15968
15972
  const cn = this.componentName;
@@ -16110,6 +16114,13 @@ var ToolbarButton = class ToolbarButton2 extends UIButton {
16110
16114
  this.j.e.fire(camelCase(`after-${ctr.name}-open-popup`), popup.container);
16111
16115
  }
16112
16116
  }
16117
+ onTriggerKeyDown(e42) {
16118
+ if (this.state.disabled || ![KEY_ENTER, KEY_SPACE, " "].includes(e42.key)) {
16119
+ return;
16120
+ }
16121
+ e42.preventDefault();
16122
+ this.trigger.click();
16123
+ }
16113
16124
  /**
16114
16125
  * Create an open popup list
16115
16126
  */
@@ -16240,6 +16251,9 @@ __decorate32([
16240
16251
  __decorate32([
16241
16252
  watch("trigger:click")
16242
16253
  ], ToolbarButton.prototype, "onTriggerClick", null);
16254
+ __decorate32([
16255
+ watch("trigger:keydown")
16256
+ ], ToolbarButton.prototype, "onTriggerKeyDown", null);
16243
16257
  __decorate32([
16244
16258
  autobind
16245
16259
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -31911,6 +31925,7 @@ var import_tab = __toESM(require_tab());
31911
31925
  init_global2();
31912
31926
 
31913
31927
  // node_modules/jodit/esm/plugins/table/config.js
31928
+ init_constants();
31914
31929
  init_dom2();
31915
31930
  init_helpers();
31916
31931
  init_utils3();
@@ -31956,19 +31971,25 @@ Config.prototype.controls.table = {
31956
31971
  };
31957
31972
  const form2 = editor.c.fromHTML('<form class="jodit-form jodit-form__inserter"><div class="jodit-form__table-creator-box"><div class="jodit-form__container"></div><div class="jodit-form__options">' + generateExtraClasses() + '</div></div><label class="jodit-form__center"><span>1</span> &times; <span>1</span></label></form>'), rows = form2.querySelectorAll("span")[0], cols = form2.querySelectorAll("span")[1], blocksContainer = form2.querySelector(".jodit-form__container"), options2 = form2.querySelector(".jodit-form__options"), cells = [];
31958
31973
  const cnt = default_rows_count * default_cols_count;
31974
+ attr(blocksContainer, {
31975
+ role: "grid",
31976
+ ariaLabel: "Table size",
31977
+ ariaRowcount: default_rows_count,
31978
+ ariaColcount: default_cols_count
31979
+ });
31959
31980
  for (let i54 = 0; i54 < cnt; i54 += 1) {
31960
31981
  if (!cells[i54]) {
31982
+ const row = Math.floor(i54 / default_cols_count) + 1, col = i54 % default_cols_count + 1;
31961
31983
  cells.push(editor.c.element("span", {
31962
- dataIndex: i54
31984
+ dataIndex: i54,
31985
+ role: "gridcell",
31986
+ tabindex: i54 === 0 ? 0 : -1,
31987
+ ariaLabel: `${row} by ${col}`
31963
31988
  }));
31964
31989
  }
31965
31990
  }
31966
- const mouseenter = (e42, index) => {
31967
- const dv = e42.target;
31968
- if (!Dom.isTag(dv, "span")) {
31969
- return;
31970
- }
31971
- const k6 = index === void 0 || isNaN(index) ? parseInt(attr(dv, "-index") || "0", 10) : index || 0;
31991
+ const highlightCell = (cell) => {
31992
+ const k6 = parseInt(attr(cell, "-index") || "0", 10);
31972
31993
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31973
31994
  for (let i54 = 0; i54 < cells.length; i54 += 1) {
31974
31995
  if (cols_count >= i54 % default_cols_count + 1 && rows_count >= Math.ceil((i54 + 1) / default_cols_count)) {
@@ -31980,14 +32001,8 @@ Config.prototype.controls.table = {
31980
32001
  cols.textContent = cols_count.toString();
31981
32002
  rows.textContent = rows_count.toString();
31982
32003
  };
31983
- editor.e.on(blocksContainer, "mousemove", mouseenter).on(blocksContainer, "touchstart mousedown", (e42) => {
31984
- const dv = e42.target;
31985
- e42.preventDefault();
31986
- e42.stopImmediatePropagation();
31987
- if (!Dom.isTag(dv, "span")) {
31988
- return;
31989
- }
31990
- const k6 = parseInt(attr(dv, "-index") || "0", 10);
32004
+ const insertTable = (cell) => {
32005
+ const k6 = parseInt(attr(cell, "-index") || "0", 10);
31991
32006
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31992
32007
  const crt = editor.createInside, tbody = crt.element("tbody"), table2 = crt.element("table");
31993
32008
  table2.appendChild(tbody);
@@ -32048,10 +32063,65 @@ Config.prototype.controls.table = {
32048
32063
  scrollIntoViewIfNeeded(first_td, editor.editor, editor.ed);
32049
32064
  }
32050
32065
  close();
32066
+ };
32067
+ editor.e.on(blocksContainer, "mousemove", (e42) => {
32068
+ if (Dom.isTag(e42.target, "span")) {
32069
+ highlightCell(e42.target);
32070
+ }
32071
+ }).on(blocksContainer, "touchstart mousedown", (e42) => {
32072
+ if (!Dom.isTag(e42.target, "span")) {
32073
+ return;
32074
+ }
32075
+ e42.preventDefault();
32076
+ e42.stopImmediatePropagation();
32077
+ insertTable(e42.target);
32078
+ }).on(blocksContainer, "keydown", (e42) => {
32079
+ if (!Dom.isTag(e42.target, "span")) {
32080
+ return;
32081
+ }
32082
+ if (e42.key === KEY_ENTER) {
32083
+ e42.preventDefault();
32084
+ e42.stopImmediatePropagation();
32085
+ insertTable(e42.target);
32086
+ return;
32087
+ }
32088
+ if (e42.key === KEY_ESC) {
32089
+ e42.preventDefault();
32090
+ e42.stopImmediatePropagation();
32091
+ close();
32092
+ return;
32093
+ }
32094
+ const index = parseInt(attr(e42.target, "-index") || "0", 10), row = Math.floor(index / default_cols_count), col = index % default_cols_count;
32095
+ let nextIndex = index;
32096
+ switch (e42.key) {
32097
+ case KEY_LEFT:
32098
+ nextIndex = col > 0 ? index - 1 : index;
32099
+ break;
32100
+ case KEY_RIGHT:
32101
+ nextIndex = col < default_cols_count - 1 ? index + 1 : index;
32102
+ break;
32103
+ case KEY_UP:
32104
+ nextIndex = row > 0 ? index - default_cols_count : index;
32105
+ break;
32106
+ case KEY_DOWN:
32107
+ nextIndex = row < default_rows_count - 1 ? index + default_cols_count : index;
32108
+ break;
32109
+ default:
32110
+ return;
32111
+ }
32112
+ e42.preventDefault();
32113
+ e42.stopImmediatePropagation();
32114
+ if (nextIndex !== index) {
32115
+ cells[index].tabIndex = -1;
32116
+ cells[nextIndex].tabIndex = 0;
32117
+ cells[nextIndex].focus();
32118
+ highlightCell(cells[nextIndex]);
32119
+ }
32051
32120
  });
32052
32121
  if (button2 && button2.parentElement) {
32053
32122
  for (let i54 = 0; i54 < default_rows_count; i54 += 1) {
32054
32123
  const row = editor.c.div();
32124
+ attr(row, "role", "row");
32055
32125
  for (let j10 = 0; j10 < default_cols_count; j10 += 1) {
32056
32126
  row.appendChild(cells[i54 * default_cols_count + j10]);
32057
32127
  }
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-KZHDMEIW.mjs";
5
+ } from "./chunk-E2AZLYYJ.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;