jodit 4.12.21 → 4.12.23

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 (86) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +11 -11
  4. package/es2015/jodit.js +362 -101
  5. package/es2015/jodit.min.js +11 -11
  6. package/es2015/plugins/debug/debug.css +1 -1
  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.fat.min.js +11 -11
  13. package/es2018/jodit.min.js +25 -25
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +13 -13
  18. package/es2021/jodit.js +352 -99
  19. package/es2021/jodit.min.js +23 -23
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +14 -14
  28. package/es2021.en/jodit.js +330 -77
  29. package/es2021.en/jodit.min.js +14 -14
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +415 -136
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/component/view-component.js +8 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/dom/dom.js +6 -4
  53. package/esm/core/helpers/checker/is-html-from-word.d.ts +1 -1
  54. package/esm/core/helpers/checker/is-html-from-word.js +12 -1
  55. package/esm/core/selection/style/api/wrap.js +18 -3
  56. package/esm/core/ui/popup/popup.js +4 -1
  57. package/esm/jodit.js +12 -0
  58. package/esm/langs/tr.js +1 -1
  59. package/esm/modules/dialog/dialog.d.ts +5 -0
  60. package/esm/modules/dialog/dialog.js +25 -2
  61. package/esm/modules/toolbar/button/content.d.ts +6 -0
  62. package/esm/modules/toolbar/button/content.js +26 -1
  63. package/esm/plugins/add-new-line/add-new-line.js +4 -1
  64. package/esm/plugins/ai-assistant/ai-assistant.js +7 -1
  65. package/esm/plugins/backspace/cases/check-join-neighbors.js +15 -1
  66. package/esm/plugins/clean-html/clean-html.js +8 -2
  67. package/esm/plugins/clean-html/helpers/visitor/filters/allow-attributes.js +9 -2
  68. package/esm/plugins/clipboard/clipboard.js +29 -1
  69. package/esm/plugins/color/color.js +21 -21
  70. package/esm/plugins/inline-popup/inline-popup.d.ts +15 -0
  71. package/esm/plugins/inline-popup/inline-popup.js +60 -3
  72. package/esm/plugins/limit/limit.js +7 -1
  73. package/esm/plugins/paste/config.js +11 -2
  74. package/esm/plugins/paste/paste.d.ts +1 -1
  75. package/esm/plugins/paste/paste.js +7 -5
  76. package/esm/plugins/resize-handler/resize-handler.js +13 -2
  77. package/esm/plugins/resizer/resizer.js +5 -1
  78. package/esm/plugins/search/ui/search.js +22 -12
  79. package/esm/plugins/select-cells/select-cells.js +10 -6
  80. package/esm/plugins/source/source.js +9 -0
  81. package/package.json +1 -1
  82. package/types/core/helpers/checker/is-html-from-word.d.ts +1 -1
  83. package/types/modules/dialog/dialog.d.ts +5 -0
  84. package/types/modules/toolbar/button/content.d.ts +6 -0
  85. package/types/plugins/inline-popup/inline-popup.d.ts +15 -0
  86. package/types/plugins/paste/paste.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,52 @@
9
9
  > - :house: [Internal]
10
10
  > - :nail_care: [Polish]
11
11
 
