jodit 4.15.16 → 4.15.18
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 +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +7 -7
- package/es2015/jodit.js +165 -48
- package/es2015/jodit.min.js +7 -7
- 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.js +4 -4
- package/es2018/jodit.min.js +7 -7
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +8 -8
- package/es2021/jodit.js +162 -48
- package/es2021/jodit.min.js +12 -12
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +8 -8
- package/es2021.en/jodit.js +162 -48
- package/es2021.en/jodit.min.js +8 -8
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +213 -77
- package/es5/jodit.min.css +2 -2
- 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 +23 -0
- package/esm/config.js +21 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/utils/align.d.ts +8 -3
- package/esm/core/helpers/utils/align.js +40 -2
- package/esm/core/selection/selection.js +5 -0
- package/esm/plugins/focus/focus.js +17 -1
- package/esm/plugins/image-processor/image-processor.js +20 -1
- package/esm/plugins/image-properties/readers/align.d.ts +5 -1
- package/esm/plugins/image-properties/readers/align.js +4 -18
- package/esm/plugins/image-properties/readers/index.js +1 -1
- package/esm/plugins/image-properties/writers/index.js +1 -1
- package/esm/plugins/image-properties/writers/margin.js +5 -3
- package/esm/plugins/inline-popup/config/items/img.js +24 -2
- package/esm/types/types.d.ts +4 -0
- package/package.json +1 -1
- package/types/config.d.ts +23 -0
- package/types/core/helpers/utils/align.d.ts +8 -3
- package/types/plugins/image-properties/readers/align.d.ts +5 -1
- package/types/types/types.d.ts +4 -0
package/es2021.en/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.15.
|
|
4
|
+
* Version: v4.15.18
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -728,6 +728,25 @@ let ConfigPrototype = {};
|
|
|
728
728
|
/**
|
|
729
729
|
* Default width (in pixels) applied to images inserted into the editor
|
|
730
730
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageDefaultWidth", 300);
|
|
731
|
+
/**
|
|
732
|
+
* Alignment given to images inserted into the editor. `'normal'` leaves
|
|
733
|
+
* them unaligned
|
|
734
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageDefaultAlign", 'normal');
|
|
735
|
+
/**
|
|
736
|
+
* Class names to align images with, instead of an inline `float` or
|
|
737
|
+
* `margin`. Aligning an image removes every class listed here and adds the
|
|
738
|
+
* chosen alignment's, which can be several separated by spaces.
|
|
739
|
+
*
|
|
740
|
+
* ```javascript
|
|
741
|
+
* Jodit.make('#editor', {
|
|
742
|
+
* imageAlignClasses: {
|
|
743
|
+
* left: 'align-left',
|
|
744
|
+
* right: 'align-right',
|
|
745
|
+
* center: 'align-center'
|
|
746
|
+
* }
|
|
747
|
+
* });
|
|
748
|
+
* ```
|
|
749
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageAlignClasses", null);
|
|
731
750
|
/**
|
|
732
751
|
* Do not display these buttons that are on the list
|
|
733
752
|
*
|
|
@@ -1780,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1780
1799
|
* ```
|
|
1781
1800
|
* @packageDocumentation
|
|
1782
1801
|
* @module constants
|
|
1783
|
-
*/ const APP_VERSION = "4.15.
|
|
1802
|
+
*/ const APP_VERSION = "4.15.18";
|
|
1784
1803
|
// prettier-ignore
|
|
1785
1804
|
const ES = "es2021";
|
|
1786
1805
|
const IS_ES_MODERN = true;
|
|
@@ -7535,6 +7554,7 @@ function trimChars(value, chars) {
|
|
|
7535
7554
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7536
7555
|
/* harmony export */ alignElement: function() { return /* binding */ alignElement; },
|
|
7537
7556
|
/* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
|
|
7557
|
+
/* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
|
|
7538
7558
|
/* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
|
|
7539
7559
|
/* harmony export */ });
|
|
7540
7560
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
@@ -7549,9 +7569,25 @@ function trimChars(value, chars) {
|
|
|
7549
7569
|
*/
|
|
7550
7570
|
|
|
7551
7571
|
|
|
7572
|
+
const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
|
|
7552
7573
|
/**
|
|
7553
|
-
* Align image
|
|
7554
|
-
|
|
7574
|
+
* Align image, with `classes` (see `imageAlignClasses`) instead of inline
|
|
7575
|
+
* styles when they are given
|
|
7576
|
+
*/ function hAlignElement(image, align, classes) {
|
|
7577
|
+
if (classes) {
|
|
7578
|
+
hAlignElement(image, 'normal');
|
|
7579
|
+
Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
|
|
7580
|
+
image.classList.add(...classNames(classes[align || 'normal']));
|
|
7581
|
+
[
|
|
7582
|
+
'class',
|
|
7583
|
+
'style'
|
|
7584
|
+
].forEach((name)=>{
|
|
7585
|
+
if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)?.trim()) {
|
|
7586
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
|
|
7587
|
+
}
|
|
7588
|
+
});
|
|
7589
|
+
return;
|
|
7590
|
+
}
|
|
7555
7591
|
if (align && align !== 'normal') {
|
|
7556
7592
|
if (align !== 'center') {
|
|
7557
7593
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
|
|
@@ -7574,6 +7610,31 @@ function trimChars(value, chars) {
|
|
|
7574
7610
|
;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
|
|
7575
7611
|
}
|
|
7576
7612
|
}
|
|
7613
|
+
/**
|
|
7614
|
+
* The alignment `hAlignElement` has set on an element
|
|
7615
|
+
*/ function getHAlign(elm, classes) {
|
|
7616
|
+
if (classes) {
|
|
7617
|
+
for (const align of [
|
|
7618
|
+
'left',
|
|
7619
|
+
'right',
|
|
7620
|
+
'center',
|
|
7621
|
+
'normal'
|
|
7622
|
+
]){
|
|
7623
|
+
const names = classNames(classes[align]);
|
|
7624
|
+
if (names.length && names.every((name)=>elm.classList.contains(name))) {
|
|
7625
|
+
return align;
|
|
7626
|
+
}
|
|
7627
|
+
}
|
|
7628
|
+
}
|
|
7629
|
+
const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
|
|
7630
|
+
if (float === 'left' || float === 'right') {
|
|
7631
|
+
return float;
|
|
7632
|
+
}
|
|
7633
|
+
if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-right') === 'auto') {
|
|
7634
|
+
return 'center';
|
|
7635
|
+
}
|
|
7636
|
+
return 'normal';
|
|
7637
|
+
}
|
|
7577
7638
|
/**
|
|
7578
7639
|
* Remove text-align style for all selected children
|
|
7579
7640
|
*/ function clearAlign(node) {
|
|
@@ -8736,6 +8797,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8736
8797
|
/* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
|
|
8737
8798
|
/* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
|
|
8738
8799
|
/* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
|
|
8800
|
+
/* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
|
|
8739
8801
|
/* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
|
|
8740
8802
|
/* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
|
|
8741
8803
|
/* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
|
|
@@ -8766,7 +8828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8766
8828
|
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
|
|
8767
8829
|
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
|
|
8768
8830
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
8769
|
-
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
8831
|
+
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","getHAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
8770
8832
|
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
8771
8833
|
/* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
|
|
8772
8834
|
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
|
|
@@ -10666,11 +10728,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
10666
10728
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
10667
10729
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
10668
10730
|
/* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28686);
|
|
10669
|
-
/* harmony import */ var
|
|
10670
|
-
/* harmony import */ var
|
|
10671
|
-
/* harmony import */ var
|
|
10672
|
-
/* harmony import */ var
|
|
10673
|
-
/* harmony import */ var
|
|
10731
|
+
/* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16849);
|
|
10732
|
+
/* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28712);
|
|
10733
|
+
/* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__);
|
|
10734
|
+
/* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7470);
|
|
10735
|
+
/* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84578);
|
|
10736
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42259);
|
|
10674
10737
|
/*!
|
|
10675
10738
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
10676
10739
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -10692,6 +10755,7 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
10692
10755
|
|
|
10693
10756
|
|
|
10694
10757
|
|
|
10758
|
+
|
|
10695
10759
|
class Selection {
|
|
10696
10760
|
/**
|
|
10697
10761
|
* Short alias for this.jodit
|
|
@@ -11124,7 +11188,7 @@ class Selection {
|
|
|
11124
11188
|
return node;
|
|
11125
11189
|
}
|
|
11126
11190
|
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node)) {
|
|
11127
|
-
const ret = (0,
|
|
11191
|
+
const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
|
|
11128
11192
|
node = ret.node;
|
|
11129
11193
|
rightMode = ret.rightMode;
|
|
11130
11194
|
}
|
|
@@ -11265,6 +11329,10 @@ class Selection {
|
|
|
11265
11329
|
if (styles && typeof styles === 'object') {
|
|
11266
11330
|
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
|
|
11267
11331
|
}
|
|
11332
|
+
const { imageDefaultAlign, imageAlignClasses } = this.j.o;
|
|
11333
|
+
if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
|
|
11334
|
+
(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
|
|
11335
|
+
}
|
|
11268
11336
|
const onload = ()=>{
|
|
11269
11337
|
if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
|
|
11270
11338
|
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, {
|
|
@@ -11388,7 +11456,7 @@ class Selection {
|
|
|
11388
11456
|
const isSignificant = (elm)=>Boolean(elm && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'br') && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(elm) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(elm) && !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(elm) && this.j.e.fire('isInvisibleForCursor', elm) === true));
|
|
11389
11457
|
// check right offset
|
|
11390
11458
|
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(container)) {
|
|
11391
|
-
if ((0,
|
|
11459
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.cursorInTheEdgeOfString)(container, offset, start, end)) {
|
|
11392
11460
|
return false;
|
|
11393
11461
|
}
|
|
11394
11462
|
} else {
|
|
@@ -11776,8 +11844,8 @@ class Selection {
|
|
|
11776
11844
|
* }) // will remove `color:red` from `span`
|
|
11777
11845
|
* ```
|
|
11778
11846
|
*/ commitStyle(options) {
|
|
11779
|
-
;(0,
|
|
11780
|
-
const styleElm = new
|
|
11847
|
+
;(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.size)(options) > 0, 'Need to pass at least one option');
|
|
11848
|
+
const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_10__.CommitStyle(options);
|
|
11781
11849
|
styleElm.apply(this.j);
|
|
11782
11850
|
}
|
|
11783
11851
|
/**
|
|
@@ -11827,7 +11895,7 @@ class Selection {
|
|
|
11827
11895
|
}
|
|
11828
11896
|
const fragment = leftRange.extractContents();
|
|
11829
11897
|
const clearEmpties = (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.each(node, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(node) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(node));
|
|
11830
|
-
(0,
|
|
11898
|
+
(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)(currentBox.parentNode, 'Splitting fails');
|
|
11831
11899
|
try {
|
|
11832
11900
|
clearEmpties(fragment);
|
|
11833
11901
|
clearEmpties(currentBox);
|
|
@@ -11880,7 +11948,7 @@ class Selection {
|
|
|
11880
11948
|
const r = range.cloneRange();
|
|
11881
11949
|
r.collapse(start);
|
|
11882
11950
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(r, fake);
|
|
11883
|
-
(0,
|
|
11951
|
+
(0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
|
|
11884
11952
|
return fake;
|
|
11885
11953
|
};
|
|
11886
11954
|
const leftFake = moveMaxEdgeFake(true);
|
|
@@ -31596,14 +31664,28 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('file', file);
|
|
|
31596
31664
|
*/ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.saveSelectionOnBlur = true;
|
|
31597
31665
|
function focus(editor) {
|
|
31598
31666
|
if (editor.o.saveSelectionOnBlur) {
|
|
31667
|
+
// A click that brings focus back places the caret itself, and Chrome
|
|
31668
|
+
// has already placed it when focus fires, so restoring would move it
|
|
31669
|
+
// back to the old selection. The saved markers are dropped instead.
|
|
31670
|
+
let focusByPointer = false;
|
|
31599
31671
|
editor.e.on('blur', ()=>{
|
|
31672
|
+
// A press that never brought the focus back must not decide
|
|
31673
|
+
// what the next focus does
|
|
31674
|
+
focusByPointer = false;
|
|
31600
31675
|
if (editor.isEditorMode()) {
|
|
31601
31676
|
editor.s.save(true);
|
|
31602
31677
|
}
|
|
31678
|
+
}).on('mousedown touchstart', ()=>{
|
|
31679
|
+
focusByPointer = !editor.editorIsActive;
|
|
31603
31680
|
}).on('focus', ()=>{
|
|
31604
31681
|
if (editor.isEditorMode()) {
|
|
31605
|
-
|
|
31682
|
+
if (focusByPointer) {
|
|
31683
|
+
editor.s.removeMarkers();
|
|
31684
|
+
} else {
|
|
31685
|
+
editor.s.restore();
|
|
31686
|
+
}
|
|
31606
31687
|
}
|
|
31688
|
+
focusByPointer = false;
|
|
31607
31689
|
});
|
|
31608
31690
|
}
|
|
31609
31691
|
const focus = ()=>{
|
|
@@ -32629,11 +32711,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
|
|
|
32629
32711
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
|
|
32630
32712
|
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
|
|
32631
32713
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
|
|
32632
|
-
/* harmony import */ var
|
|
32633
|
-
/* harmony import */ var
|
|
32634
|
-
/* harmony import */ var
|
|
32635
|
-
/* harmony import */ var
|
|
32636
|
-
/* harmony import */ var
|
|
32714
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
|
|
32715
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
32716
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
32717
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
|
|
32718
|
+
/* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23112);
|
|
32719
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51034);
|
|
32637
32720
|
/*!
|
|
32638
32721
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
32639
32722
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -32650,11 +32733,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
|
|
|
32650
32733
|
|
|
32651
32734
|
|
|
32652
32735
|
|
|
32736
|
+
|
|
32653
32737
|
const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
|
|
32654
32738
|
const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
|
|
32655
32739
|
/**
|
|
32656
32740
|
* Change editor's size after load all images
|
|
32657
|
-
*/ class imageProcessor extends
|
|
32741
|
+
*/ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
|
|
32658
32742
|
afterInit(jodit) {}
|
|
32659
32743
|
beforeDestruct(jodit) {
|
|
32660
32744
|
const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.cached)(jodit, 'buffer');
|
|
@@ -32692,9 +32776,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
|
|
|
32692
32776
|
if (!editor.editor) {
|
|
32693
32777
|
return;
|
|
32694
32778
|
}
|
|
32695
|
-
;(0,
|
|
32696
|
-
if (!(0,
|
|
32697
|
-
(0,
|
|
32779
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.$$)('img', editor.editor).forEach((elm)=>{
|
|
32780
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
|
|
32781
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
|
|
32698
32782
|
if (!elm.complete) {
|
|
32699
32783
|
editor.e.on(elm, 'load', function ElementOnLoad() {
|
|
32700
32784
|
!editor.isInDestruct && editor.e?.fire('resize');
|
|
@@ -32705,6 +32789,7 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
|
|
|
32705
32789
|
replaceDataURIToBlobUUID(editor, elm);
|
|
32706
32790
|
}
|
|
32707
32791
|
editor.e.on(elm, 'mousedown touchstart', ()=>{
|
|
32792
|
+
removeCaretText(elm);
|
|
32708
32793
|
editor.s.select(elm);
|
|
32709
32794
|
});
|
|
32710
32795
|
}
|
|
@@ -32725,6 +32810,23 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
|
|
|
32725
32810
|
]),
|
|
32726
32811
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.debounce)()
|
|
32727
32812
|
], imageProcessor.prototype, "afterChange", null);
|
|
32813
|
+
/**
|
|
32814
|
+
* Remove the invisible-space text beside an image, which only held a caret.
|
|
32815
|
+
* Selecting the image replaces the caret, and with the text still after a
|
|
32816
|
+
* block image, Safari highlights the rest of the image's line. See #1512
|
|
32817
|
+
*/ function removeCaretText(elm) {
|
|
32818
|
+
for (const side of [
|
|
32819
|
+
'previousSibling',
|
|
32820
|
+
'nextSibling'
|
|
32821
|
+
]){
|
|
32822
|
+
let node = elm[side];
|
|
32823
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(node) && !node.nodeValue?.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE_REG_EXP)(), '')){
|
|
32824
|
+
const next = node[side];
|
|
32825
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
|
|
32826
|
+
node = next;
|
|
32827
|
+
}
|
|
32828
|
+
}
|
|
32829
|
+
}
|
|
32728
32830
|
function replaceDataURIToBlobUUID(editor, elm) {
|
|
32729
32831
|
if (!editor.o.imageProcessor.replaceDataURIToBlobIdInView) {
|
|
32730
32832
|
return;
|
|
@@ -32735,7 +32837,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
|
|
|
32735
32837
|
const dataUri = elm.src;
|
|
32736
32838
|
let blob;
|
|
32737
32839
|
try {
|
|
32738
|
-
blob = (0,
|
|
32840
|
+
blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__.dataURItoBlob)(dataUri);
|
|
32739
32841
|
} catch {
|
|
32740
32842
|
// A data URI the browser accepts but we cannot decode is not worth
|
|
32741
32843
|
// breaking the editor over — keep the image as it is
|
|
@@ -32748,7 +32850,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
|
|
|
32748
32850
|
list[elm.src] = dataUri;
|
|
32749
32851
|
editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
|
|
32750
32852
|
}
|
|
32751
|
-
|
|
32853
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProcessor', imageProcessor);
|
|
32752
32854
|
|
|
32753
32855
|
|
|
32754
32856
|
/***/ }),
|
|
@@ -33051,7 +33153,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
|
|
|
33051
33153
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33052
33154
|
/* harmony export */ readAlign: function() { return /* binding */ readAlign; }
|
|
33053
33155
|
/* harmony export */ });
|
|
33054
|
-
/* harmony import */ var
|
|
33156
|
+
/* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
|
|
33055
33157
|
/*!
|
|
33056
33158
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
33057
33159
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -33061,20 +33163,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
|
|
|
33061
33163
|
*/
|
|
33062
33164
|
/**
|
|
33063
33165
|
* @private
|
|
33064
|
-
*/ function readAlign(image, values) {
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
'left',
|
|
33068
|
-
'right'
|
|
33069
|
-
].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float').toLowerCase()) !== -1) {
|
|
33070
|
-
values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'float');
|
|
33071
|
-
} else {
|
|
33072
|
-
if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-right') === 'auto') {
|
|
33073
|
-
values.align = 'center';
|
|
33074
|
-
} else {
|
|
33075
|
-
values.align = '';
|
|
33076
|
-
}
|
|
33077
|
-
}
|
|
33166
|
+
*/ function readAlign(image, values, classes) {
|
|
33167
|
+
const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
|
|
33168
|
+
values.align = align === 'normal' ? '' : align;
|
|
33078
33169
|
}
|
|
33079
33170
|
|
|
33080
33171
|
|
|
@@ -33110,7 +33201,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
|
|
|
33110
33201
|
* @private
|
|
33111
33202
|
*/ async function readValuesFromImage(j, state) {
|
|
33112
33203
|
const { sourceImage: image, values } = state;
|
|
33113
|
-
(0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values);
|
|
33204
|
+
(0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values, j.o.imageAlignClasses);
|
|
33114
33205
|
// Border radius
|
|
33115
33206
|
values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__.cssInline)(image, 'border-radius') || '0', 10) || 0;
|
|
33116
33207
|
// Id
|
|
@@ -34151,7 +34242,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
|
|
|
34151
34242
|
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
|
|
34152
34243
|
}
|
|
34153
34244
|
if (opt.image.editAlign) {
|
|
34154
|
-
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
|
|
34245
|
+
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
|
|
34155
34246
|
}
|
|
34156
34247
|
}
|
|
34157
34248
|
|
|
@@ -34222,10 +34313,12 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
|
|
|
34222
34313
|
marginBottom,
|
|
34223
34314
|
marginLeft
|
|
34224
34315
|
];
|
|
34316
|
+
// Compared with the inline value, which is what `readMargins` showed, so a
|
|
34317
|
+
// margin from a stylesheet is not overwritten when the field is unchanged
|
|
34225
34318
|
const applyMargin = (key, value)=>{
|
|
34226
|
-
const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.
|
|
34319
|
+
const oldValue = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, key) || 0);
|
|
34227
34320
|
const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)(value);
|
|
34228
|
-
if (oldValue
|
|
34321
|
+
if (oldValue !== v) {
|
|
34229
34322
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key, v);
|
|
34230
34323
|
}
|
|
34231
34324
|
};
|
|
@@ -34989,6 +35082,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
|
|
|
34989
35082
|
|
|
34990
35083
|
|
|
34991
35084
|
|
|
35085
|
+
// Images align with `imageAlignClasses`; the wrappers of iframes and media
|
|
35086
|
+
// keep inline styles
|
|
35087
|
+
const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
|
|
35088
|
+
const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
|
|
34992
35089
|
const align = {
|
|
34993
35090
|
name: 'left',
|
|
34994
35091
|
childTemplate: (_, __, value)=>value,
|
|
@@ -34998,6 +35095,15 @@ const align = {
|
|
|
34998
35095
|
'Center',
|
|
34999
35096
|
'Normal'
|
|
35000
35097
|
],
|
|
35098
|
+
update: (editor, button)=>{
|
|
35099
|
+
const current = currentAlign(editor, button.target);
|
|
35100
|
+
button.state.icon.name = current === 'normal' ? 'left' : current;
|
|
35101
|
+
},
|
|
35102
|
+
isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
|
|
35103
|
+
isChildActive: (editor, button)=>{
|
|
35104
|
+
const [value] = button.control.args ?? [];
|
|
35105
|
+
return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
|
|
35106
|
+
},
|
|
35001
35107
|
exec: (editor, elm, { control })=>{
|
|
35002
35108
|
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
|
|
35003
35109
|
'img',
|
|
@@ -35010,7 +35116,7 @@ const align = {
|
|
|
35010
35116
|
if (!command) {
|
|
35011
35117
|
return false;
|
|
35012
35118
|
}
|
|
35013
|
-
;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
|
|
35119
|
+
;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
|
|
35014
35120
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
|
|
35015
35121
|
'jodit',
|
|
35016
35122
|
'jodit-media'
|
|
@@ -35050,6 +35156,14 @@ const align = {
|
|
|
35050
35156
|
'Normal'
|
|
35051
35157
|
],
|
|
35052
35158
|
tooltip: 'Vertical align',
|
|
35159
|
+
// `vertical-align` only moves an image in the line, not a floated or block one
|
|
35160
|
+
isDisabled: (editor, button)=>{
|
|
35161
|
+
const image = button.target;
|
|
35162
|
+
return Boolean(image && ([
|
|
35163
|
+
'left',
|
|
35164
|
+
'right'
|
|
35165
|
+
].includes((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float')) || (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'display') === 'block'));
|
|
35166
|
+
},
|
|
35053
35167
|
exec: (editor, image, { control })=>{
|
|
35054
35168
|
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(image, 'img')) {
|
|
35055
35169
|
return;
|