jodit-pro-react 5.5.79 → 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-YX2ZXXFN.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.18";
196
+ APP_VERSION = "4.13.19";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -15861,6 +15861,7 @@ var instance = (j10) => j10.getInstance("Table", j10.o);
15861
15861
 
15862
15862
  // node_modules/jodit/esm/modules/toolbar/button/button.js
15863
15863
  init_statuses();
15864
+ init_constants();
15864
15865
  init_autobind();
15865
15866
  init_cache();
15866
15867
  init_component();
@@ -15965,6 +15966,7 @@ var ToolbarButton = class ToolbarButton2 extends UIButton {
15965
15966
  }
15966
15967
  onChangeTabIndex() {
15967
15968
  attr(this.button, "tabindex", this.state.tabIndex);
15969
+ attr(this.trigger, "tabindex", this.state.tabIndex);
15968
15970
  }
15969
15971
  createContainer() {
15970
15972
  const cn = this.componentName;
@@ -16112,6 +16114,13 @@ var ToolbarButton = class ToolbarButton2 extends UIButton {
16112
16114
  this.j.e.fire(camelCase(`after-${ctr.name}-open-popup`), popup.container);
16113
16115
  }
16114
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
+ }
16115
16124
  /**
16116
16125
  * Create an open popup list
16117
16126
  */
@@ -16242,6 +16251,9 @@ __decorate32([
16242
16251
  __decorate32([
16243
16252
  watch("trigger:click")
16244
16253
  ], ToolbarButton.prototype, "onTriggerClick", null);
16254
+ __decorate32([
16255
+ watch("trigger:keydown")
16256
+ ], ToolbarButton.prototype, "onTriggerKeyDown", null);
16245
16257
  __decorate32([
16246
16258
  autobind
16247
16259
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -31913,6 +31925,7 @@ var import_tab = __toESM(require_tab());
31913
31925
  init_global2();
31914
31926
 
31915
31927
  // node_modules/jodit/esm/plugins/table/config.js
31928
+ init_constants();
31916
31929
  init_dom2();
31917
31930
  init_helpers();
31918
31931
  init_utils3();
@@ -31958,19 +31971,25 @@ Config.prototype.controls.table = {
31958
31971
  };
31959
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 = [];
31960
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
+ });
31961
31980
  for (let i54 = 0; i54 < cnt; i54 += 1) {
31962
31981
  if (!cells[i54]) {
31982
+ const row = Math.floor(i54 / default_cols_count) + 1, col = i54 % default_cols_count + 1;
31963
31983
  cells.push(editor.c.element("span", {
31964
- dataIndex: i54
31984
+ dataIndex: i54,
31985
+ role: "gridcell",
31986
+ tabindex: i54 === 0 ? 0 : -1,
31987
+ ariaLabel: `${row} by ${col}`
31965
31988
  }));
31966
31989
  }
31967
31990
  }
31968
- const mouseenter = (e42, index) => {
31969
- const dv = e42.target;
31970
- if (!Dom.isTag(dv, "span")) {
31971
- return;
31972
- }
31973
- 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);
31974
31993
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31975
31994
  for (let i54 = 0; i54 < cells.length; i54 += 1) {
31976
31995
  if (cols_count >= i54 % default_cols_count + 1 && rows_count >= Math.ceil((i54 + 1) / default_cols_count)) {
@@ -31982,14 +32001,8 @@ Config.prototype.controls.table = {
31982
32001
  cols.textContent = cols_count.toString();
31983
32002
  rows.textContent = rows_count.toString();
31984
32003
  };
31985
- editor.e.on(blocksContainer, "mousemove", mouseenter).on(blocksContainer, "touchstart mousedown", (e42) => {
31986
- const dv = e42.target;
31987
- e42.preventDefault();
31988
- e42.stopImmediatePropagation();
31989
- if (!Dom.isTag(dv, "span")) {
31990
- return;
31991
- }
31992
- const k6 = parseInt(attr(dv, "-index") || "0", 10);
32004
+ const insertTable = (cell) => {
32005
+ const k6 = parseInt(attr(cell, "-index") || "0", 10);
31993
32006
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31994
32007
  const crt = editor.createInside, tbody = crt.element("tbody"), table2 = crt.element("table");
31995
32008
  table2.appendChild(tbody);
@@ -32050,10 +32063,65 @@ Config.prototype.controls.table = {
32050
32063
  scrollIntoViewIfNeeded(first_td, editor.editor, editor.ed);
32051
32064
  }
32052
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
+ }
32053
32120
  });
32054
32121
  if (button2 && button2.parentElement) {
32055
32122
  for (let i54 = 0; i54 < default_rows_count; i54 += 1) {
32056
32123
  const row = editor.c.div();
32124
+ attr(row, "role", "row");
32057
32125
  for (let j10 = 0; j10 < default_cols_count; j10 += 1) {
32058
32126
  row.appendChild(cells[i54 * default_cols_count + j10]);
32059
32127
  }
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-YX2ZXXFN.mjs";
5
+ } from "./chunk-E2AZLYYJ.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;