jodit 4.2.33 → 4.2.35

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 (60) hide show
  1. package/CHANGELOG.md +17 -5
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +29 -19
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.js +1 -1
  7. package/es2015/plugins/debug/debug.min.js +1 -1
  8. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  11. package/es2018/jodit.css +1 -1
  12. package/es2018/jodit.fat.min.js +2 -2
  13. package/es2018/jodit.js +29 -19
  14. package/es2018/jodit.min.js +2 -2
  15. package/es2018/plugins/debug/debug.js +1 -1
  16. package/es2018/plugins/debug/debug.min.js +1 -1
  17. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  18. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +1 -1
  21. package/es2021/jodit.fat.min.js +2 -2
  22. package/es2021/jodit.js +29 -19
  23. package/es2021/jodit.min.js +2 -2
  24. package/es2021/plugins/debug/debug.js +1 -1
  25. package/es2021/plugins/debug/debug.min.js +1 -1
  26. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  27. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  28. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  29. package/es2021.en/jodit.css +1 -1
  30. package/es2021.en/jodit.fat.min.js +2 -2
  31. package/es2021.en/jodit.js +29 -19
  32. package/es2021.en/jodit.min.js +2 -2
  33. package/es2021.en/plugins/debug/debug.js +1 -1
  34. package/es2021.en/plugins/debug/debug.min.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  36. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  37. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  38. package/es5/164.fat.min.js +1 -1
  39. package/es5/164.min.js +1 -1
  40. package/es5/5.fat.min.js +1 -1
  41. package/es5/5.min.js +1 -1
  42. package/es5/jodit.css +2 -2
  43. package/es5/jodit.fat.min.js +2 -2
  44. package/es5/jodit.js +29 -19
  45. package/es5/jodit.min.css +2 -2
  46. package/es5/jodit.min.js +2 -2
  47. package/es5/plugins/debug/debug.js +1 -1
  48. package/es5/plugins/debug/debug.min.js +1 -1
  49. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  50. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  51. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/selection/style/api/list/toggle-ordered-list.js +3 -1
  54. package/esm/core/selection/style/api/list/wrap-list.d.ts +1 -1
  55. package/esm/modules/history/snapshot.d.ts +1 -1
  56. package/esm/modules/history/snapshot.js +10 -8
  57. package/esm/plugins/link/link.js +10 -4
  58. package/package.json +1 -1
  59. package/types/core/selection/style/api/list/wrap-list.d.ts +1 -1
  60. package/types/modules/history/snapshot.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3,7 +3,7 @@
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
- export const APP_VERSION = "4.2.33";
6
+ export const APP_VERSION = "4.2.35";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -51,5 +51,7 @@ function unwrapList(mode, list, li, jodit, cs) {
51
51
  extractSelectedPart(list, li, jodit);
52
52
  assert(Dom.isHTMLElement(li.parentElement), 'Element should be inside the list');
53
53
  Dom.unwrap(li.parentElement);
54
- return Dom.replace(li, jodit.o.enter, jodit.createInside);
54
+ return Dom.replace(li, jodit.o.enter.toLowerCase() !== 'br'
55
+ ? jodit.o.enter
56
+ : jodit.createInside.fragment(), jodit.createInside);
55
57
  }
@@ -9,4 +9,4 @@ import type { ICommitStyle, IJodit } from "../../../../../types";
9
9
  * adds a new item to the nearest old list
10
10
  * @private
11
11
  */
12
- export declare function wrapList(commitStyle: ICommitStyle, wrapper: HTMLElement, jodit: IJodit): HTMLElement;
12
+ export declare function wrapList(commitStyle: ICommitStyle, wrapper: HTMLElement | DocumentFragment, jodit: IJodit): HTMLElement;
@@ -63,5 +63,5 @@ export declare class Snapshot extends ViewComponent<IJodit> implements ISnapshot
63
63
  restoreOnlySelection(snapshot: SnapshotType): void;
64
64
  destruct(): void;
65
65
  private static isIgnoredNode;
66
- private removeJoditSelection;
66
+ private __getCleanedEditorValue;
67
67
  }
@@ -4,8 +4,8 @@
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { ViewComponent } from "../../core/component/index.js";
7
- import { IS_PROD, TEMP_ATTR } from "../../core/constants.js";
8
- import { Dom } from "../../core/dom/index.js";
7
+ import { IS_PROD } from "../../core/constants.js";
8
+ import { Dom } from "../../core/dom/dom.js";
9
9
  /**
10
10
  * Module for creating snapshot of editor which includes html content and the current selection
11
11
  */
