jodit 4.18.12 → 4.19.4
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.
- package/CHANGELOG.md +46 -0
- package/es2015/jodit.css +10 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +18 -12
- package/es2015/jodit.js +2464 -300
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +18 -12
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +18 -12
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +18 -12
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +10 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +26 -19
- package/es2021/jodit.js +2426 -297
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +26 -19
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +10 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +29 -22
- package/es2021.en/jodit.js +2400 -271
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +29 -22
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +11 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +2823 -360
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +44 -1
- package/esm/config.js +2 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/dom/dom.js +4 -2
- package/esm/core/event-emitter/event-emitter.js +1 -0
- package/esm/core/helpers/utils/align.d.ts +6 -1
- package/esm/core/helpers/utils/align.js +22 -12
- package/esm/core/helpers/utils/image-caption.d.ts +24 -0
- package/esm/core/helpers/utils/image-caption.js +43 -0
- package/esm/core/helpers/utils/index.d.ts +1 -0
- package/esm/core/helpers/utils/index.js +1 -0
- package/esm/core/selection/selection.d.ts +3 -0
- package/esm/core/selection/selection.js +20 -5
- package/esm/core/ui/helpers/focus-form-field.d.ts +12 -0
- package/esm/core/ui/helpers/focus-form-field.js +21 -0
- package/esm/jodit.js +18 -2
- package/esm/langs/ar.d.ts +2 -0
- package/esm/langs/ar.js +2 -0
- package/esm/langs/az.d.ts +2 -0
- package/esm/langs/az.js +2 -0
- package/esm/langs/cs_cz.d.ts +2 -0
- package/esm/langs/cs_cz.js +2 -0
- package/esm/langs/de.d.ts +2 -0
- package/esm/langs/de.js +2 -0
- package/esm/langs/es.d.ts +2 -0
- package/esm/langs/es.js +2 -0
- package/esm/langs/fa.d.ts +2 -0
- package/esm/langs/fa.js +2 -0
- package/esm/langs/fi.d.ts +2 -0
- package/esm/langs/fi.js +2 -0
- package/esm/langs/fr.d.ts +2 -0
- package/esm/langs/fr.js +2 -0
- package/esm/langs/he.d.ts +2 -0
- package/esm/langs/he.js +2 -0
- package/esm/langs/hu.d.ts +2 -0
- package/esm/langs/hu.js +2 -0
- package/esm/langs/id.d.ts +2 -0
- package/esm/langs/id.js +2 -0
- package/esm/langs/it.d.ts +2 -0
- package/esm/langs/it.js +2 -0
- package/esm/langs/ja.d.ts +2 -0
- package/esm/langs/ja.js +2 -0
- package/esm/langs/ko.d.ts +2 -0
- package/esm/langs/ko.js +2 -0
- package/esm/langs/mn.d.ts +2 -0
- package/esm/langs/mn.js +2 -0
- package/esm/langs/nl.d.ts +2 -0
- package/esm/langs/nl.js +2 -0
- package/esm/langs/no.d.ts +2 -0
- package/esm/langs/no.js +2 -0
- package/esm/langs/pl.d.ts +2 -0
- package/esm/langs/pl.js +2 -0
- package/esm/langs/pt_br.d.ts +2 -0
- package/esm/langs/pt_br.js +2 -0
- package/esm/langs/ru.d.ts +2 -0
- package/esm/langs/ru.js +2 -0
- package/esm/langs/sk.d.ts +2 -0
- package/esm/langs/sk.js +2 -0
- package/esm/langs/sv.d.ts +2 -0
- package/esm/langs/sv.js +2 -0
- package/esm/langs/tr.d.ts +2 -0
- package/esm/langs/tr.js +2 -0
- package/esm/langs/ua.d.ts +2 -0
- package/esm/langs/ua.js +2 -0
- package/esm/langs/zh_cn.d.ts +2 -0
- package/esm/langs/zh_cn.js +2 -0
- package/esm/langs/zh_tw.d.ts +2 -0
- package/esm/langs/zh_tw.js +2 -0
- package/esm/modules/table/table.d.ts +27 -0
- package/esm/modules/table/table.js +110 -2
- package/esm/modules/toolbar/button/button.js +11 -3
- package/esm/modules/uploader/helpers/send-files.js +3 -1
- package/esm/modules/widget/tabs/tabs.js +2 -0
- package/esm/plugins/all.d.ts +1 -0
- package/esm/plugins/all.js +1 -0
- package/esm/plugins/backspace/backspace.js +17 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +1 -11
- package/esm/plugins/backspace/helpers.d.ts +5 -0
- package/esm/plugins/backspace/helpers.js +11 -0
- package/esm/plugins/clean-html/clean-html.js +2 -2
- package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
- package/esm/plugins/clean-html/helpers/index.js +1 -0
- package/esm/plugins/clean-html/helpers/remove-format/remove-format-for-word.d.ts +16 -0
- package/esm/plugins/clean-html/helpers/remove-format/remove-format-for-word.js +109 -0
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +4 -2
- package/esm/plugins/format-block/config.d.ts +13 -0
- package/esm/plugins/format-block/config.js +38 -1
- package/esm/plugins/format-block/content-fonts.d.ts +17 -0
- package/esm/plugins/format-block/content-fonts.js +156 -0
- package/esm/plugins/image-caption/config.d.ts +31 -0
- package/esm/plugins/image-caption/config.js +11 -0
- package/esm/plugins/image-caption/image-caption.d.ts +140 -0
- package/esm/plugins/image-caption/image-caption.js +799 -0
- package/esm/plugins/image-processor/image-processor.d.ts +2 -1
- package/esm/plugins/image-processor/image-processor.js +9 -4
- package/esm/plugins/image-properties/config.js +1 -0
- package/esm/plugins/image-properties/image-properties.js +19 -5
- package/esm/plugins/image-properties/interface.d.ts +6 -0
- package/esm/plugins/image-properties/readers/align.d.ts +1 -1
- package/esm/plugins/image-properties/readers/index.js +9 -3
- package/esm/plugins/image-properties/readers/margin.d.ts +1 -1
- package/esm/plugins/image-properties/readers/size.d.ts +5 -1
- package/esm/plugins/image-properties/readers/size.js +4 -5
- package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +2 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.js +20 -0
- package/esm/plugins/image-properties/writers/caption.d.ts +15 -0
- package/esm/plugins/image-properties/writers/caption.js +18 -0
- package/esm/plugins/image-properties/writers/index.js +15 -10
- package/esm/plugins/image-properties/writers/link.js +7 -2
- package/esm/plugins/image-properties/writers/margin.d.ts +1 -1
- package/esm/plugins/image-properties/writers/size.d.ts +5 -2
- package/esm/plugins/image-properties/writers/size.js +16 -2
- package/esm/plugins/indent/helpers.d.ts +9 -0
- package/esm/plugins/indent/helpers.js +23 -3
- package/esm/plugins/indent/indent.js +2 -20
- package/esm/plugins/index.d.ts +1 -0
- package/esm/plugins/inline-popup/config/config.js +4 -0
- package/esm/plugins/inline-popup/config/items/cells.js +29 -0
- package/esm/plugins/inline-popup/config/items/img.js +35 -5
- package/esm/plugins/inline-popup/icons/caption.svg.js +1 -0
- package/esm/plugins/inline-popup/icons/headerrow.svg.js +1 -0
- package/esm/plugins/inline-popup/inline-popup.js +3 -2
- package/esm/plugins/placeholder/placeholder.js +7 -1
- package/esm/plugins/resize-cells/resize-cells.d.ts +49 -0
- package/esm/plugins/resize-cells/resize-cells.js +247 -13
- package/esm/plugins/resizer/resizer.js +13 -2
- package/esm/plugins/select-cells/select-cells.d.ts +5 -0
- package/esm/plugins/select-cells/select-cells.js +29 -11
- package/esm/plugins/tab/cases/index.d.ts +1 -0
- package/esm/plugins/tab/cases/index.js +1 -0
- package/esm/plugins/tab/cases/on-tab-inside-li.js +3 -1
- package/esm/plugins/tab/cases/tab-spaces.d.ts +32 -0
- package/esm/plugins/tab/cases/tab-spaces.js +263 -0
- package/esm/plugins/tab/config.d.ts +10 -0
- package/esm/plugins/tab/config.js +2 -1
- package/esm/plugins/tab/tab.js +61 -6
- package/esm/types/types.d.ts +16 -0
- package/esm/types/uploader.d.ts +6 -0
- package/package.json +1 -1
- package/types/config.d.ts +44 -1
- package/types/core/helpers/utils/align.d.ts +6 -1
- package/types/core/helpers/utils/image-caption.d.ts +24 -0
- package/types/core/helpers/utils/index.d.ts +1 -0
- package/types/core/selection/selection.d.ts +3 -0
- package/types/core/ui/helpers/focus-form-field.d.ts +12 -0
- package/types/langs/ar.d.ts +2 -0
- package/types/langs/az.d.ts +2 -0
- package/types/langs/cs_cz.d.ts +2 -0
- package/types/langs/de.d.ts +2 -0
- package/types/langs/es.d.ts +2 -0
- package/types/langs/fa.d.ts +2 -0
- package/types/langs/fi.d.ts +2 -0
- package/types/langs/fr.d.ts +2 -0
- package/types/langs/he.d.ts +2 -0
- package/types/langs/hu.d.ts +2 -0
- package/types/langs/id.d.ts +2 -0
- package/types/langs/it.d.ts +2 -0
- package/types/langs/ja.d.ts +2 -0
- package/types/langs/ko.d.ts +2 -0
- package/types/langs/mn.d.ts +2 -0
- package/types/langs/nl.d.ts +2 -0
- package/types/langs/no.d.ts +2 -0
- package/types/langs/pl.d.ts +2 -0
- package/types/langs/pt_br.d.ts +2 -0
- package/types/langs/ru.d.ts +2 -0
- package/types/langs/sk.d.ts +2 -0
- package/types/langs/sv.d.ts +2 -0
- package/types/langs/tr.d.ts +2 -0
- package/types/langs/ua.d.ts +2 -0
- package/types/langs/zh_cn.d.ts +2 -0
- package/types/langs/zh_tw.d.ts +2 -0
- package/types/modules/table/table.d.ts +27 -0
- package/types/plugins/backspace/helpers.d.ts +5 -0
- package/types/plugins/clean-html/helpers/index.d.ts +1 -0
- package/types/plugins/clean-html/helpers/remove-format/remove-format-for-word.d.ts +16 -0
- package/types/plugins/format-block/config.d.ts +13 -0
- package/types/plugins/format-block/content-fonts.d.ts +17 -0
- package/types/plugins/image-caption/config.d.ts +31 -0
- package/types/plugins/image-caption/image-caption.d.ts +140 -0
- package/types/plugins/image-processor/image-processor.d.ts +2 -1
- package/types/plugins/image-properties/interface.d.ts +6 -0
- package/types/plugins/image-properties/readers/align.d.ts +1 -1
- package/types/plugins/image-properties/readers/margin.d.ts +1 -1
- package/types/plugins/image-properties/readers/size.d.ts +5 -1
- package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +2 -0
- package/types/plugins/image-properties/writers/caption.d.ts +15 -0
- package/types/plugins/image-properties/writers/margin.d.ts +1 -1
- package/types/plugins/image-properties/writers/size.d.ts +5 -2
- package/types/plugins/indent/helpers.d.ts +9 -0
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/resize-cells/resize-cells.d.ts +49 -0
- package/types/plugins/select-cells/select-cells.d.ts +5 -0
- package/types/plugins/tab/cases/index.d.ts +1 -0
- package/types/plugins/tab/cases/tab-spaces.d.ts +32 -0
- package/types/plugins/tab/config.d.ts +10 -0
- package/types/types/types.d.ts +16 -0
- package/types/types/uploader.d.ts +6 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/config.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { IDictionary } from "./types/index";
|
|
|
10
10
|
import type { Nullable } from "./types/index";
|
|
11
11
|
import type { IJodit } from "./types/index";
|
|
12
12
|
import type { IUploaderData } from "./types/index";
|
|
13
|
+
import type { ImageCaptionMarkup } from "./types/index";
|
|
13
14
|
import type { ImagePropertiesOptions } from "./plugins/image-properties/interface";
|
|
14
15
|
import type { IControlType } from "./types/index";
|
|
15
16
|
import type { formTemplate } from "./plugins/link/template";
|
|
@@ -653,7 +654,8 @@ declare class Config implements IViewOptions {
|
|
|
653
654
|
* spaces. An alignment can also list several such sets, to recognise each
|
|
654
655
|
* of them; aligning writes the first. A media wrapper (see
|
|
655
656
|
* `mediaWrappers`), and Jodit's own `jodit` and `jodit-media` wrappers,
|
|
656
|
-
* are aligned with the classes for the media in them
|
|
657
|
+
* are aligned with the classes for the media in them, and a captioned
|
|
658
|
+
* image's wrapper (see `imageCaption`) with those for `img`.
|
|
657
659
|
*
|
|
658
660
|
* ```javascript
|
|
659
661
|
* const media = {
|
|
@@ -1335,6 +1337,17 @@ interface Config {
|
|
|
1335
1337
|
};
|
|
1336
1338
|
};
|
|
1337
1339
|
}
|
|
1340
|
+
interface Config {
|
|
1341
|
+
formatBlock: {
|
|
1342
|
+
/**
|
|
1343
|
+
* The CSS properties each preview in the Paragraph list copies from
|
|
1344
|
+
* how the content shows its tag, so the list looks like the content.
|
|
1345
|
+
* Lengths become `em`, and size and line height stay with the list.
|
|
1346
|
+
* An empty list, the default, keeps the toolbar's styles.
|
|
1347
|
+
*/
|
|
1348
|
+
previewProperties: string[];
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1338
1351
|
interface Config {
|
|
1339
1352
|
/**
|
|
1340
1353
|
* Open WYSIWYG in full screen
|
|
@@ -1442,6 +1455,26 @@ interface Config {
|
|
|
1442
1455
|
*/
|
|
1443
1456
|
iframeSandbox: string | null;
|
|
1444
1457
|
}
|
|
1458
|
+
interface Config {
|
|
1459
|
+
/**
|
|
1460
|
+
* The elements a captioned image is kept in, read from the content and
|
|
1461
|
+
* written by the Caption button in the image popup and the Caption
|
|
1462
|
+
* checkbox in the image properties dialog. The default is a `<figure>`
|
|
1463
|
+
* holding the image, or its link, and a `<figcaption>`. Content from
|
|
1464
|
+
* another editor can be captioned in its own way, as Froala's is:
|
|
1465
|
+
*
|
|
1466
|
+
* ```javascript
|
|
1467
|
+
* Jodit.make('#editor', {
|
|
1468
|
+
* imageCaption: {
|
|
1469
|
+
* wrapper: { tag: 'span', className: 'fr-img-caption' },
|
|
1470
|
+
* inner: { tag: 'span', className: 'fr-img-wrap' },
|
|
1471
|
+
* caption: { tag: 'span', className: 'fr-inner' }
|
|
1472
|
+
* }
|
|
1473
|
+
* });
|
|
1474
|
+
* ```
|
|
1475
|
+
*/
|
|
1476
|
+
imageCaption: ImageCaptionMarkup;
|
|
1477
|
+
}
|
|
1445
1478
|
interface Config {
|
|
1446
1479
|
/**
|
|
1447
1480
|
* Options for processing images inserted into the editor (e.g. converting base64 data URIs to Blob URLs).
|
|
@@ -2025,6 +2058,16 @@ interface Config {
|
|
|
2025
2058
|
* Pressing Tab inside LI will add an internal list
|
|
2026
2059
|
*/
|
|
2027
2060
|
tabInsideLiInsertNewList: boolean;
|
|
2061
|
+
/**
|
|
2062
|
+
* Outside table cells and the list items Tab already nests, Tab at a
|
|
2063
|
+
* caret inserts this many non-breaking spaces, and Shift+Tab or
|
|
2064
|
+
* Backspace takes them out again. In a list's first item Tab
|
|
2065
|
+
* indents the list. Tab and Shift+Tab with a selection indent and
|
|
2066
|
+
* outdent it, and a tab in pasted text becomes the same spaces.
|
|
2067
|
+
* Neither key moves the focus on: Escape and then Tab does. 0
|
|
2068
|
+
* leaves Tab to the browser, which moves the focus on
|
|
2069
|
+
*/
|
|
2070
|
+
spaces: number;
|
|
2028
2071
|
};
|
|
2029
2072
|
}
|
|
2030
2073
|
interface Config {
|
package/esm/config.js
CHANGED
|
@@ -758,7 +758,8 @@ class Config {
|
|
|
758
758
|
* spaces. An alignment can also list several such sets, to recognise each
|
|
759
759
|
* of them; aligning writes the first. A media wrapper (see
|
|
760
760
|
* `mediaWrappers`), and Jodit's own `jodit` and `jodit-media` wrappers,
|
|
761
|
-
* are aligned with the classes for the media in them
|
|
761
|
+
* are aligned with the classes for the media in them, and a captioned
|
|
762
|
+
* image's wrapper (see `imageCaption`) with those for `img`.
|
|
762
763
|
*
|
|
763
764
|
* ```javascript
|
|
764
765
|
* const media = {
|
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
export const APP_VERSION = "4.
|
|
6
|
+
export const APP_VERSION = "4.19.4";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/esm/core/dom/dom.js
CHANGED
|
@@ -204,9 +204,11 @@ export class Dom {
|
|
|
204
204
|
* The node is editable
|
|
205
205
|
*/
|
|
206
206
|
static isContentEditable(node, root) {
|
|
207
|
+
// The nearest element that says decides, as an editable caption inside
|
|
208
|
+
// a non-editable figure is editable
|
|
209
|
+
const host = Dom.closest(node, elm => Dom.isElement(elm) && elm.hasAttribute('contenteditable'), root);
|
|
207
210
|
return (Dom.isNode(node) &&
|
|
208
|
-
|
|
209
|
-
elm.getAttribute('contenteditable') === 'false', root));
|
|
211
|
+
(host === null || host === void 0 ? void 0 : host.getAttribute('contenteditable')) !== 'false');
|
|
210
212
|
}
|
|
211
213
|
static isEmpty(node, condNoEmptyElement = NO_EMPTY_TAGS) {
|
|
212
214
|
if (!node) {
|
|
@@ -10,7 +10,7 @@ import type { HAlignClasses, IJodit, ImageHAlign, Nullable } from "../../../type
|
|
|
10
10
|
/**
|
|
11
11
|
* The class names to align `elm` with: `alignClasses` for its tag, or for the
|
|
12
12
|
* media in it when it wraps media (a `mediaWrappers` wrapper, `jodit` or
|
|
13
|
-
* `jodit-media`)
|
|
13
|
+
* `jodit-media`) or a captioned image (see `imageCaption`)
|
|
14
14
|
*/
|
|
15
15
|
export declare function getAlignClasses(jodit: IJodit, elm: Nullable<HTMLElement>): Nullable<HAlignClasses>;
|
|
16
16
|
/**
|
|
@@ -18,6 +18,11 @@ export declare function getAlignClasses(jodit: IJodit, elm: Nullable<HTMLElement
|
|
|
18
18
|
* when they are given
|
|
19
19
|
*/
|
|
20
20
|
export declare function hAlignElement(image: HTMLElement, align: ImageHAlign, classes?: Nullable<HAlignClasses>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Remove the alignment `hAlignElement` set on an element, with the classes of
|
|
23
|
+
* every alignment in `classes`
|
|
24
|
+
*/
|
|
25
|
+
export declare function clearHAlign(elm: HTMLElement, classes?: Nullable<HAlignClasses>): void;
|
|
21
26
|
/**
|
|
22
27
|
* The alignment `hAlignElement` has set on an element
|
|
23
28
|
*/
|
|
@@ -7,6 +7,7 @@ import { Dom } from "../../dom/index.js";
|
|
|
7
7
|
import { isArray } from "../checker/is-array.js";
|
|
8
8
|
import { attr } from "./attr.js";
|
|
9
9
|
import { clearCenterAlign, css, cssInline } from "./css.js";
|
|
10
|
+
import { getCaptionedImage } from "./image-caption.js";
|
|
10
11
|
import { getWrappedMedia } from "./media-wrapper.js";
|
|
11
12
|
// The sets of class names an alignment lists, the first being the one to write
|
|
12
13
|
const classSets = (value) => (isArray(value) ? value : [value !== null && value !== void 0 ? value : ''])
|
|
@@ -15,17 +16,17 @@ const classSets = (value) => (isArray(value) ? value : [value !== null && value
|
|
|
15
16
|
/**
|
|
16
17
|
* The class names to align `elm` with: `alignClasses` for its tag, or for the
|
|
17
18
|
* media in it when it wraps media (a `mediaWrappers` wrapper, `jodit` or
|
|
18
|
-
* `jodit-media`)
|
|
19
|
+
* `jodit-media`) or a captioned image (see `imageCaption`)
|
|
19
20
|
*/
|
|
20
21
|
export function getAlignClasses(jodit, elm) {
|
|
21
|
-
var _a, _b;
|
|
22
|
+
var _a, _b, _c;
|
|
22
23
|
if (!elm) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
const media = Dom.isTag(elm, new Set(['jodit', 'jodit-media']))
|
|
26
27
|
? elm.firstElementChild
|
|
27
|
-
: getWrappedMedia(jodit, elm);
|
|
28
|
-
return ((
|
|
28
|
+
: ((_a = getWrappedMedia(jodit, elm)) !== null && _a !== void 0 ? _a : getCaptionedImage(jodit, elm));
|
|
29
|
+
return ((_c = (_b = jodit.o.alignClasses) === null || _b === void 0 ? void 0 : _b[(media !== null && media !== void 0 ? media : elm).nodeName.toLowerCase()]) !== null && _c !== void 0 ? _c : null);
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* Align image, with `classes` (see `alignClasses`) instead of inline styles
|
|
@@ -34,15 +35,8 @@ export function getAlignClasses(jodit, elm) {
|
|
|
34
35
|
export function hAlignElement(image, align, classes) {
|
|
35
36
|
var _a;
|
|
36
37
|
if (classes) {
|
|
37
|
-
|
|
38
|
-
Object.values(classes).forEach(value => classSets(value).forEach(set => image.classList.remove(...set)));
|
|
38
|
+
clearHAlign(image, classes);
|
|
39
39
|
image.classList.add(...((_a = classSets(classes[align || 'normal'])[0]) !== null && _a !== void 0 ? _a : []));
|
|
40
|
-
['class', 'style'].forEach(name => {
|
|
41
|
-
var _a;
|
|
42
|
-
if (!((_a = attr(image, name)) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
43
|
-
attr(image, name, null);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
40
|
return;
|
|
47
41
|
}
|
|
48
42
|
if (align && align !== 'normal') {
|
|
@@ -67,6 +61,22 @@ export function hAlignElement(image, align, classes) {
|
|
|
67
61
|
clearCenterAlign(image);
|
|
68
62
|
}
|
|
69
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Remove the alignment `hAlignElement` set on an element, with the classes of
|
|
66
|
+
* every alignment in `classes`
|
|
67
|
+
*/
|
|
68
|
+
export function clearHAlign(elm, classes) {
|
|
69
|
+
hAlignElement(elm, 'normal');
|
|
70
|
+
if (classes) {
|
|
71
|
+
Object.values(classes).forEach(value => classSets(value).forEach(set => elm.classList.remove(...set)));
|
|
72
|
+
}
|
|
73
|
+
['class', 'style'].forEach(name => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (!((_a = attr(elm, name)) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
76
|
+
attr(elm, name, null);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
70
80
|
/**
|
|
71
81
|
* The alignment `hAlignElement` has set on an element
|
|
72
82
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
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 helpers/utils
|
|
8
|
+
*/
|
|
9
|
+
import type { IJodit, Nullable } from "../../../types/index";
|
|
10
|
+
/**
|
|
11
|
+
* The caption in `wrapper`, an element holding an image and its caption (see
|
|
12
|
+
* `imageCaption`)
|
|
13
|
+
*/
|
|
14
|
+
export declare function getImageCaption(jodit: IJodit, wrapper: Nullable<Node>): Nullable<HTMLElement>;
|
|
15
|
+
/**
|
|
16
|
+
* The image in `wrapper` when it is an element holding one image and its
|
|
17
|
+
* caption (see `imageCaption`)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCaptionedImage(jodit: IJodit, wrapper: Nullable<Node>): Nullable<HTMLImageElement>;
|
|
20
|
+
/**
|
|
21
|
+
* The element holding an image and its caption (see `imageCaption`) that is
|
|
22
|
+
* or holds `node`
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCaptionWrapper(jodit: IJodit, node: Nullable<Node>): Nullable<HTMLElement>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { Dom } from "../../dom/dom.js";
|
|
7
|
+
import { toArray } from "../array/to-array.js";
|
|
8
|
+
const isPart = (node, part) => Dom.isHTMLElement(node) &&
|
|
9
|
+
node.nodeName.toLowerCase() === part.tag.toLowerCase() &&
|
|
10
|
+
(!part.className || node.classList.contains(part.className));
|
|
11
|
+
/**
|
|
12
|
+
* The caption in `wrapper`, an element holding an image and its caption (see
|
|
13
|
+
* `imageCaption`)
|
|
14
|
+
*/
|
|
15
|
+
export function getImageCaption(jodit, wrapper) {
|
|
16
|
+
var _a;
|
|
17
|
+
const markup = jodit.o.imageCaption;
|
|
18
|
+
if (!markup || !isPart(wrapper, markup.wrapper)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return ((_a = toArray(wrapper.getElementsByTagName(markup.caption.tag)).find((elm) => isPart(elm, markup.caption))) !== null && _a !== void 0 ? _a : null);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The image in `wrapper` when it is an element holding one image and its
|
|
25
|
+
* caption (see `imageCaption`)
|
|
26
|
+
*/
|
|
27
|
+
export function getCaptionedImage(jodit, wrapper) {
|
|
28
|
+
const caption = getImageCaption(jodit, wrapper);
|
|
29
|
+
if (!caption) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const images = wrapper.getElementsByTagName('img');
|
|
33
|
+
return images.length === 1 && !caption.contains(images[0])
|
|
34
|
+
? images[0]
|
|
35
|
+
: null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The element holding an image and its caption (see `imageCaption`) that is
|
|
39
|
+
* or holds `node`
|
|
40
|
+
*/
|
|
41
|
+
export function getCaptionWrapper(jodit, node) {
|
|
42
|
+
return Dom.closest(node, elm => Boolean(getCaptionedImage(jodit, elm)), jodit.editor);
|
|
43
|
+
}
|
|
@@ -24,6 +24,7 @@ export * from "./extend";
|
|
|
24
24
|
export * from "./get";
|
|
25
25
|
export * from "./get-class-name";
|
|
26
26
|
export * from "./human-size-to-bytes";
|
|
27
|
+
export * from "./image-caption";
|
|
27
28
|
export * from "./is-unsafe-proto-key";
|
|
28
29
|
export * from "./mark-deprecated";
|
|
29
30
|
export * from "./media-wrapper";
|
|
@@ -24,6 +24,7 @@ export * from "./extend.js";
|
|
|
24
24
|
export * from "./get.js";
|
|
25
25
|
export * from "./get-class-name.js";
|
|
26
26
|
export * from "./human-size-to-bytes.js";
|
|
27
|
+
export * from "./image-caption.js";
|
|
27
28
|
export * from "./is-unsafe-proto-key.js";
|
|
28
29
|
export * from "./mark-deprecated.js";
|
|
29
30
|
export * from "./media-wrapper.js";
|
|
@@ -253,6 +253,9 @@ export declare class Selection implements ISelect {
|
|
|
253
253
|
* there: the arrow keys then have nothing to move from and the selection
|
|
254
254
|
* cannot be escaped. Selecting the island itself keeps the range in editable
|
|
255
255
|
* content, so the caret can step over it. See #1184
|
|
256
|
+
*
|
|
257
|
+
* An editable element inside an island, as an image's caption, is editable
|
|
258
|
+
* content of its own, so the search stops there.
|
|
256
259
|
*/
|
|
257
260
|
private __closestNotEditable;
|
|
258
261
|
/**
|
|
@@ -596,9 +596,16 @@ export class Selection {
|
|
|
596
596
|
* Checks whether the editor currently in focus
|
|
597
597
|
*/
|
|
598
598
|
isFocused() {
|
|
599
|
-
|
|
599
|
+
const active = this.doc.activeElement;
|
|
600
|
+
// An editable element inside the editor, as an image's caption, has the
|
|
601
|
+
// focus while the caret is in it
|
|
602
|
+
return Boolean(this.doc.hasFocus &&
|
|
600
603
|
this.doc.hasFocus() &&
|
|
601
|
-
|
|
604
|
+
active &&
|
|
605
|
+
(this.area === active ||
|
|
606
|
+
(Dom.isHTMLElement(active) &&
|
|
607
|
+
active.isContentEditable &&
|
|
608
|
+
Dom.isOrContains(this.area, active))));
|
|
602
609
|
}
|
|
603
610
|
/**
|
|
604
611
|
* Returns the current element under the cursor inside editor
|
|
@@ -1117,14 +1124,22 @@ export class Selection {
|
|
|
1117
1124
|
* there: the arrow keys then have nothing to move from and the selection
|
|
1118
1125
|
* cannot be escaped. Selecting the island itself keeps the range in editable
|
|
1119
1126
|
* content, so the caret can step over it. See #1184
|
|
1127
|
+
*
|
|
1128
|
+
* An editable element inside an island, as an image's caption, is editable
|
|
1129
|
+
* content of its own, so the search stops there.
|
|
1120
1130
|
*/
|
|
1121
1131
|
__closestNotEditable(node) {
|
|
1122
1132
|
const { area } = this;
|
|
1123
1133
|
let result = null, elm = node.parentNode;
|
|
1124
1134
|
while (elm && elm !== area && area.contains(elm)) {
|
|
1125
|
-
if (Dom.isElement(elm)
|
|
1126
|
-
elm.getAttribute('contenteditable')
|
|
1127
|
-
|
|
1135
|
+
if (Dom.isElement(elm)) {
|
|
1136
|
+
const editable = elm.getAttribute('contenteditable');
|
|
1137
|
+
if (editable === 'true') {
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
if (editable === 'false') {
|
|
1141
|
+
result = elm;
|
|
1142
|
+
}
|
|
1128
1143
|
}
|
|
1129
1144
|
elm = elm.parentNode;
|
|
1130
1145
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
* Focuses the first text field shown in a form inside `box`, so that typing
|
|
8
|
+
* fills it in rather than replacing the selected content, as in a dialog. A
|
|
9
|
+
* form round `box`, as the image properties dialog's round its tabs, doesn't
|
|
10
|
+
* count, and neither do fields outside a form, as the color picker's
|
|
11
|
+
*/
|
|
12
|
+
export declare function focusFormField(box: HTMLElement): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 ui
|
|
8
|
+
*/
|
|
9
|
+
import { toArray } from "../../helpers/array/to-array.js";
|
|
10
|
+
/**
|
|
11
|
+
* Focuses the first text field shown in a form inside `box`, so that typing
|
|
12
|
+
* fills it in rather than replacing the selected content, as in a dialog. A
|
|
13
|
+
* form round `box`, as the image properties dialog's round its tabs, doesn't
|
|
14
|
+
* count, and neither do fields outside a form, as the color picker's
|
|
15
|
+
*/
|
|
16
|
+
export function focusFormField(box) {
|
|
17
|
+
var _a;
|
|
18
|
+
(_a = toArray(box.getElementsByTagName('form'))
|
|
19
|
+
.flatMap(form => toArray(form.querySelectorAll('input:not([type]), input[type="text"], input[type="url"], textarea')))
|
|
20
|
+
.find(field => field.offsetParent)) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
21
|
+
}
|
package/esm/jodit.js
CHANGED
|
@@ -24,6 +24,7 @@ import { Ajax } from "./core/request/index.js";
|
|
|
24
24
|
import { Dlgs } from "./core/traits/dlgs.js";
|
|
25
25
|
import { Config } from "./config.js";
|
|
26
26
|
import { Create, Dom, History, Plugin, Selection, StatusBar, STATUSES, ViewWithToolbar } from "./modules/index.js";
|
|
27
|
+
const FOCUS_EVENTS = new Set(['focus', 'blur', 'focusin', 'focusout']);
|
|
27
28
|
const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
|
|
28
29
|
const __defaultClassesKey = 'data-jodit-default-classes';
|
|
29
30
|
const NOEDIT = {
|
|
@@ -1242,17 +1243,32 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
1242
1243
|
})
|
|
1243
1244
|
.on(editor, 'compositionend', this.synchronizeValues)
|
|
1244
1245
|
.on(editor, 'selectionchange selectionstart keydown keyup input keypress dblclick mousedown mouseup ' +
|
|
1245
|
-
'click copy cut dragstart drop dragover paste resize touchstart touchend focus blur', (event) => {
|
|
1246
|
+
'click copy cut dragstart drop dragover paste resize touchstart touchend focus blur focusin focusout', (event) => {
|
|
1246
1247
|
if (this.o.readonly || this.__isSilentChange) {
|
|
1247
1248
|
return;
|
|
1248
1249
|
}
|
|
1250
|
+
let type = event.type;
|
|
1251
|
+
// `focus` and `blur` don't bubble from an editable element inside
|
|
1252
|
+
// the editor, as an image's caption, so `focusin` and `focusout`
|
|
1253
|
+
// stand in for them there. The focus moving between the editor
|
|
1254
|
+
// and such an element stays in the editor
|
|
1255
|
+
if (FOCUS_EVENTS.has(type)) {
|
|
1256
|
+
const inner = type === 'focusin' || type === 'focusout';
|
|
1257
|
+
if (inner === (event.target === editor) ||
|
|
1258
|
+
Dom.isOrContains(editor, event.relatedTarget)) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
if (inner) {
|
|
1262
|
+
type = type === 'focusin' ? 'focus' : 'blur';
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1249
1265
|
const w = this.ew;
|
|
1250
1266
|
if (event instanceof w.KeyboardEvent &&
|
|
1251
1267
|
event.isComposing) {
|
|
1252
1268
|
return;
|
|
1253
1269
|
}
|
|
1254
1270
|
if (this.e && this.e.fire) {
|
|
1255
|
-
if (this.e.fire(
|
|
1271
|
+
if (this.e.fire(type, event) === false) {
|
|
1256
1272
|
return false;
|
|
1257
1273
|
}
|
|
1258
1274
|
this.synchronizeValues();
|
package/esm/langs/ar.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ declare const _exports: {
|
|
|
60
60
|
Src: string;
|
|
61
61
|
Title: string;
|
|
62
62
|
Alternative: string;
|
|
63
|
+
Caption: string;
|
|
63
64
|
Link: string;
|
|
64
65
|
'Open link in new tab': string;
|
|
65
66
|
Image: string;
|
|
@@ -91,6 +92,7 @@ declare const _exports: {
|
|
|
91
92
|
'Insert column after': string;
|
|
92
93
|
'Insert row above': string;
|
|
93
94
|
'Insert row below': string;
|
|
95
|
+
'Header row': string;
|
|
94
96
|
'Delete table': string;
|
|
95
97
|
'Delete row': string;
|
|
96
98
|
'Delete column': string;
|
package/esm/langs/ar.js
CHANGED
|
@@ -70,6 +70,7 @@ export default {
|
|
|
70
70
|
Src: 'Src',
|
|
71
71
|
Title: 'العنوان',
|
|
72
72
|
Alternative: 'العنوان البديل',
|
|
73
|
+
Caption: 'تسمية توضيحية',
|
|
73
74
|
Link: 'الرابط',
|
|
74
75
|
'Open link in new tab': 'افتح الرابط في نافذة جديدة',
|
|
75
76
|
Image: 'الصورة',
|
|
@@ -101,6 +102,7 @@ export default {
|
|
|
101
102
|
'Insert column after': 'إدراج عمود بعد',
|
|
102
103
|
'Insert row above': 'إدراج صف أعلى',
|
|
103
104
|
'Insert row below': 'إدراج صف أسفل',
|
|
105
|
+
'Header row': 'صف الرأس',
|
|
104
106
|
'Delete table': 'حذف الجدول',
|
|
105
107
|
'Delete row': 'حذف الصف',
|
|
106
108
|
'Delete column': 'حذف العمود',
|
package/esm/langs/az.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ declare const _exports: {
|
|
|
65
65
|
Src: string;
|
|
66
66
|
Title: string;
|
|
67
67
|
Alternative: string;
|
|
68
|
+
Caption: string;
|
|
68
69
|
Link: string;
|
|
69
70
|
'Open link in new tab': string;
|
|
70
71
|
Image: string;
|
|
@@ -103,6 +104,7 @@ declare const _exports: {
|
|
|
103
104
|
'Insert column after': string;
|
|
104
105
|
'Insert row above': string;
|
|
105
106
|
'Insert row below': string;
|
|
107
|
+
'Header row': string;
|
|
106
108
|
'Delete table': string;
|
|
107
109
|
'Delete row': string;
|
|
108
110
|
'Delete column': string;
|
package/esm/langs/az.js
CHANGED
|
@@ -77,6 +77,7 @@ export default {
|
|
|
77
77
|
Src: 'Mənbə',
|
|
78
78
|
Title: 'Başlıq',
|
|
79
79
|
Alternative: 'Alternativ mətn',
|
|
80
|
+
Caption: 'Şəkilaltı yazı',
|
|
80
81
|
Link: 'Keçid',
|
|
81
82
|
'Open link in new tab': 'Keçidi yeni vərəqdə aç',
|
|
82
83
|
Image: 'Şəkil',
|
|
@@ -117,6 +118,7 @@ export default {
|
|
|
117
118
|
'Insert column after': 'Sonrasına sütun əlavə et',
|
|
118
119
|
'Insert row above': 'Yuxarıya sətir əlavə et',
|
|
119
120
|
'Insert row below': 'Aşağıya sətir əlavə et',
|
|
121
|
+
'Header row': 'Başlıq sətri',
|
|
120
122
|
'Delete table': 'Cədvəli sil',
|
|
121
123
|
'Delete row': 'Sətri sil',
|
|
122
124
|
'Delete column': 'Sütunu sil',
|
package/esm/langs/cs_cz.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ declare const _exports: {
|
|
|
61
61
|
Src: string;
|
|
62
62
|
Title: string;
|
|
63
63
|
Alternative: string;
|
|
64
|
+
Caption: string;
|
|
64
65
|
Link: string;
|
|
65
66
|
'Open link in new tab': string;
|
|
66
67
|
Image: string;
|
|
@@ -100,6 +101,7 @@ declare const _exports: {
|
|
|
100
101
|
'Insert column after': string;
|
|
101
102
|
'Insert row above': string;
|
|
102
103
|
'Insert row below': string;
|
|
104
|
+
'Header row': string;
|
|
103
105
|
'Delete table': string;
|
|
104
106
|
'Delete row': string;
|
|
105
107
|
'Delete column': string;
|
package/esm/langs/cs_cz.js
CHANGED
|
@@ -71,6 +71,7 @@ export default {
|
|
|
71
71
|
Src: 'src',
|
|
72
72
|
Title: 'Titulek',
|
|
73
73
|
Alternative: 'Alternativní text (alt)',
|
|
74
|
+
Caption: 'Titulek',
|
|
74
75
|
Link: 'Link',
|
|
75
76
|
'Open link in new tab': 'Otevřít link v nové záložce',
|
|
76
77
|
Image: 'Obrázek',
|
|
@@ -112,6 +113,7 @@ export default {
|
|
|
112
113
|
'Insert column after': 'Vložit sloupec za',
|
|
113
114
|
'Insert row above': 'Vložit řádek nad',
|
|
114
115
|
'Insert row below': 'Vložit řádek pod',
|
|
116
|
+
'Header row': 'Řádek záhlaví',
|
|
115
117
|
'Delete table': 'Vymazat tabulku',
|
|
116
118
|
'Delete row': 'Vymazat řádku',
|
|
117
119
|
'Delete column': 'Vymazat sloupec',
|
package/esm/langs/de.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ declare const _exports: {
|
|
|
61
61
|
Src: string;
|
|
62
62
|
Title: string;
|
|
63
63
|
Alternative: string;
|
|
64
|
+
Caption: string;
|
|
64
65
|
Link: string;
|
|
65
66
|
'Open link in new tab': string;
|
|
66
67
|
Image: string;
|
|
@@ -99,6 +100,7 @@ declare const _exports: {
|
|
|
99
100
|
'Insert column after': string;
|
|
100
101
|
'Insert row above': string;
|
|
101
102
|
'Insert row below': string;
|
|
103
|
+
'Header row': string;
|
|
102
104
|
'Delete table': string;
|
|
103
105
|
'Delete row': string;
|
|
104
106
|
'Delete column': string;
|