jodit 4.2.14 → 4.2.15

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 (79) hide show
  1. package/es2015/jodit.css +115 -115
  2. package/es2015/jodit.fat.min.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +525 -444
  5. package/es2015/jodit.min.css +1 -1
  6. package/es2015/jodit.min.js +2 -2
  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.css +115 -115
  13. package/es2018/jodit.fat.min.css +1 -1
  14. package/es2018/jodit.fat.min.js +2 -2
  15. package/es2018/jodit.js +525 -444
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +2 -2
  18. package/es2018/plugins/debug/debug.js +1 -1
  19. package/es2018/plugins/debug/debug.min.js +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  23. package/es2021/jodit.css +115 -115
  24. package/es2021/jodit.fat.min.css +1 -1
  25. package/es2021/jodit.fat.min.js +2 -2
  26. package/es2021/jodit.js +519 -440
  27. package/es2021/jodit.min.css +1 -1
  28. package/es2021/jodit.min.js +2 -2
  29. package/es2021/plugins/debug/debug.js +1 -1
  30. package/es2021/plugins/debug/debug.min.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  34. package/es2021.en/jodit.css +115 -115
  35. package/es2021.en/jodit.fat.min.css +1 -1
  36. package/es2021.en/jodit.fat.min.js +2 -2
  37. package/es2021.en/jodit.js +519 -440
  38. package/es2021.en/jodit.min.css +1 -1
  39. package/es2021.en/jodit.min.js +2 -2
  40. package/es2021.en/plugins/debug/debug.js +1 -1
  41. package/es2021.en/plugins/debug/debug.min.js +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  45. package/es5/jodit.css +129 -129
  46. package/es5/jodit.fat.min.css +1 -1
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +542 -460
  49. package/es5/jodit.min.css +3 -3
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/esm/core/constants.js +1 -1
  57. package/esm/core/selection/helpers/index.d.ts +9 -3
  58. package/esm/core/selection/helpers/index.js +48 -0
  59. package/esm/core/selection/selection.d.ts +6 -1
  60. package/esm/core/selection/selection.js +95 -117
  61. package/esm/index.d.ts +6 -1
  62. package/esm/index.js +3 -2
  63. package/esm/modules/table/table.d.ts +3 -1
  64. package/esm/modules/table/table.js +38 -33
  65. package/esm/modules/uploader/helpers/send-files.js +33 -29
  66. package/esm/plugins/backspace/cases/check-remove-char.js +65 -55
  67. package/esm/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
  68. package/esm/plugins/drag-and-drop/drag-and-drop.js +43 -36
  69. package/esm/plugins/link/link.js +71 -64
  70. package/esm/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
  71. package/esm/plugins/search/helpers/highlight-text-ranges.js +58 -49
  72. package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +35 -29
  73. package/package.json +1 -1
  74. package/types/core/selection/helpers/index.d.ts +9 -3
  75. package/types/core/selection/selection.d.ts +6 -1
  76. package/types/index.d.ts +6 -1
  77. package/types/modules/table/table.d.ts +3 -1
  78. package/types/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
  79. package/types/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
