jodit 4.18.12 → 4.19.0

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 (255) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +10 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +18 -12
  5. package/es2015/jodit.js +2464 -300
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +18 -12
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +18 -12
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +18 -12
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +10 -1
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +26 -19
  23. package/es2021/jodit.js +2426 -297
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +26 -19
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +10 -1
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +29 -22
  35. package/es2021.en/jodit.js +2400 -271
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +29 -22
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +11 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +2823 -360
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  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/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/config.d.ts +44 -1
  60. package/esm/config.js +2 -1
  61. package/esm/core/constants.js +1 -1
  62. package/esm/core/dom/dom.js +4 -2
  63. package/esm/core/event-emitter/event-emitter.js +1 -0
  64. package/esm/core/helpers/utils/align.d.ts +6 -1
  65. package/esm/core/helpers/utils/align.js +22 -12
  66. package/esm/core/helpers/utils/image-caption.d.ts +24 -0
  67. package/esm/core/helpers/utils/image-caption.js +43 -0
  68. package/esm/core/helpers/utils/index.d.ts +1 -0
  69. package/esm/core/helpers/utils/index.js +1 -0
  70. package/esm/core/selection/selection.d.ts +3 -0
  71. package/esm/core/selection/selection.js +20 -5
  72. package/esm/core/ui/helpers/focus-form-field.d.ts +12 -0
  73. package/esm/core/ui/helpers/focus-form-field.js +21 -0
  74. package/esm/jodit.js +18 -2
  75. package/esm/langs/ar.d.ts +2 -0
  76. package/esm/langs/ar.js +2 -0
  77. package/esm/langs/az.d.ts +2 -0
  78. package/esm/langs/az.js +2 -0
  79. package/esm/langs/cs_cz.d.ts +2 -0
  80. package/esm/langs/cs_cz.js +2 -0
  81. package/esm/langs/de.d.ts +2 -0
  82. package/esm/langs/de.js +2 -0
  83. package/esm/langs/es.d.ts +2 -0
  84. package/esm/langs/es.js +2 -0
  85. package/esm/langs/fa.d.ts +2 -0
  86. package/esm/langs/fa.js +2 -0
  87. package/esm/langs/fi.d.ts +2 -0
  88. package/esm/langs/fi.js +2 -0
  89. package/esm/langs/fr.d.ts +2 -0
  90. package/esm/langs/fr.js +2 -0
  91. package/esm/langs/he.d.ts +2 -0
  92. package/esm/langs/he.js +2 -0
  93. package/esm/langs/hu.d.ts +2 -0
  94. package/esm/langs/hu.js +2 -0
  95. package/esm/langs/id.d.ts +2 -0
  96. package/esm/langs/id.js +2 -0
  97. package/esm/langs/it.d.ts +2 -0
  98. package/esm/langs/it.js +2 -0
  99. package/esm/langs/ja.d.ts +2 -0
  100. package/esm/langs/ja.js +2 -0
  101. package/esm/langs/ko.d.ts +2 -0
  102. package/esm/langs/ko.js +2 -0
  103. package/esm/langs/mn.d.ts +2 -0
  104. package/esm/langs/mn.js +2 -0
  105. package/esm/langs/nl.d.ts +2 -0
  106. package/esm/langs/nl.js +2 -0
  107. package/esm/langs/no.d.ts +2 -0
  108. package/esm/langs/no.js +2 -0
  109. package/esm/langs/pl.d.ts +2 -0
  110. package/esm/langs/pl.js +2 -0
  111. package/esm/langs/pt_br.d.ts +2 -0
  112. package/esm/langs/pt_br.js +2 -0
  113. package/esm/langs/ru.d.ts +2 -0
  114. package/esm/langs/ru.js +2 -0
  115. package/esm/langs/sk.d.ts +2 -0
  116. package/esm/langs/sk.js +2 -0
  117. package/esm/langs/sv.d.ts +2 -0
  118. package/esm/langs/sv.js +2 -0
  119. package/esm/langs/tr.d.ts +2 -0
  120. package/esm/langs/tr.js +2 -0
  121. package/esm/langs/ua.d.ts +2 -0
  122. package/esm/langs/ua.js +2 -0
  123. package/esm/langs/zh_cn.d.ts +2 -0
  124. package/esm/langs/zh_cn.js +2 -0
  125. package/esm/langs/zh_tw.d.ts +2 -0
  126. package/esm/langs/zh_tw.js +2 -0
  127. package/esm/modules/table/table.d.ts +27 -0
  128. package/esm/modules/table/table.js +110 -2
  129. package/esm/modules/toolbar/button/button.js +11 -3
  130. package/esm/modules/uploader/helpers/send-files.js +3 -1
  131. package/esm/modules/widget/tabs/tabs.js +2 -0
  132. package/esm/plugins/all.d.ts +1 -0
  133. package/esm/plugins/all.js +1 -0
  134. package/esm/plugins/backspace/backspace.js +17 -1
  135. package/esm/plugins/backspace/cases/check-remove-char.js +1 -11
  136. package/esm/plugins/backspace/helpers.d.ts +5 -0
  137. package/esm/plugins/backspace/helpers.js +11 -0
  138. package/esm/plugins/clean-html/clean-html.js +2 -2
  139. package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
  140. package/esm/plugins/clean-html/helpers/index.js +1 -0
  141. package/esm/plugins/clean-html/helpers/remove-format/remove-format-for-word.d.ts +16 -0
  142. package/esm/plugins/clean-html/helpers/remove-format/remove-format-for-word.js +109 -0
  143. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +4 -2
  144. package/esm/plugins/format-block/config.d.ts +13 -0
  145. package/esm/plugins/format-block/config.js +38 -1
  146. package/esm/plugins/format-block/content-fonts.d.ts +17 -0
  147. package/esm/plugins/format-block/content-fonts.js +156 -0
  148. package/esm/plugins/image-caption/config.d.ts +31 -0
  149. package/esm/plugins/image-caption/config.js +11 -0
  150. package/esm/plugins/image-caption/image-caption.d.ts +140 -0
  151. package/esm/plugins/image-caption/image-caption.js +799 -0
  152. package/esm/plugins/image-processor/image-processor.d.ts +2 -1
  153. package/esm/plugins/image-processor/image-processor.js +9 -4
  154. package/esm/plugins/image-properties/config.js +1 -0
  155. package/esm/plugins/image-properties/image-properties.js +19 -5
  156. package/esm/plugins/image-properties/interface.d.ts +6 -0
  157. package/esm/plugins/image-properties/readers/align.d.ts +1 -1
  158. package/esm/plugins/image-properties/readers/index.js +9 -3
  159. package/esm/plugins/image-properties/readers/margin.d.ts +1 -1
  160. package/esm/plugins/image-properties/readers/size.d.ts +5 -1
  161. package/esm/plugins/image-properties/readers/size.js +4 -5
  162. package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +2 -0
  163. package/esm/plugins/image-properties/ui/ui-image-main-tab.js +20 -0
  164. package/esm/plugins/image-properties/writers/caption.d.ts +15 -0
  165. package/esm/plugins/image-properties/writers/caption.js +18 -0
  166. package/esm/plugins/image-properties/writers/index.js +15 -10
  167. package/esm/plugins/image-properties/writers/link.js +7 -2
  168. package/esm/plugins/image-properties/writers/margin.d.ts +1 -1
  169. package/esm/plugins/image-properties/writers/size.d.ts +5 -2
  170. package/esm/plugins/image-properties/writers/size.js +16 -2
  171. package/esm/plugins/indent/helpers.d.ts +9 -0
  172. package/esm/plugins/indent/helpers.js +23 -3
  173. package/esm/plugins/indent/indent.js +2 -20
  174. package/esm/plugins/index.d.ts +1 -0
  175. package/esm/plugins/inline-popup/config/config.js +4 -0
  176. package/esm/plugins/inline-popup/config/items/cells.js +29 -0
  177. package/esm/plugins/inline-popup/config/items/img.js +35 -5
  178. package/esm/plugins/inline-popup/icons/caption.svg.js +1 -0
  179. package/esm/plugins/inline-popup/icons/headerrow.svg.js +1 -0
  180. package/esm/plugins/inline-popup/inline-popup.js +3 -2
  181. package/esm/plugins/placeholder/placeholder.js +7 -1
  182. package/esm/plugins/resize-cells/resize-cells.d.ts +49 -0
  183. package/esm/plugins/resize-cells/resize-cells.js +247 -13
  184. package/esm/plugins/resizer/resizer.js +13 -2
  185. package/esm/plugins/select-cells/select-cells.d.ts +5 -0
  186. package/esm/plugins/select-cells/select-cells.js +29 -11
  187. package/esm/plugins/tab/cases/index.d.ts +1 -0
  188. package/esm/plugins/tab/cases/index.js +1 -0
  189. package/esm/plugins/tab/cases/on-tab-inside-li.js +3 -1
  190. package/esm/plugins/tab/cases/tab-spaces.d.ts +32 -0
  191. package/esm/plugins/tab/cases/tab-spaces.js +263 -0
  192. package/esm/plugins/tab/config.d.ts +10 -0
  193. package/esm/plugins/tab/config.js +2 -1
  194. package/esm/plugins/tab/tab.js +61 -6
  195. package/esm/types/types.d.ts +16 -0
  196. package/esm/types/uploader.d.ts +6 -0
  197. package/package.json +1 -1
  198. package/types/config.d.ts +44 -1
  199. package/types/core/helpers/utils/align.d.ts +6 -1
  200. package/types/core/helpers/utils/image-caption.d.ts +24 -0
  201. package/types/core/helpers/utils/index.d.ts +1 -0
  202. package/types/core/selection/selection.d.ts +3 -0
  203. package/types/core/ui/helpers/focus-form-field.d.ts +12 -0
  204. package/types/langs/ar.d.ts +2 -0
  205. package/types/langs/az.d.ts +2 -0
  206. package/types/langs/cs_cz.d.ts +2 -0
  207. package/types/langs/de.d.ts +2 -0
  208. package/types/langs/es.d.ts +2 -0
  209. package/types/langs/fa.d.ts +2 -0
  210. package/types/langs/fi.d.ts +2 -0
  211. package/types/langs/fr.d.ts +2 -0
  212. package/types/langs/he.d.ts +2 -0
  213. package/types/langs/hu.d.ts +2 -0
  214. package/types/langs/id.d.ts +2 -0
  215. package/types/langs/it.d.ts +2 -0
  216. package/types/langs/ja.d.ts +2 -0
  217. package/types/langs/ko.d.ts +2 -0
  218. package/types/langs/mn.d.ts +2 -0
  219. package/types/langs/nl.d.ts +2 -0
  220. package/types/langs/no.d.ts +2 -0
  221. package/types/langs/pl.d.ts +2 -0
  222. package/types/langs/pt_br.d.ts +2 -0
  223. package/types/langs/ru.d.ts +2 -0
  224. package/types/langs/sk.d.ts +2 -0
  225. package/types/langs/sv.d.ts +2 -0
  226. package/types/langs/tr.d.ts +2 -0
  227. package/types/langs/ua.d.ts +2 -0
  228. package/types/langs/zh_cn.d.ts +2 -0
  229. package/types/langs/zh_tw.d.ts +2 -0
  230. package/types/modules/table/table.d.ts +27 -0
  231. package/types/plugins/backspace/helpers.d.ts +5 -0
  232. package/types/plugins/clean-html/helpers/index.d.ts +1 -0
  233. package/types/plugins/clean-html/helpers/remove-format/remove-format-for-word.d.ts +16 -0
  234. package/types/plugins/format-block/config.d.ts +13 -0
  235. package/types/plugins/format-block/content-fonts.d.ts +17 -0
  236. package/types/plugins/image-caption/config.d.ts +31 -0
  237. package/types/plugins/image-caption/image-caption.d.ts +140 -0
  238. package/types/plugins/image-processor/image-processor.d.ts +2 -1
  239. package/types/plugins/image-properties/interface.d.ts +6 -0
  240. package/types/plugins/image-properties/readers/align.d.ts +1 -1
  241. package/types/plugins/image-properties/readers/margin.d.ts +1 -1
  242. package/types/plugins/image-properties/readers/size.d.ts +5 -1
  243. package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +2 -0
  244. package/types/plugins/image-properties/writers/caption.d.ts +15 -0
  245. package/types/plugins/image-properties/writers/margin.d.ts +1 -1
  246. package/types/plugins/image-properties/writers/size.d.ts +5 -2
  247. package/types/plugins/indent/helpers.d.ts +9 -0
  248. package/types/plugins/index.d.ts +1 -0
  249. package/types/plugins/resize-cells/resize-cells.d.ts +49 -0
  250. package/types/plugins/select-cells/select-cells.d.ts +5 -0
  251. package/types/plugins/tab/cases/index.d.ts +1 -0
  252. package/types/plugins/tab/cases/tab-spaces.d.ts +32 -0
  253. package/types/plugins/tab/config.d.ts +10 -0
  254. package/types/types/types.d.ts +16 -0
  255. package/types/types/uploader.d.ts +6 -0