@@ -119,10 +119,12 @@ export class Snapshot extends ViewComponent {
119
119
  endOffset: 0
120
120
  }
121
121
  };
122
- snapshot.html = this.removeJoditSelection(this.j.editor);
122
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
123
123
  const sel = this.j.s.sel;
124
124
  if (sel && sel.rangeCount) {
125
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
125
+ const range = sel.getRangeAt(0);
126
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
127
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
126
128
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
127
129
  if (!startContainer.length &&
128
130
  range.startContainer !== this.j.editor) {
@@ -149,8 +151,8 @@ export class Snapshot extends ViewComponent {
149
151
  restore(snapshot) {
150
152
  this.transaction(() => {
151
153
  const scroll = this.storeScrollState();
152
- const value = this.j.getNativeEditorValue();
153
- if (value !== snapshot.html) {
154
+ const html = this.__getCleanedEditorValue(this.j.editor);
155
+ if (html !== snapshot.html) {
154
156
  this.j.value = snapshot.html;
155
157
  }
156
158
  this.restoreOnlySelection(snapshot);
@@ -196,9 +198,9 @@ export class Snapshot extends ViewComponent {
196
198
  static isIgnoredNode(node) {
197
199
  return (Dom.isText(node) && !node.nodeValue) || Dom.isTemporary(node);
198
200
  }
199
- removeJoditSelection(node) {
201
+ __getCleanedEditorValue(node) {
200
202
  const clone = node.cloneNode(true);
201
- clone.querySelectorAll(`[${TEMP_ATTR}]`).forEach(Dom.unwrap);
203
+ Dom.temporaryList(clone).forEach(Dom.unwrap);
202
204
  return clone.innerHTML;
203
205
  }
204
206
  }
@@ -101,13 +101,19 @@ export class link extends Plugin {
101
101
  __generateForm(current, close) {
102
102
  const { jodit } = this;
103
103
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
104
- const html = formTemplate(jodit), form = isString(html)
104
+ const html = formTemplate(jodit);
105
+ const form = isString(html)
105
106
  ? jodit.c.fromHTML(html, {
106
107
  target_checkbox_box: openInNewTabCheckbox,
107
108
  nofollow_checkbox_box: noFollowCheckbox
108
109
  })
109
- : html, htmlForm = Dom.isElement(form) ? form : form.container;
110
- const elements = refs(htmlForm), { insert, unlink, content_input_box } = elements, { target_checkbox, nofollow_checkbox, url_input } = elements, currentElement = current, isImageContent = Dom.isImage(currentElement);
110
+ : html;
111
+ const htmlForm = Dom.isElement(form) ? form : form.container;
112
+ const elements = refs(htmlForm);
113
+ const { insert, unlink, content_input_box } = elements;
114
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
115
+ const currentElement = current;
116
+ const isImageContent = Dom.isImage(currentElement);
111
117
  let { content_input } = elements;
112
118
  const { className_input } = elements, { className_select } = elements;
113
119
  if (!content_input) {
@@ -178,7 +184,7 @@ export class link extends Plugin {
178
184
  jodit.history.snapshot.restore(snapshot);
179
185
  const textWasChanged = getSelectionText() !== content_input.value.trim();
180
186
  const ci = jodit.createInside;
181
- if (!link) {
187
+ if (!link || !Dom.isOrContains(jodit.editor, link)) {
182
188
  if (!jodit.s.isCollapsed()) {
183
189
  const node = jodit.s.current();
184
190
  if (Dom.isTag(node, 'img')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.33",
3
+ "version": "4.2.35",
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",
@@ -9,4 +9,4 @@ import type { ICommitStyle, IJodit } from "../../../../../types";
9
9
  * adds a new item to the nearest old list
10
10
  * @private
11
11
  */
12
- export declare function wrapList(commitStyle: ICommitStyle, wrapper: HTMLElement, jodit: IJodit): HTMLElement;
12
+ export declare function wrapList(commitStyle: ICommitStyle, wrapper: HTMLElement | DocumentFragment, jodit: IJodit): HTMLElement;
@@ -63,5 +63,5 @@ export declare class Snapshot extends ViewComponent<IJodit> implements ISnapshot
63
63
  restoreOnlySelection(snapshot: SnapshotType): void;
64
64
  destruct(): void;
65
65
  private static isIgnoredNode;
66
- private removeJoditSelection;
66
+ private __getCleanedEditorValue;
67
67
  }