jodit-pro-react 5.5.79 → 5.5.81

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-LJXVGTZ7.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.20";
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);
@@ -28575,10 +28587,20 @@ var UISearch = class UISearch2 extends UIElement {
28575
28587
  this.replaceButton = replaceBtn;
28576
28588
  this.currentBox = current;
28577
28589
  this.countBox = count;
28590
+ const closeAction = () => this.close();
28591
+ const replaceAction = () => void jodit.e.fire(this, "pressReplaceButton");
28592
+ const nextAction = () => void jodit.e.fire("searchNext");
28593
+ const prevAction = () => void jodit.e.fire("searchPrevious");
28594
+ const onKeyboardActivate = (action) => (e42) => {
28595
+ if (!e42.detail) {
28596
+ e42.preventDefault();
28597
+ action();
28598
+ }
28599
+ };
28578
28600
  jodit.e.on(this.closeButton, "pointerdown", () => {
28579
- this.close();
28601
+ closeAction();
28580
28602
  return false;
28581
- }).on(this.queryInput, "input", () => {
28603
+ }).on(this.closeButton, "click", onKeyboardActivate(closeAction)).on(this.queryInput, "input", () => {
28582
28604
  this.currentIndex = 0;
28583
28605
  }).on(this.queryInput, "pointerdown", () => {
28584
28606
  if (jodit.s.isFocused()) {
@@ -28586,15 +28608,15 @@ var UISearch = class UISearch2 extends UIElement {
28586
28608
  this.selInfo = jodit.s.save();
28587
28609
  }
28588
28610
  }).on(this.replaceButton, "pointerdown", () => {
28589
- jodit.e.fire(this, "pressReplaceButton");
28611
+ replaceAction();
28590
28612
  return false;
28591
- }).on(next, "pointerdown", () => {
28592
- void jodit.e.fire("searchNext");
28613
+ }).on(this.replaceButton, "click", onKeyboardActivate(replaceAction)).on(next, "pointerdown", () => {
28614
+ nextAction();
28593
28615
  return false;
28594
- }).on(prev, "pointerdown", () => {
28595
- jodit.e.fire("searchPrevious");
28616
+ }).on(next, "click", onKeyboardActivate(nextAction)).on(prev, "pointerdown", () => {
28617
+ prevAction();
28596
28618
  return false;
28597
- }).on(this.queryInput, "input", () => {
28619
+ }).on(prev, "click", onKeyboardActivate(prevAction)).on(this.queryInput, "input", () => {
28598
28620
  this.setMod("empty-query", !trim(this.queryInput.value).length);
28599
28621
  }).on(this.queryInput, "keydown", (() => {
28600
28622
  const debounced = this.j.async.debounce((e42) => __async(this, null, function* () {
@@ -31913,6 +31935,7 @@ var import_tab = __toESM(require_tab());
31913
31935
  init_global2();
31914
31936
 
31915
31937
  // node_modules/jodit/esm/plugins/table/config.js
31938
+ init_constants();
31916
31939
  init_dom2();
31917
31940
  init_helpers();
31918
31941
  init_utils3();
@@ -31958,19 +31981,25 @@ Config.prototype.controls.table = {
31958
31981
  };
31959
31982
  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
31983
  const cnt = default_rows_count * default_cols_count;
31984
+ attr(blocksContainer, {
31985
+ role: "grid",
31986
+ ariaLabel: "Table size",
31987
+ ariaRowcount: default_rows_count,
31988
+ ariaColcount: default_cols_count
31989
+ });
31961
31990
  for (let i54 = 0; i54 < cnt; i54 += 1) {
31962
31991
  if (!cells[i54]) {
31992
+ const row = Math.floor(i54 / default_cols_count) + 1, col = i54 % default_cols_count + 1;
31963
31993
  cells.push(editor.c.element("span", {
31964
- dataIndex: i54
31994
+ dataIndex: i54,
31995
+ role: "gridcell",
31996
+ tabindex: i54 === 0 ? 0 : -1,
31997
+ ariaLabel: `${row} by ${col}`
31965
31998
  }));
31966
31999
  }
31967
32000
  }
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;
32001
+ const highlightCell = (cell) => {
32002
+ const k6 = parseInt(attr(cell, "-index") || "0", 10);
31974
32003
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31975
32004
  for (let i54 = 0; i54 < cells.length; i54 += 1) {
31976
32005
  if (cols_count >= i54 % default_cols_count + 1 && rows_count >= Math.ceil((i54 + 1) / default_cols_count)) {
@@ -31982,14 +32011,8 @@ Config.prototype.controls.table = {
31982
32011
  cols.textContent = cols_count.toString();
31983
32012
  rows.textContent = rows_count.toString();
31984
32013
  };
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);
32014
+ const insertTable = (cell) => {
32015
+ const k6 = parseInt(attr(cell, "-index") || "0", 10);
31993
32016
  const rows_count = Math.ceil((k6 + 1) / default_cols_count), cols_count = k6 % default_cols_count + 1;
31994
32017
  const crt = editor.createInside, tbody = crt.element("tbody"), table2 = crt.element("table");
31995
32018
  table2.appendChild(tbody);
@@ -32050,10 +32073,65 @@ Config.prototype.controls.table = {
32050
32073
  scrollIntoViewIfNeeded(first_td, editor.editor, editor.ed);
32051
32074
  }
32052
32075
  close();
32076
+ };
32077
+ editor.e.on(blocksContainer, "mousemove", (e42) => {
32078
+ if (Dom.isTag(e42.target, "span")) {
32079
+ highlightCell(e42.target);
32080
+ }
32081
+ }).on(blocksContainer, "touchstart mousedown", (e42) => {
32082
+ if (!Dom.isTag(e42.target, "span")) {
32083
+ return;
32084
+ }
32085
+ e42.preventDefault();
32086
+ e42.stopImmediatePropagation();
32087
+ insertTable(e42.target);
32088
+ }).on(blocksContainer, "keydown", (e42) => {
32089
+ if (!Dom.isTag(e42.target, "span")) {
32090
+ return;
32091
+ }
32092
+ if (e42.key === KEY_ENTER) {
32093
+ e42.preventDefault();
32094
+ e42.stopImmediatePropagation();
32095
+ insertTable(e42.target);
32096
+ return;
32097
+ }
32098
+ if (e42.key === KEY_ESC) {
32099
+ e42.preventDefault();
32100
+ e42.stopImmediatePropagation();
32101
+ close();
32102
+ return;
32103
+ }
32104
+ const index = parseInt(attr(e42.target, "-index") || "0", 10), row = Math.floor(index / default_cols_count), col = index % default_cols_count;
32105
+ let nextIndex = index;
32106
+ switch (e42.key) {
32107
+ case KEY_LEFT:
32108
+ nextIndex = col > 0 ? index - 1 : index;
32109
+ break;
32110
+ case KEY_RIGHT:
32111
+ nextIndex = col < default_cols_count - 1 ? index + 1 : index;
32112
+ break;
32113
+ case KEY_UP:
32114
+ nextIndex = row > 0 ? index - default_cols_count : index;
32115
+ break;
32116
+ case KEY_DOWN:
32117
+ nextIndex = row < default_rows_count - 1 ? index + default_cols_count : index;
32118
+ break;
32119
+ default:
32120
+ return;
32121
+ }
32122
+ e42.preventDefault();
32123
+ e42.stopImmediatePropagation();
32124
+ if (nextIndex !== index) {
32125
+ cells[index].tabIndex = -1;
32126
+ cells[nextIndex].tabIndex = 0;
32127
+ cells[nextIndex].focus();
32128
+ highlightCell(cells[nextIndex]);
32129
+ }
32053
32130
  });
32054
32131
  if (button2 && button2.parentElement) {
32055
32132
  for (let i54 = 0; i54 < default_rows_count; i54 += 1) {
32056
32133
  const row = editor.c.div();
32134
+ attr(row, "role", "row");
32057
32135
  for (let j10 = 0; j10 < default_cols_count; j10 += 1) {
32058
32136
  row.appendChild(cells[i54 * default_cols_count + j10]);
32059
32137
  }
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-YX2ZXXFN.mjs";
5
+ } from "./chunk-LJXVGTZ7.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;