@@ -28,7 +28,8 @@ export declare class imageProcessor extends Plugin {
28
28
  * paints the rest of a block image's line with its parent's highlight. See #1528.
29
29
  * Media in a wrapper (`jodit-media`, the resizer's `jodit` for an embed, or
30
30
  * one from `mediaWrappers`) isn't highlighted either, as Safari paints its
31
- * wrapper's whole line, and its resize frame shows it's selected
31
+ * wrapper's whole line, and its resize frame shows it's selected. Nor is
32
+ * a captioned image's caption
32
33
  */
33
34
  private onSelectionChange;
34
35
  protected afterChange(data: {
@@ -17,7 +17,7 @@ import { INVISIBLE_SPACE_REG_EXP, SOURCE_CONSUMER } from "../../core/constants.j
17
17
  import { autobind, cached, debounce, watch } from "../../core/decorators/index.js";
18
18
  import { Dom } from "../../core/dom/dom.js";
19
19
  import { getContainer, pluginSystem } from "../../core/global.js";
20
- import { $$, dataBind, getWrappedMedia } from "../../core/helpers/index.js";
20
+ import { $$, dataBind, getCaptionedImage, getCaptionWrapper, getWrappedMedia } from "../../core/helpers/index.js";
21
21
  import { Plugin } from "../../core/plugin/index.js";
22
22
  import { dataURItoBlob } from "../../modules/uploader/helpers/data-uri-to-blob.js";
23
23
  import "./config.js";
@@ -75,7 +75,8 @@ export class imageProcessor extends Plugin {
75
75
  * paints the rest of a block image's line with its parent's highlight. See #1528.
76
76
  * Media in a wrapper (`jodit-media`, the resizer's `jodit` for an embed, or
77
77
  * one from `mediaWrappers`) isn't highlighted either, as Safari paints its
78
- * wrapper's whole line, and its resize frame shows it's selected
78
+ * wrapper's whole line, and its resize frame shows it's selected. Nor is
79
+ * a captioned image's caption
79
80
  */
80
81
  onSelectionChange() {
81
82
  const { jodit } = this;
@@ -99,9 +100,12 @@ export class imageProcessor extends Plugin {
99
100
  if (elm.src && /^data:/.test(elm.src)) {
100
101
  replaceDataURIToBlobUUID(editor, elm);
101
102
  }
103
+ // A captioned image is selected with its caption, so Delete
104
+ // removes both
102
105
  editor.e.on(elm, 'mousedown touchstart', () => {
106
+ var _a;
103
107
  removeCaretText(elm);
104
- editor.s.select(elm);
108
+ editor.s.select((_a = getCaptionWrapper(editor, elm)) !== null && _a !== void 0 ? _a : elm);
105
109
  });
106
110
  }
107
111
  });
@@ -121,6 +125,7 @@ __decorate([
121
125
  debounce()
122
126
  ], imageProcessor.prototype, "afterChange", null);
123
127
  function isImageSelected(jodit) {
128
+ var _a;
124
129
  const { sel } = jodit.s;
125
130
  if (!sel || !sel.rangeCount) {
126
131
  return false;
@@ -130,7 +135,7 @@ function isImageSelected(jodit) {
130
135
  return (startContainer === endContainer &&
131
136
  endOffset === startOffset + 1 &&
132
137
  (Dom.isTag(node, SELECTED_TAGS) ||
133
- Boolean(getWrappedMedia(jodit, node))) &&
138
+ Boolean((_a = getWrappedMedia(jodit, node)) !== null && _a !== void 0 ? _a : getCaptionedImage(jodit, node))) &&
134
139
  Dom.isOrContains(jodit.editor, startContainer));
135
140
  }
136
141
  /**
@@ -11,6 +11,7 @@ Config.prototype.image = {
11
11
  useImageEditor: true,
12
12
  editTitle: true,
13
13
  editAlt: true,
14
+ showCaptionCheckbox: true,
14
15
  editLink: true,
15
16
  editSize: true,
16
17
  editBorderRadius: true,
@@ -16,7 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
16
16
  import { cache, cached, watch } from "../../core/decorators/index.js";
17
17
  import { Dom } from "../../core/dom/dom.js";
18
18
  import { pluginSystem } from "../../core/global.js";
19
- import { isAbortError, isNumeric, markOwner, toArray } from "../../core/helpers/index.js";
19
+ import { getCaptionWrapper, getImageCaption, isAbortError, isNumeric, markOwner, toArray } from "../../core/helpers/index.js";
20
20
  import { Plugin } from "../../core/plugin/plugin.js";
21
21
  import { Button } from "../../core/ui/button/index.js";
22
22
  import "./config.js";
@@ -59,6 +59,7 @@ export class imageProperties extends Plugin {
59
59
  borderRadius: 0,
60
60
  imageTitle: '',
61
61
  imageAlt: '',
62
+ imageCaption: false,
62
63
  imageLink: '',
63
64
  imageLinkOpenInNewTab: false,
64
65
  imageWidth: 0,
@@ -99,10 +100,13 @@ export class imageProperties extends Plugin {
99
100
  dialog.close();
100
101
  });
101
102
  buttons.remove.onAction(() => {
103
+ var _a;
104
+ const { sourceImage } = this.state;
105
+ const target = (_a = getCaptionWrapper(j, sourceImage)) !== null && _a !== void 0 ? _a : sourceImage;
102
106
  const caret = j.s.createRange();
103
- caret.setStartBefore(this.state.sourceImage);
107
+ caret.setStartBefore(target);
104
108
  caret.collapse(true);
105
- j.s.removeNode(this.state.sourceImage);
109
+ j.s.removeNode(target);
106
110
  dialog.close();
107
111
  j.s.selectRange(caret);
108
112
  });
@@ -118,12 +122,22 @@ export class imageProperties extends Plugin {
118
122
  if (j.isInDestruct || !Dom.isOrContains(j.editor, sourceImage)) {
119
123
  return;
120
124
  }
125
+ const wrapper = getCaptionWrapper(j, sourceImage);
126
+ const caption = getImageCaption(j, wrapper);
127
+ // A blank caption, as one the dialog has added, takes the caret, as
128
+ // the image popup's Caption button does
129
+ if (caption && Dom.isEmpty(caption)) {
130
+ j.s.setCursorIn(caption);
131
+ return;
132
+ }
133
+ // A captioned image is selected with its caption, as a click selects it
134
+ const target = wrapper !== null && wrapper !== void 0 ? wrapper : sourceImage;
121
135
  if (j.o.image.selectImageAfterClose) {
122
- j.s.select(sourceImage);
136
+ j.s.select(target);
123
137
  return;
124
138
  }
125
139
  const caret = j.s.createRange();
126
- caret.setStartAfter(sourceImage);
140
+ caret.setStartAfter(target);
127
141
  caret.collapse(true);
128
142
  j.s.selectRange(caret);
129
143
  });
@@ -13,6 +13,7 @@ export type EditValues = {
13
13
  borderRadius: number;
14
14
  imageTitle: string;
15
15
  imageAlt: string;
16
+ imageCaption: boolean;
16
17
  imageLink: string;
17
18
  imageLinkOpenInNewTab: boolean;
18
19
  imageWidth: number | string;
@@ -59,6 +60,11 @@ export interface ImagePropertiesOptions {
59
60
  * Show edit 'alt' input
60
61
  */
61
62
  editAlt: boolean;
63
+ /**
64
+ * Show the Caption checkbox, which gives the image a caption or takes it
65
+ * away (see `imageCaption`). The caption itself is typed under the image
66
+ */
67
+ showCaptionCheckbox: boolean;
62
68
  /**
63
69
  * Show edit image link's options
64
70
  */
@@ -11,4 +11,4 @@ import type { EditValues } from "../interface";
11
11
  /**
12
12
  * @private
13
13
  */
14
- export declare function readAlign(image: HTMLImageElement, values: EditValues, classes?: Nullable<HAlignClasses>): void;
14
+ export declare function readAlign(image: HTMLElement, values: EditValues, classes?: Nullable<HAlignClasses>): void;
@@ -6,6 +6,7 @@
6
6
  import { getAlignClasses } from "../../../core/helpers/utils/align.js";
7
7
  import { attr } from "../../../core/helpers/utils/attr.js";
8
8
  import { cssInline } from "../../../core/helpers/utils/css.js";
9
+ import { getCaptionWrapper } from "../../../core/helpers/utils/image-caption.js";
9
10
  import { readAlign } from "./align.js";
10
11
  import { readLink } from "./link.js";
11
12
  import { readMargins } from "./margin.js";
@@ -16,7 +17,12 @@ import { readSizes } from "./size.js";
16
17
  */
17
18
  export async function readValuesFromImage(j, state) {
18
19
  const { sourceImage: image, values } = state;
19
- readAlign(image, values, getAlignClasses(j, image));
20
+ // A captioned image's caption element holds its place on the page and
21
+ // its width
22
+ const wrapper = getCaptionWrapper(j, image);
23
+ const box = wrapper !== null && wrapper !== void 0 ? wrapper : image;
24
+ values.imageCaption = Boolean(wrapper);
25
+ readAlign(box, values, getAlignClasses(j, box));
20
26
  // Border radius
21
27
  values.borderRadius =
22
28
  parseInt(cssInline(image, 'border-radius') || '0', 10) || 0;
@@ -31,11 +37,11 @@ export async function readValuesFromImage(j, state) {
31
37
  // Classes
32
38
  values.classes = (attr(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
33
39
  // Margins
34
- readMargins(image, values, state);
40
+ readMargins(box, values, state);
35
41
  // Link
36
42
  readLink(state, j, values);
37
43
  // Src
38
44
  values.imageSrc = attr(image, 'src') || '';
39
45
  // Image size
40
- return readSizes(image, values, state);
46
+ return readSizes(image, values, state, wrapper);
41
47
  }
@@ -5,4 +5,4 @@
5
5
  */
6
6
  import type { EditValues, ImagePropertiesState } from "../interface";
7
7
  /** @private */
8
- export declare function readMargins(image: HTMLImageElement, values: EditValues, state: ImagePropertiesState): void;
8
+ export declare function readMargins(image: HTMLElement, values: EditValues, state: ImagePropertiesState): void;
@@ -3,6 +3,10 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ /**
7
+ * @module plugins/image-properties
8
+ */
9
+ import type { Nullable } from "../../../types/index";
6
10
  import type { EditValues, ImagePropertiesState } from "../interface";
7
11
  /** @private */
8
- export declare function readSizes(image: HTMLImageElement, values: EditValues, state: ImagePropertiesState): Promise<void>;
12
+ export declare function readSizes(image: HTMLImageElement, values: EditValues, state: ImagePropertiesState, captionWrapper?: Nullable<HTMLElement>): Promise<void>;
@@ -3,22 +3,21 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- /**
7
- * @module plugins/image-properties
8
- */
9
6
  import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
10
7
  import { attr } from "../../../core/helpers/utils/attr.js";
11
8
  import { css } from "../../../core/helpers/utils/css.js";
12
9
  import { normalSizeFromString } from "../utils/utils.js";
13
10
  /** @private */
14
- export async function readSizes(image, values, state) {
11
+ export async function readSizes(image, values, state, captionWrapper) {
15
12
  try {
16
13
  await image.decode();
17
14
  }
18
15
  catch (e) {
19
16
  console.error(e);
20
17
  }
21
- const width = css(image, 'width', true) || attr(image, 'width') || false;
18
+ const width = css(captionWrapper !== null && captionWrapper !== void 0 ? captionWrapper : image, 'width', true) ||
19
+ attr(image, 'width') ||
20
+ false;
22
21
  const height = css(image, 'height', true) || attr(image, 'height') || false;
23
22
  values.imageWidth =
24
23
  width !== false
@@ -31,6 +31,8 @@ export declare class UIImageMainTab extends UIGroup<IJodit> {
31
31
  protected onTitleChange(): void;
32
32
  protected onStateAltChange(): void;
33
33
  protected onAltChange(): void;
34
+ protected onStateCaptionChange(): void;
35
+ protected onCaptionChange(): void;
34
36
  protected onStateImageLinkChange(): void;
35
37
  protected onImageLinkChange(): void;
36
38
  protected onStateImageLinkOpenInNewTabChange(): void;
@@ -50,6 +50,12 @@ let UIImageMainTab = class UIImageMainTab extends UIGroup {
50
50
  <label>~Alternative~</label>
51
51
  <input type="text" class="jodit-input &__imageAlt"/>
52
52
  </div>
53
+ <div class="jodit-form__group &__captionCheckbox">
54
+ <label class="jodit_vertical_middle">
55
+ <input type="checkbox" class="jodit-checkbox &__imageCaption"/>
56
+ <span>~Caption~</span>
57
+ </label>
58
+ </div>
53
59
  <div class="jodit-form__group &__editLink">
54
60
  <label>~Link~</label>
55
61
  <input type="text" class="jodit-input &__imageLink"/>
@@ -96,6 +102,13 @@ let UIImageMainTab = class UIImageMainTab extends UIGroup {
96
102
  onAltChange() {
97
103
  this.state.values.imageAlt = this.getElm('imageAlt').value;
98
104
  }
105
+ onStateCaptionChange() {
106
+ const caption = this.getElm('imageCaption');
107
+ caption.checked = this.state.values.imageCaption;
108
+ }
109
+ onCaptionChange() {
110
+ this.state.values.imageCaption = this.getElm('imageCaption').checked;
111
+ }
99
112
  onStateImageLinkChange() {
100
113
  const imageLink = this.getElm('imageLink');
101
114
  imageLink.value = this.state.values.imageLink;
@@ -117,6 +130,7 @@ let UIImageMainTab = class UIImageMainTab extends UIGroup {
117
130
  ['editSrc', 'editSrc'],
118
131
  ['editTitle', 'editTitle'],
119
132
  ['editAlt', 'editAlt'],
133
+ ['showCaptionCheckbox', 'captionCheckbox'],
120
134
  ['editLink', 'editLink'],
121
135
  ['editLink', 'editLinkTarget'],
122
136
  ['useImageEditor', 'editImage']
@@ -158,6 +172,12 @@ __decorate([
158
172
  __decorate([
159
173
  watch('imageAlt:change')
160
174
  ], UIImageMainTab.prototype, "onAltChange", null);
175
+ __decorate([
176
+ watch('state.values.imageCaption')
177
+ ], UIImageMainTab.prototype, "onStateCaptionChange", null);
178
+ __decorate([
179
+ watch('imageCaption:change')
180
+ ], UIImageMainTab.prototype, "onCaptionChange", null);
161
181
  __decorate([
162
182
  watch('state.values.imageLink')
163
183
  ], UIImageMainTab.prototype, "onStateImageLinkChange", null);
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module plugins/image-properties
8
+ */
9
+ import type { IJodit } from "../../../types/index";
10
+ /**
11
+ * Gives the image a caption or takes it away, and returns the element that
12
+ * holds the image's place on the page: the caption's, or the image
13
+ * @private
14
+ */
15
+ export declare function applyCaption(j: IJodit, image: HTMLImageElement, imageCaption: boolean): HTMLElement;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { getCaptionWrapper } from "../../../core/helpers/utils/image-caption.js";
7
+ /**
8
+ * Gives the image a caption or takes it away, and returns the element that
9
+ * holds the image's place on the page: the caption's, or the image
10
+ * @private
11
+ */
12
+ export function applyCaption(j, image, imageCaption) {
13
+ var _a;
14
+ if (j.o.image.showCaptionCheckbox) {
15
+ j.e.fire('toggleImageCaption', image, imageCaption);
16
+ }
17
+ return (_a = getCaptionWrapper(j, image)) !== null && _a !== void 0 ? _a : image;
18
+ }
@@ -4,8 +4,9 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { Dom } from "../../../core/dom/dom.js";
7
- import { attr, getAlignClasses, hAlignElement } from "../../../core/helpers/utils/index.js";
7
+ import { attr, getAlignClasses, getCaptionWrapper, hAlignElement } from "../../../core/helpers/utils/index.js";
8
8
  import { css } from "../../../core/helpers/utils/css.js";
9
+ import { applyCaption } from "./caption.js";
9
10
  import { applyLink } from "./link.js";
10
11
  import { applyMargin } from "./margin.js";
11
12
  import { applySize } from "./size.js";
@@ -14,7 +15,8 @@ import { applySize } from "./size.js";
14
15
  * @private
15
16
  */
16
17
  export function applyValuesToImage(j, state, image) {
17
- const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
18
+ var _a;
19
+ const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageCaption, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
18
20
  const opt = j.o;
19
21
  // styles
20
22
  if (opt.image.editStyle) {
@@ -25,7 +27,7 @@ export function applyValuesToImage(j, state, image) {
25
27
  attr(image, 'src', imageSrc);
26
28
  }
27
29
  else {
28
- Dom.safeRemove(image);
30
+ Dom.safeRemove((_a = getCaptionWrapper(j, image)) !== null && _a !== void 0 ? _a : image);
29
31
  return;
30
32
  }
31
33
  // Border radius
@@ -36,19 +38,22 @@ export function applyValuesToImage(j, state, image) {
36
38
  attr(image, 'alt', imageAlt || null);
37
39
  // Link
38
40
  applyLink(j, image, imageLink, imageLinkOpenInNewTab);
39
- // Size
40
- applySize(image, imageWidth, imageHeight, state.sizeIsLocked);
41
- // Margin
42
- if (j.o.image.editMargins) {
43
- applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, state.marginIsLocked);
44
- }
45
41
  if (opt.image.editClass) {
46
42
  attr(image, 'class', classes || null);
47
43
  }
48
44
  if (opt.image.editId) {
49
45
  attr(image, 'id', id || null);
50
46
  }
47
+ // The caption's element takes the image's place on the page and its width,
48
+ // so it's added or taken away after the image's own style and classes
49
+ const box = applyCaption(j, image, imageCaption);
50
+ // Size
51
+ applySize(image, imageWidth, imageHeight, state.sizeIsLocked, box);
52
+ // Margin
53
+ if (j.o.image.editMargins) {
54
+ applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, box, state.marginIsLocked);
55
+ }
51
56
  if (opt.image.editAlign) {
52
- hAlignElement(image, align, getAlignClasses(j, image));
57
+ hAlignElement(box, align, getAlignClasses(j, box));
53
58
  }
54
59
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { Dom } from "../../../core/dom/dom.js";
7
7
  import { attr } from "../../../core/helpers/utils/attr.js";
8
+ import { getCaptionWrapper } from "../../../core/helpers/utils/image-caption.js";
8
9
  /** @private */
9
10
  export function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
10
11
  // Link
@@ -22,8 +23,12 @@ export function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
22
23
  attr(link, 'rel', relParts.length ? relParts.join(' ') : null);
23
24
  }
24
25
  }
25
- else {
26
- if (link && link.parentNode) {
26
+ else if (link && link.parentNode) {
27
+ // Froala keeps a linked image's caption inside the link
28
+ if (getCaptionWrapper(j, image)) {
29
+ Dom.unwrap(link);
30
+ }
31
+ else {
27
32
  Dom.replace(link, image, undefined, false, true);
28
33
  }
29
34
  }
@@ -8,4 +8,4 @@
8
8
  */
9
9
  import type { IJodit } from "../../../types/index";
10
10
  /** @private */
11
- export declare function applyMargin(j: IJodit, marginTop: number | string, marginRight: number | string, marginBottom: number | string, marginLeft: number | string, image: HTMLImageElement, marginIsLocked: boolean): void;
11
+ export declare function applyMargin(j: IJodit, marginTop: number | string, marginRight: number | string, marginBottom: number | string, marginLeft: number | string, image: HTMLElement, marginIsLocked: boolean): void;
@@ -3,5 +3,8 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- /** @private */
7
- export declare function applySize(image: HTMLImageElement, imageWidth: number | string, imageHeight: number | string, sizeIsLocked: boolean): void;
6
+ /**
7
+ * A captioned image fills its caption's element, `box`, which takes the width
8
+ * @private
9
+ */
10
+ export declare function applySize(image: HTMLImageElement, imageWidth: number | string, imageHeight: number | string, sizeIsLocked: boolean, box?: HTMLElement): void;
@@ -10,8 +10,22 @@ import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
10
10
  import { attr } from "../../../core/helpers/utils/attr.js";
11
11
  import { css } from "../../../core/helpers/utils/css.js";
12
12
  import { normalSizeToString } from "../utils/utils.js";
13
- /** @private */
14
- export function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
13
+ /**
14
+ * A captioned image fills its caption's element, `box`, which takes the width
15
+ * @private
16
+ */
17
+ export function applySize(image, imageWidth, imageHeight, sizeIsLocked, box = image) {
18
+ if (box !== image) {
19
+ const width = imageWidth ? normalSizeToString(imageWidth) : null;
20
+ css(box, 'width', width);
21
+ css(image, {
22
+ width: width && '100%',
23
+ height: sizeIsLocked || !imageHeight
24
+ ? null
25
+ : normalSizeToString(imageHeight)
26
+ });
27
+ return;
28
+ }
15
29
  // Size
16
30
  if (imageWidth !== image.offsetWidth ||
17
31
  imageHeight !== image.offsetHeight) {
@@ -3,8 +3,17 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ /**
7
+ * @module plugins/indent
8
+ */
9
+ import type { IJodit } from "../../types/index";
6
10
  /**
7
11
  * Get style rule key for current direction
8
12
  * @internal
9
13
  */
10
14
  export declare const getKey: (direction: string, box: HTMLElement) => "marginLeft" | "marginRight" | "paddingLeft" | "paddingRight";
15
+ /**
16
+ * Indents or outdents a box by `indentMargin`
17
+ * @internal
18
+ */
19
+ export declare const applyIndentToBox: (processedElements: Set<HTMLElement>, currentBox: HTMLElement, editor: IJodit, command: string) => void;
@@ -3,12 +3,32 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- /**
7
- * @module plugins/indent
8
- */
9
6
  import { Dom } from "../../core/dom/dom.js";
7
+ import { attr } from "../../core/helpers/utils/index.js";
8
+ import { css, cssInline } from "../../core/helpers/utils/css.js";
10
9
  /**
11
10
  * Get style rule key for current direction
12
11
  * @internal
13
12
  */
14
13
  export const getKey = (direction, box) => `${Dom.isCell(box) ? 'padding' : 'margin'}${direction === 'rtl' ? 'Right' : 'Left'}`;
14
+ /**
15
+ * Indents or outdents a box by `indentMargin`
16
+ * @internal
17
+ */
18
+ export const applyIndentToBox = (processedElements, currentBox, editor, command) => {
19
+ if (!currentBox) {
20
+ return;
21
+ }
22
+ if (processedElements.has(currentBox)) {
23
+ return;
24
+ }
25
+ const key = getKey(editor.o.direction, currentBox);
26
+ processedElements.add(currentBox);
27
+ const current = cssInline(currentBox, key);
28
+ let value = current ? parseInt(current, 10) : 0;
29
+ value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
30
+ css(currentBox, key, value > 0 ? value : '');
31
+ if (!attr(currentBox, 'style')) {
32
+ attr(currentBox, 'style', null);
33
+ }
34
+ };
@@ -6,27 +6,9 @@
6
6
  import { BR } from "../../core/constants.js";
7
7
  import { Dom } from "../../core/dom/index.js";
8
8
  import { pluginSystem } from "../../core/global.js";
9
- import { attr, call } from "../../core/helpers/utils/index.js";
10
- import { css, cssInline } from "../../core/helpers/utils/css.js";
9
+ import { call } from "../../core/helpers/utils/index.js";
11
10
  import "./config.js";
12
- import { getKey } from "./helpers.js";
13
- const applyIndentToBox = (processedElements, currentBox, editor, command) => {
14
- if (!currentBox) {
15
- return;
16
- }
17
- if (processedElements.has(currentBox)) {
18
- return;
19
- }
20
- const key = getKey(editor.o.direction, currentBox);
21
- processedElements.add(currentBox);
22
- const current = cssInline(currentBox, key);
23
- let value = current ? parseInt(current, 10) : 0;
24
- value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
25
- css(currentBox, key, value > 0 ? value : '');
26
- if (!attr(currentBox, 'style')) {
27
- attr(currentBox, 'style', null);
28
- }
29
- };
11
+ import { applyIndentToBox } from "./helpers.js";
30
12
  /**
31
13
  * Indents the line containing the selection or insertion point.
32
14
  */
@@ -30,6 +30,7 @@ import "./hotkeys/hotkeys";
30
30
  import "./hr/hr";
31
31
  import "./iframe/iframe";
32
32
  import "./image/image";
33
+ import "./image-caption/image-caption";
33
34
  import "./image-processor/image-processor";
34
35
  import "./image-properties/image-properties";
35
36
  import "./indent/indent";
@@ -13,6 +13,8 @@ import img from "./items/img.js";
13
13
  import toolbar from "./items/toolbar.js";
14
14
  import * as addcolumn from "../icons/addcolumn.svg.js";
15
15
  import * as addrow from "../icons/addrow.svg.js";
16
+ import * as caption from "../icons/caption.svg.js";
17
+ import * as headerrow from "../icons/headerrow.svg.js";
16
18
  import * as merge from "../icons/merge.svg.js";
17
19
  import * as splitg from "../icons/splitg.svg.js";
18
20
  import * as splitv from "../icons/splitv.svg.js";
@@ -24,6 +26,8 @@ Config.prototype.toolbarInlineDisableFor = [];
24
26
  Config.prototype.toolbarInlineDisabledButtons = ['source'];
25
27
  Icon.set('addcolumn', addcolumn.default)
26
28
  .set('addrow', addrow.default)
29
+ .set('caption', caption.default)
30
+ .set('headerrow', headerrow.default)
27
31
  .set('merge', merge.default)
28
32
  .set('th', th.default)
29
33
  .set('splitg', splitg.default)
@@ -3,7 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ import { Dom } from "../../../../core/dom/dom.js";
6
7
  import { isJoditObject, isString } from "../../../../core/helpers/checker/index.js";
8
+ import { position } from "../../../../core/helpers/size/position.js";
7
9
  import { css } from "../../../../core/helpers/utils/css.js";
8
10
  const cmd = (control) => control.args && isString(control.args[0])
9
11
  ? control.args[0].toLowerCase()
@@ -79,6 +81,33 @@ export default [
79
81
  },
80
82
  tooltip: 'Add row'
81
83
  },
84
+ {
85
+ name: 'headerrow',
86
+ exec: (editor, table) => {
87
+ if (!isJoditObject(editor) || !Dom.isTag(table, 'table')) {
88
+ return;
89
+ }
90
+ editor.execCommand('tableheaderrow', false, table);
91
+ const [cell] = editor
92
+ .getInstance('Table', editor.o)
93
+ .getAllSelectedCells();
94
+ // Beside the cell that replaced the one it opened for
95
+ if (cell) {
96
+ editor.e.fire('showPopup', table, () => position(cell, editor), 'cells');
97
+ }
98
+ // The popup stays open, so the button shows the new state
99
+ return true;
100
+ },
101
+ isActive: (editor, button) => Dom.isTag(button.target, 'table') &&
102
+ editor
103
+ .getInstance('Table', editor.o)
104
+ .hasHeaderRow(button.target),
105
+ isDisabled: (editor, button) => !Dom.isTag(button.target, 'table') ||
106
+ !editor
107
+ .getInstance('Table', editor.o)
108
+ .canToggleHeaderRow(button.target),
109
+ tooltip: 'Header row'
110
+ },
82
111
  {
83
112
  name: 'deleteTable',
84
113
  icon: 'bin',