@@ -23,38 +23,10 @@ export function tableKeyboardNavigation(editor) {
23
23
  .off('.tableKeyboardNavigation')
24
24
  .on('keydown.tableKeyboardNavigation', (event) => {
25
25
  const { key } = event;
26
- if (!WORK_KEYS.has(key)) {
27
- return;
28
- }
29
- const current = editor.s.current();
30
- if (!current) {
31
- return;
32
- }
33
- const cell = Dom.up(current, Dom.isCell, editor.editor);
26
+ const cell = findCell(editor, key);
34
27
  if (!cell) {
35
28
  return;
36
29
  }
37
- const { range } = editor.s;
38
- if (key !== consts.KEY_TAB && current !== cell) {
39
- const isNextDirection = key === consts.KEY_RIGHT || key === consts.KEY_DOWN;
40
- const hasNext = call(!isNextDirection ? Dom.prev : Dom.next, current, elm => key === consts.KEY_UP || key === consts.KEY_DOWN
41
- ? Dom.isTag(elm, 'br')
42
- : Boolean(elm), cell);
43
- if ((!isNextDirection &&
44
- (hasNext ||
45
- (key !== consts.KEY_UP &&
46
- Dom.isText(current) &&
47
- range.startOffset !== 0))) ||
48
- (isNextDirection &&
49
- (hasNext ||
50
- (key !== consts.KEY_DOWN &&
51
- Dom.isText(current) &&
52
- current.nodeValue &&
53
- range.startOffset !==
54
- current.nodeValue.length)))) {
55
- return;
56
- }
57
- }
58
30
  const tableModule = editor.getInstance(Table, editor.o);
59
31
  const table = Dom.closest(cell, 'table', editor.editor);
60
32
  let next = null;
@@ -112,3 +84,37 @@ export function tableKeyboardNavigation(editor) {
112
84
  });
113
85
  }
114
86
  pluginSystem.add('tableKeyboardNavigation', tableKeyboardNavigation);
87
+ function findCell(editor, key) {
88
+ if (!WORK_KEYS.has(key)) {
89
+ return;
90
+ }
91
+ const current = editor.s.current();
92
+ if (!current) {
93
+ return;
94
+ }
95
+ const cell = Dom.up(current, Dom.isCell, editor.editor);
96
+ if (!cell) {
97
+ return;
98
+ }
99
+ const { range } = editor.s;
100
+ if (key !== consts.KEY_TAB && current !== cell) {
101
+ const isNextDirection = key === consts.KEY_RIGHT || key === consts.KEY_DOWN;
102
+ const hasNext = call(!isNextDirection ? Dom.prev : Dom.next, current, elm => key === consts.KEY_UP || key === consts.KEY_DOWN
103
+ ? Dom.isTag(elm, 'br')
104
+ : Boolean(elm), cell);
105
+ if ((!isNextDirection &&
106
+ (hasNext ||
107
+ (key !== consts.KEY_UP &&
108
+ Dom.isText(current) &&
109
+ range.startOffset !== 0))) ||
110
+ (isNextDirection &&
111
+ (hasNext ||
112
+ (key !== consts.KEY_DOWN &&
113
+ Dom.isText(current) &&
114
+ current.nodeValue &&
115
+ range.startOffset !== current.nodeValue.length)))) {
116
+ return;
117
+ }
118
+ }
119
+ return cell;
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.14",
3
+ "version": "4.2.15",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -3,8 +3,14 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- /**
7
- * @module selection
8
- */
9
6
  export * from "./move-node-inside-start";
10
7
  export * from "./move-the-node-along-the-edge-outward";
8
+ /**
9
+ * Check if the cursor is at the edge of the string
10
+ * @private
11
+ */
12
+ export declare function cursorInTheEdgeOfString(container: Node, offset: number, start: boolean, end: boolean): boolean;
13
+ export declare function findCorrectCurrentNode(node: Node, range: Range, rightMode: boolean, isCollapsed: boolean, checkChild: boolean, child: (nd: Node) => Node | null): {
14
+ node: Node;
15
+ rightMode: boolean;
16
+ };
@@ -125,10 +125,11 @@ export declare class Selection implements ISelect {
125
125
  /**
126
126
  * Returns the current element under the cursor inside editor
127
127
  */
128
- current(checkChild?: boolean): null | Node;
128
+ current(checkChild?: boolean): Nullable<Node>;
129
129
  /**
130
130
  * Insert element in editor
131
131
  *
132
+ * @param node - Node for insert
132
133
  * @param insertCursorAfter - After insert, cursor will move after element
133
134
  * @param fireChange - After insert, editor fire change event. You can prevent this behavior
134
135
  */
@@ -137,6 +138,7 @@ export declare class Selection implements ISelect {
137
138
  * Inserts in the current cursor position some HTML snippet
138
139
  *
139
140
  * @param html - HTML The text to be inserted into the document
141
+ * @param insertCursorAfter - After insert, cursor will move after element
140
142
  * @example
141
143
  * ```javascript
142
144
  * parent.s.insertHTML('<img src="image.png"/>');
@@ -148,6 +150,7 @@ export declare class Selection implements ISelect {
148
150
  *
149
151
  * @param url - URL for image, or HTMLImageElement
150
152
  * @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
153
+ * @param defaultWidth - If specified, it will be applied <code>css('width', defaultWidth)</code>
151
154
  */
152
155
  insertImage(url: string | HTMLImageElement, styles?: Nullable<IDictionary<string>>, defaultWidth?: Nullable<number | string>): void;
153
156
  /**
@@ -188,6 +191,7 @@ export declare class Selection implements ISelect {
188
191
  private setCursorNearWith;
189
192
  /**
190
193
  * Set cursor in the node
194
+ * @param node - Node element
191
195
  * @param inStart - set cursor in start of element
192
196
  */
193
197
  setCursorIn(node: Node, inStart?: boolean): Node;
@@ -197,6 +201,7 @@ export declare class Selection implements ISelect {
197
201
  selectRange(range: Range, focus?: boolean): this;
198
202
  /**
199
203
  * Select node
204
+ * @param node - Node element
200
205
  * @param inward - select all inside
201
206
  */
202
207
  select(node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement, inward?: boolean): this;
package/types/index.d.ts CHANGED
@@ -3,8 +3,13 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import "./plugins/index";
6
+ /**
7
+ * [[include:README.md]]
8
+ * @packageDocumentation
9
+ * @module jodit
10
+ */
7
11
  import { Jodit as DefaultJodit } from "./jodit";
12
+ import "./plugins/index";
8
13
 
9
14
 
10
15
  export { DefaultJodit as Jodit };
@@ -38,6 +38,7 @@ export declare class Table extends ViewComponent<IJodit> {
38
38
  private static __formalMatrix;
39
39
  /**
40
40
  * Generate formal table martix columns*rows
41
+ * @param table - Working table
41
42
  * @param callback - if return false cycle break
42
43
  */
43
44
  formalMatrix(table: HTMLTableElement, callback?: (cell: HTMLTableCellElement, row: number, col: number, colSpan: number, rowSpan: number) => false | void): HTMLTableCellElement[][];
@@ -54,7 +55,6 @@ export declare class Table extends ViewComponent<IJodit> {
54
55
  * @param line - Insert a new line after/before this
55
56
  * line contains the selected cell
56
57
  * @param after - Insert a new line after line contains the selected cell
57
- * @param create - Instance of Create class
58
58
  */
59
59
  appendRow(table: HTMLTableElement, line: false | HTMLTableRowElement, after: boolean): void;
60
60
  private static __removeRow;
@@ -78,6 +78,8 @@ export declare class Table extends ViewComponent<IJodit> {
78
78
  */
79
79
  getSelectedBound(table: HTMLTableElement, selectedCells: HTMLTableCellElement[]): number[][];
80
80
  private static __normalizeTable;
81
+ private static __removeExtraColspans;
82
+ private static __removeExtraRowspans;
81
83
  /**
82
84
  * Try recalculate all coluns and rows after change
83
85
  */
@@ -21,6 +21,8 @@ export declare class dragAndDrop extends Plugin {
21
21
  private onDrag;
22
22
  private onDragEnd;
23
23
  private onDrop;
24
+ private __getWorkFragment;
25
+ private __insertFragment;
24
26
  private getText;
25
27
  /** @override */
26
28
  beforeDestruct(): void;
@@ -23,7 +23,3 @@ export declare function clearSelectionWrappers(root: HTMLElement): void;
23
23
  * @private
24
24
  */
25
25
  export declare function clearSelectionWrappersFromHTML(root: string): string;
26
- /**
27
- * @private
28
- */
29
- export declare function isSelectionWrapper(node: unknown): boolean;