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.
- package/CHANGELOG.md +22 -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
|
@@ -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
|
/**
|
|
@@ -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(
|
|
107
|
+
caret.setStartBefore(target);
|
|
104
108
|
caret.collapse(true);
|
|
105
|
-
j.s.removeNode(
|
|
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(
|
|
136
|
+
j.s.select(target);
|
|
123
137
|
return;
|
|
124
138
|
}
|
|
125
139
|
const caret = j.s.createRange();
|
|
126
|
-
caret.setStartAfter(
|
|
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:
|
|
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
|
-
|
|
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(
|
|
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:
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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:
|
|
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
|
-
/**
|
|
7
|
-
|
|
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
|
-
/**
|
|
14
|
-
|
|
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 {
|
|
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 {
|
|
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
|
*/
|
package/esm/plugins/index.d.ts
CHANGED
|
@@ -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',
|