12
+ ## 4.12.23
13
+
14
+ #### :bug: Bug Fix
15
+
16
+ - **Search (Ctrl+F)**: pressing Enter in the search input **submitted the parent `<form>`** instead of jumping to the next match — the `preventDefault()` for Enter lived inside a debounced handler, so it ran only after the browser had already dispatched the form submission. Enter is now canceled synchronously, while the search logic itself stays debounced. Fixes [#918](https://github.com/xdan/jodit/issues/918).
17
+ - **i18n / language bundles**: translations for keys that were missing from `ar.js` never reached the build — the master i18n key list was generated **only from `ar.js`**, and every other language is serialized as an array indexed by that list, so existing translations for the ordered-list menu items (*Lower Alpha*, *Lower Greek*, *Lower Roman*, *Upper Alpha*, *Upper Roman* — translated in de/es/fi/it/ja/pt_br) and a dozen other keys were silently dropped from every bundle. The key list is now built as the **union of all language files**. Fixes [#997](https://github.com/xdan/jodit/issues/997).
18
+ - **Custom `ownerWindow` (editor created inside an iframe)**: UI components (toolbar collection, popups, dialogs) always kept the **global** `window` as their owner window instead of the configured one. Popup/dropdown outside-click close handlers were therefore bound to the wrong window — clicks inside the iframe never reached them, so toolbar dropdowns did not close on an outside click. `ViewComponent` now inherits the owner window from its parent view. Fixes [#965](https://github.com/xdan/jodit/issues/965).
19
+ - **Toolbar content controls (`getContent`)**: controls rendered through `getContent` (e.g. the FileBrowser **Upload** button) never ran the status calculation, so their `isDisabled`/`isActive`/`update` callbacks were silently ignored — the Upload button stayed enabled even when the backend permissions (`canI('FileUpload')`) said otherwise. `ToolbarContent.update()` now evaluates the control's status like regular toolbar buttons and also propagates the disabled state to nested form controls (the file `<input>` of the Upload button). Thanks @WatchfulEyeOfZod for the diagnosis and the patch draft. Fixes [#1094](https://github.com/xdan/jodit/issues/1094).
20
+ - **Inline toolbar / Iframe mode**: with `iframe: true` the selection toolbar (`toolbarInlineForSelection`) opened far away from the selected text — the popup was positioned by `range.getBoundingClientRect()`, whose coordinates are **iframe-local**, while the popup itself lives in the host document. The iframe offset is now added to the selection bound. Fixes [#1058](https://github.com/xdan/jodit/issues/1058).
21
+ - **Paste toolbar button**: the *Paste from clipboard* toolbar button inserted only the **plain text** flavor of the clipboard, while Ctrl+V pasted the full HTML — the button explicitly requested `text/plain` from `navigator.clipboard.read()` even when `text/html` was available. The button now prefers the HTML flavor (falling back to plain text), so both paste paths behave the same. Fixes [#1061](https://github.com/xdan/jodit/issues/1061).
22
+ - **Format block (H1–H6 / paragraph)**: applying a heading to a block pasted from an external source seemed to do nothing — the tag actually changed, but leftover inline styles like `font-weight: normal; font-size: 24px` visually overrode the new format, so an `<h2>` looked exactly like the old text. When a block format is applied, the conflicting `font-size`/`font-weight` inline styles are now removed from the block (other styles like color stay). Fixes [#1063](https://github.com/xdan/jodit/issues/1063).
23
+ - **Backspace/Delete next to a table**: pressing Backspace at the start of a paragraph that follows a table (or Delete at the end of a paragraph before one) merged the paragraph's text **into the `<table>` element itself** — it landed after `</tbody>`, which is invalid HTML; on the next parse the browser foster-parents such content out of the table, corrupting the document and causing follow-up DOM errors (the `Failed to execute 'appendChild'` console spam from the report). The join logic now merges the text into the edge table **cell** (last cell for Backspace, first for Delete). Covers [#1064](https://github.com/xdan/jodit/issues/1064).
24
+ - **Paste from Word (`askBeforePasteFromWord`)**: office content was frequently mis-detected as plain HTML, so the generic *Paste as HTML* dialog appeared instead of the Word one. The detector only matched a `Microsoft Word N` meta generator or `mso-` styles in **double** quotes combined with `<font>` tags — while the raw Word clipboard fragment uses **single-quoted** `style='mso-…'`, unquoted `class=MsoNormal`, an unquoted `ProgId` meta and office XML namespaces (and modern Word emits no `<font>` at all); LibreOffice/OpenOffice content was never detected. The detector now also recognizes all of these markers. Fixes [#1078](https://github.com/xdan/jodit/issues/1078).
25
+ - **Drag and drop (`enableDragAndDropFileToEditor: false`)**: dropping a file (e.g. a JPG from another window) into the editor still embedded it — with the option off no handler was bound to the `drop` event, nothing called `preventDefault`, and Firefox inserted the dropped image **natively**. With the option disabled the editor now cancels file drops, so they do nothing — as the option promises. Fixes [#1077](https://github.com/xdan/jodit/issues/1077).
26
+ - **AI Assistant**: the *Insert After* button placed the generated text after the **first** node of the selection — with several selected paragraphs the result landed inside/after the first paragraph instead of after the whole selection. The insertion point is now the collapsed **end** of the selection, so the result follows everything that was selected; single-word/sentence behavior is unchanged. Fixes [#1263](https://github.com/xdan/jodit/issues/1263).
27
+ - **Color / Select cells**: applying a text or background color from the main toolbar to table cells selected with the `select-cells` plugin (click or drag-select a cell — typical for tables pasted from Word) silently did nothing: the cell selection drops or collapses the native range, so the color was committed as a pending caret format in an empty `<span>` **outside** the table. When cells are selected and the native selection is collapsed, the `forecolor`/`background` commands now recolor the content of every selected cell (including nested spans carrying their own Word colors). Fixes [#1250](https://github.com/xdan/jodit/issues/1250).
28
+ - **Shadow DOM / Table**: clicking a table cell inside a Shadow DOM editor (the `shadowRoot` option, e.g. a Stencil/web component integration) never opened the cell properties popup (background, vertical align, split/merge, add/remove row & column). `document.elementFromPoint` does not pierce shadow boundaries — it returns the shadow **host** — so the `select-cells` plugin could not find the clicked cell on `mouseup`. The hit-testing now starts from the configured shadow root in `select-cells` (cell selection on click and drag-select), `add-new-line` (the *Break* line over tables/images) and `Popup.getKeepBound`. Fixes [#1312](https://github.com/xdan/jodit/issues/1312).
29
+
30
+ ## 4.12.22
31
+
32
+ #### :bug: Bug Fix
33
+
34
+ - **Clipboard (copy/cut inside the editor)**: copying or cutting a selection that sat **entirely inside the text** of a formatted element (e.g. selecting part of a bold-italic word with the mouse) put the bare text into the clipboard — the `<strong>`/`<em>`/… context was lost, so pasting it elsewhere dropped the formatting. Native browser copy keeps that context, but Jodit intercepts copy/cut and serialized only the range contents. The copied fragment is now wrapped in shallow clones of the selection's inline ancestors, like browsers do. Fixes [#1202](https://github.com/xdan/jodit/issues/1202).
35
+ - **Source mode / multiple editors**: switching an editor into source mode focused its code mirror **unconditionally** — when the switch happened programmatically (e.g. a Vue/React wrapper re-initializing the editor) it pulled the focus out of the editor the user was typing in. The mirror is now focused only when the focus is not already inside another editor or control. Fixes [#1356](https://github.com/xdan/jodit/issues/1356) (follow-up to [#1313](https://github.com/xdan/jodit/issues/1313)).
36
+ - **Limit (`limitChars` + `countTextSpaces`)**: the character limiter never counted spaces — even with `countTextSpaces: true` the limit applied to non-space characters only (`limitChars: 10` allowed `I am only 8` because only 8 visible characters were counted), while the status-bar counter showed the space-inclusive number. With `countTextSpaces: true` the limiter now counts characters the same way as the counter — including spaces. Fixes [#1144](https://github.com/xdan/jodit/issues/1144).
37
+ - **Value assignment re-requested images (jodit-react)**: every `editor.value = …` assignment parsed the HTML into a helper element of the **live** document to sanitize it, so the browser issued a network request for every `<img>` in the value — with wrappers that sync the value on each change (e.g. jodit-react `onChange`), the image URLs were re-requested on every click/keystroke. The sanitize sandbox is now an **inert document** (`implementation.createHTMLDocument`), which never loads sub-resources; `Dom.isElement`/`Dom.isHTMLElement` no longer require a browsing context (`defaultView`), so the sanitizer keeps working on inert nodes. The internal `safeHTML` hook is now fired as an event for extensibility. Fixes [#1237](https://github.com/xdan/jodit/issues/1237).
38
+ - **Inline toolbar (`toolbarInlineForSelection`)**: clicking a button in the selection toolbar (e.g. *Bold*) applied the command but closed the toolbar, even though the selection was still active — applying several formats required re-selecting the same text again and again. After a command fired from inside the popup, the selection toolbar is now reopened while the selection is not collapsed. Fixes [#1238](https://github.com/xdan/jodit/issues/1238).
39
+ - **Clean HTML (`allowTags`)**: when `cleanHTML.allowTags` was configured as a map with per-tag attribute rules (e.g. `{p: true, a: {href: true}}`) and the content contained a tag **outside** the list that had attributes (e.g. `<meta charset="utf-8">` from pasted e-mail HTML), the cleanup worker threw `TypeError: Cannot read properties of undefined` on every pass — the editor "crashed" on the first click and disallowed tags were never removed. The attribute filter now skips tags that are not in the allow list (the tags filter removes them). Fixes [#1224](https://github.com/xdan/jodit/issues/1224).
40
+ - **Paste (plain text)**: pasting plain text containing a stray `<` (e.g. `TD}gy{<KMj3ScW1[efbi`) lost everything after the bracket — the clipboard text was inserted through the HTML path, so `<KMj3…` was parsed as an unclosed tag and swallowed the rest of the string. When the clipboard contains **only** `text/plain` (and it is not actual HTML), special characters are now escaped before insertion, so `<`, `>` and `&` survive as literal text; the `nl2brInPlainText` line-break conversion still applies after escaping. Fixes [#1227](https://github.com/xdan/jodit/issues/1227).
41
+ - **i18n (Turkish)**: the Word/Excel paste prompt ("The pasted content is coming from a Microsoft Word/Excel document…") was shown in **German** when the editor language was set to Turkish — `langs/tr.js` contained a copy of the German translation for that key. Replaced with the proper Turkish text. Fixes [#1245](https://github.com/xdan/jodit/issues/1245).
42
+ - **Dialog**: a dialog (e.g. *Paste as HTML*) could be resized by its corner handle to a size smaller than its own header, content and footer, so the footer buttons ended up rendered outside the dialog box. Interactive resizing is now clamped to a minimum size: `dialog.minWidth`/`dialog.minHeight` options when set, otherwise the sum of the header, the content's CSS `min-height` and the footer (and the footer buttons' row width). Fixes [#1262](https://github.com/xdan/jodit/issues/1262).
43
+ - **Resize handler / Iframe**: resizing the **editor itself** by the statusbar handle was jerky in `iframe` mode — while dragging, the editor height jumped between two values. Same root cause as the image-resizer fix below: `mousemove` events proxied from the editor's iframe carry iframe-viewport coordinates and were mixed as-is with host-window ones; they are now shifted into the host coordinate space (checked via `e.view`). Fixes [#1287](https://github.com/xdan/jodit/issues/1287).
44
+ - **Resizer / Iframe**: resizing an image (or table) by its handles was jerky in `iframe` mode (e.g. with `editHTMLDocumentMode`) — the size jumped while dragging, making it impossible to set precisely. During a drag, `mousemove` events arrive both from the host window (pointer over the resize frame) and proxied from the editor's iframe (pointer over the content), but the iframe-viewport coordinate correction was applied to **all** of them, so host-window events were shifted by the workplace offset. The correction is now applied only to events that originate from the iframe window (`e.view`). Fixes [#1264](https://github.com/xdan/jodit/issues/1264).
45
+
46
+ #### :house: Internal
47
+
48
+ - **Popup tests**: added a regression test asserting that with `allowTabNavigation: true` an inner popup (a dropdown opened from a button inside another popup — e.g. the image *Horizontal align* list) is positioned next to its trigger button. With that option the inner popup is appended into the button inside the outer popup, whose CSS `transform` shifts `position: fixed` coordinates; covers [#1265](https://github.com/xdan/jodit/issues/1265) (already fixed in 4.12.8 by the `getFixedPositionOffset` containing-block compensation from [#1350](https://github.com/xdan/jodit/issues/1350)).
49
+ - **Shadow DOM tests**: added regression tests asserting that with the `shadowRoot` option the image **resizer frame**, the **image properties dialog** (double click) and the **inline popup** all open correctly inside the shadow root. Covers the scenario from [#1109](https://github.com/xdan/jodit/issues/1109), which does not reproduce with a vanilla Shadow DOM.
50
+ - **Tooltip tests**: added a regression test asserting that buttons inside the table-cell inline popup show their tooltip on hover. Covers [#1141](https://github.com/xdan/jodit/issues/1141), fixed back in 4.2.40.
51
+ - **Image-processor tests**: added regression tests asserting that a base64 (`data:`) image is replaced with a `blob:` URL **only in the view** and never leaks into `editor.value`, the source element, the controlled-value loop (value re-assigned on every change, as jodit-react does) or the value left after `destruct()` (React remount). Covers the scenario from [#1244](https://github.com/xdan/jodit/issues/1244), which does not reproduce in the core editor.
52
+ - **Selection tests**: added a regression test asserting that `editor.selection.insertHTML()` called after the editor lost focus (e.g. from a click handler on a non-focusable page element) inserts at the previously saved caret position instead of the start of the editor. Covers the scenario from [#1239](https://github.com/xdan/jodit/issues/1239), which does not reproduce on the current version in Chrome or Firefox.
53
+ - **Color tests**: added a regression test asserting that applying a font color over a selection that includes a whole table recolors the text in **every** cell — including cells whose color sits on the `<td>` itself (as Word produces) rather than on inner spans. Covers the scenario from [#1221](https://github.com/xdan/jodit/issues/1221), which does not reproduce on the current version.
54
+ - **Select-cells tests**: added a regression test asserting that the table cells popup stays open after a fast drag-select — including a pending trailing throttled `mousemove`, the Firefox redraw-hack cleanup, debounced history changes and the browser's `click` dispatched on the common `TR` ancestor. Covers the scenario from [#1174](https://github.com/xdan/jodit/issues/1174), which does not reproduce on the current version in Chrome or Firefox.
55
+ - **Paste tests**: added regression tests asserting that Word's inter-word spaces placed in their own spans (`<span style="letter-spacing:-.5pt"> </span>`) survive pasting in every mode (*keep*, *clean*, *text*). Covers the scenario from [#1230](https://github.com/xdan/jodit/issues/1230), which does not reproduce on the current version (verified with the full table HTML from the issue).
56
+ - **Resizer tests**: added a regression test asserting that in `iframe: true` + `editHTMLDocumentMode: true` mode the image resize frame is hidden when the iframe content is scrolled (the `iframe` plugin proxies the inner window's `scroll` event into the main window, where the `resizer` plugin listens). Covers the scenario from [#1266](https://github.com/xdan/jodit/issues/1266), which does not reproduce on the current version.
57
+
12
58
  ## 4.12.21
13
59
 
14
60
  #### :bug: Bug Fix
package/es2015/jodit.css CHANGED
@@ -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.12.21
4
+ * Version: v4.12.23
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */