jodit 4.17.4 → 4.17.6
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 +17 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +131 -37
- package/es2015/jodit.min.js +5 -5
- 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 +5 -5
- package/es2018/jodit.min.js +5 -5
- 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 +7 -7
- package/es2021/jodit.js +125 -37
- package/es2021/jodit.min.js +7 -7
- 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 +7 -7
- package/es2021.en/jodit.js +125 -37
- 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 +140 -37
- 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/core/constants.js +1 -1
- package/esm/core/selection/selection.d.ts +5 -0
- package/esm/core/selection/selection.js +56 -5
- package/esm/modules/history/history.js +20 -12
- package/esm/plugins/line-height/line-height.js +1 -1
- package/esm/plugins/placeholder/placeholder.js +1 -1
- package/esm/plugins/select/select.d.ts +7 -0
- package/esm/plugins/select/select.js +19 -1
- package/esm/plugins/source/editor/engines/ace.d.ts +2 -0
- package/esm/plugins/source/editor/engines/ace.js +35 -3
- package/package.json +1 -1
- package/types/core/selection/selection.d.ts +5 -0
- package/types/plugins/select/select.d.ts +7 -0
- package/types/plugins/source/editor/engines/ace.d.ts +2 -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.17.
|
|
4
|
+
* Version: v4.17.6
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1799,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1799
1799
|
* ```
|
|
1800
1800
|
* @packageDocumentation
|
|
1801
1801
|
* @module constants
|
|
1802
|
-
*/ const APP_VERSION = "4.17.
|
|
1802
|
+
*/ const APP_VERSION = "4.17.6";
|
|
1803
1803
|
// prettier-ignore
|
|
1804
1804
|
const ES = "es2021";
|
|
1805
1805
|
const IS_ES_MODERN = true;
|
|
@@ -10845,6 +10845,11 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
10845
10845
|
|
|
10846
10846
|
|
|
10847
10847
|
|
|
10848
|
+
/**
|
|
10849
|
+
* A text node that is empty or holds only invisible caret placeholders.
|
|
10850
|
+
*/ function isBlankTextNode(node) {
|
|
10851
|
+
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && (node.nodeValue ?? '').replace(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE_REG_EXP(), '').length === 0;
|
|
10852
|
+
}
|
|
10848
10853
|
class Selection {
|
|
10849
10854
|
/**
|
|
10850
10855
|
* Short alias for this.jodit
|
|
@@ -10957,6 +10962,16 @@ class Selection {
|
|
|
10957
10962
|
}
|
|
10958
10963
|
});
|
|
10959
10964
|
}
|
|
10965
|
+
/**
|
|
10966
|
+
* How many ranges the browser's own selection holds right now, as opposed
|
|
10967
|
+
* to the composed view that [[sel]] may answer from.
|
|
10968
|
+
*/ __nativeRangeCount() {
|
|
10969
|
+
const { shadowRoot } = this.j.o;
|
|
10970
|
+
if (shadowRoot && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(shadowRoot.getSelection)) {
|
|
10971
|
+
return shadowRoot.getSelection()?.rangeCount ?? 0;
|
|
10972
|
+
}
|
|
10973
|
+
return this.win.getSelection()?.rangeCount ?? 0;
|
|
10974
|
+
}
|
|
10960
10975
|
/**
|
|
10961
10976
|
* Return first selected range or create new
|
|
10962
10977
|
*/ get range() {
|
|
@@ -11079,10 +11094,21 @@ class Selection {
|
|
|
11079
11094
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(marker, this.j.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE));
|
|
11080
11095
|
if (newRange) {
|
|
11081
11096
|
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, atStart ? newRange.startContainer : newRange.endContainer)) {
|
|
11082
|
-
|
|
11083
|
-
//
|
|
11084
|
-
//
|
|
11085
|
-
|
|
11097
|
+
const { startContainer: node, startOffset: offset } = newRange;
|
|
11098
|
+
// At either end of a text node the marker goes beside it. Splitting
|
|
11099
|
+
// the node there would leave the selection's boundary in an empty
|
|
11100
|
+
// text node, and WebKit neither repaints a selection that leaves one
|
|
11101
|
+
// nor moves a selection that follows one when it's removed.
|
|
11102
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === 0) {
|
|
11103
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(node, marker);
|
|
11104
|
+
} else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === node.nodeValue?.length) {
|
|
11105
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.after(node, marker);
|
|
11106
|
+
} else {
|
|
11107
|
+
// Here need do unsafe inserting
|
|
11108
|
+
// Deny Dom.safeInsertNode(newRange, marker);
|
|
11109
|
+
// Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
|
|
11110
|
+
newRange.insertNode(marker);
|
|
11111
|
+
}
|
|
11086
11112
|
}
|
|
11087
11113
|
}
|
|
11088
11114
|
return marker;
|
|
@@ -11404,7 +11430,9 @@ class Selection {
|
|
|
11404
11430
|
()=>firstChild?.previousSibling?.lastChild
|
|
11405
11431
|
].forEach((getChildNode)=>{
|
|
11406
11432
|
const childNode = getChildNode();
|
|
11407
|
-
|
|
11433
|
+
// Only a text node left with nothing in it by the split
|
|
11434
|
+
// goes; one holding a space is content (`<b>a</b> |`).
|
|
11435
|
+
if (childNode && isBlankTextNode(childNode)) {
|
|
11408
11436
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(childNode);
|
|
11409
11437
|
}
|
|
11410
11438
|
});
|
|
@@ -11751,6 +11779,16 @@ class Selection {
|
|
|
11751
11779
|
if (backward && ranges.length === 1) {
|
|
11752
11780
|
const range = ranges[0];
|
|
11753
11781
|
sel.setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);
|
|
11782
|
+
} else if (ranges.length === 1 && !this.__nativeRangeCount() && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(sel.setBaseAndExtent)) {
|
|
11783
|
+
// `addRange` is specified to ignore a range whose root is not
|
|
11784
|
+
// the document, which is every range inside a shadow tree.
|
|
11785
|
+
// Chrome's `ShadowRoot.getSelection()` takes them anyway, but
|
|
11786
|
+
// Safari has only the window selection, so after
|
|
11787
|
+
// `removeAllRanges` the caret is simply gone: a character was
|
|
11788
|
+
// deleted and nothing was left to type into. `setBaseAndExtent`
|
|
11789
|
+
// does accept nodes inside a shadow tree.
|
|
11790
|
+
const range = ranges[0];
|
|
11791
|
+
sel.setBaseAndExtent(range.startContainer, range.startOffset, range.endContainer, range.endOffset);
|
|
11754
11792
|
}
|
|
11755
11793
|
}
|
|
11756
11794
|
/**
|
|
@@ -22274,19 +22312,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.history = {
|
|
|
22274
22312
|
* Update history stack
|
|
22275
22313
|
*/ updateStack(replace = false) {
|
|
22276
22314
|
const newValue = this.snapshot.make();
|
|
22277
|
-
if (
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
} else {
|
|
22285
|
-
this.__stack.push(newCommand);
|
|
22286
|
-
}
|
|
22315
|
+
if (_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
|
|
22316
|
+
return;
|
|
22317
|
+
}
|
|
22318
|
+
// Only the selection moved, for example when the selection markers
|
|
22319
|
+
// went in before a switch to the source view. There is nothing to
|
|
22320
|
+
// undo, but the next change has to start from this selection.
|
|
22321
|
+
if (newValue.html === this.startValue.html) {
|
|
22287
22322
|
this.startValue = newValue;
|
|
22288
|
-
|
|
22323
|
+
return;
|
|
22324
|
+
}
|
|
22325
|
+
const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
|
|
22326
|
+
if (replace) {
|
|
22327
|
+
const command = this.__stack.current();
|
|
22328
|
+
if (command && this.updateTick === command.tick) {
|
|
22329
|
+
this.__stack.replace(newCommand);
|
|
22330
|
+
}
|
|
22331
|
+
} else {
|
|
22332
|
+
this.__stack.push(newCommand);
|
|
22289
22333
|
}
|
|
22334
|
+
this.startValue = newValue;
|
|
22335
|
+
this.fireChangeStack();
|
|
22290
22336
|
}
|
|
22291
22337
|
fireChangeStack() {
|
|
22292
22338
|
this.j && !this.j.isInDestruct && this.j.events?.fire('changeStack');
|
|
@@ -36326,7 +36372,7 @@ class lineHeight extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
|
|
|
36326
36372
|
try {
|
|
36327
36373
|
if (s.isCollapsed()) {
|
|
36328
36374
|
const fake = c.fake();
|
|
36329
|
-
s.
|
|
36375
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeInsertNode(s.range, fake);
|
|
36330
36376
|
apply(fake);
|
|
36331
36377
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(fake);
|
|
36332
36378
|
} else {
|
|
@@ -38349,7 +38395,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
|
|
|
38349
38395
|
this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
|
|
38350
38396
|
}
|
|
38351
38397
|
editor.e.fire('placeholder', this.placeholderElm.innerHTML);
|
|
38352
|
-
editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder', this.toggle).on(window, 'load', this.toggle);
|
|
38398
|
+
editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder afterCommand.placeholder', this.toggle).on(window, 'load', this.toggle);
|
|
38353
38399
|
this.addNativeListeners();
|
|
38354
38400
|
this.toggle();
|
|
38355
38401
|
});
|
|
@@ -41023,13 +41069,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
41023
41069
|
j.e.fire(e.type + 'Editor', target, e);
|
|
41024
41070
|
}
|
|
41025
41071
|
}
|
|
41072
|
+
onOutsidePress(e) {
|
|
41073
|
+
this.__pressTarget = e.target;
|
|
41074
|
+
}
|
|
41026
41075
|
/**
|
|
41027
41076
|
* @event outsideClick(e) - when user clicked on the outside of editor
|
|
41028
41077
|
*/ onOutsideClick(e) {
|
|
41029
|
-
const node = e.target;
|
|
41078
|
+
const node = e.target, pressed = this.__pressTarget;
|
|
41079
|
+
this.__pressTarget = null;
|
|
41030
41080
|
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.j.editor)) {
|
|
41031
41081
|
return;
|
|
41032
41082
|
}
|
|
41083
|
+
// Selecting the text of a popup input with the mouse and releasing
|
|
41084
|
+
// the button past the popup's edge is not a click outside of it.
|
|
41085
|
+
if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
|
|
41086
|
+
return;
|
|
41087
|
+
}
|
|
41033
41088
|
const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
|
|
41034
41089
|
if (!box) {
|
|
41035
41090
|
this.j.e.fire('outsideClick', e);
|
|
@@ -41133,12 +41188,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
41133
41188
|
'touchstart',
|
|
41134
41189
|
'mouseup',
|
|
41135
41190
|
'touchend'
|
|
41136
|
-
])
|
|
41191
|
+
]), /**
|
|
41192
|
+
* Where the last press started. Chrome reports a drag that begins in one
|
|
41193
|
+
* element and ends in another as a `click` on their common ancestor, so a
|
|
41194
|
+
* press inside a popup is remembered to tell such a drag from a real click.
|
|
41195
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
|
|
41137
41196
|
}
|
|
41138
41197
|
}
|
|
41139
41198
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41140
41199
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41141
41200
|
], select.prototype, "onStartSelection", null);
|
|
41201
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41202
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
41203
|
+
'ow:mousedown',
|
|
41204
|
+
'ow:touchstart'
|
|
41205
|
+
])
|
|
41206
|
+
], select.prototype, "onOutsidePress", null);
|
|
41142
41207
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41143
41208
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)('ow:click')
|
|
41144
41209
|
], select.prototype, "onOutsideClick", null);
|
|
@@ -41475,10 +41540,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
|
|
|
41475
41540
|
/* harmony export */ AceEditor: function() { return /* binding */ AceEditor; }
|
|
41476
41541
|
/* harmony export */ });
|
|
41477
41542
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
41478
|
-
/* harmony import */ var
|
|
41479
|
-
/* harmony import */ var
|
|
41480
|
-
/* harmony import */ var
|
|
41481
|
-
/* harmony import */ var
|
|
41543
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
41544
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
41545
|
+
/* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49574);
|
|
41546
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
41547
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
41548
|
+
/* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94193);
|
|
41482
41549
|
/*!
|
|
41483
41550
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41484
41551
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -41490,7 +41557,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
|
|
|
41490
41557
|
|
|
41491
41558
|
|
|
41492
41559
|
|
|
41493
|
-
|
|
41560
|
+
|
|
41561
|
+
|
|
41562
|
+
class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__.SourceEditor {
|
|
41494
41563
|
aceExists() {
|
|
41495
41564
|
return this.j.ow.ace !== undefined;
|
|
41496
41565
|
}
|
|
@@ -41548,7 +41617,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41548
41617
|
return;
|
|
41549
41618
|
}
|
|
41550
41619
|
const fakeMirror = this.j.c.div('jodit-source__mirror-fake');
|
|
41551
|
-
|
|
41620
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, fakeMirror);
|
|
41552
41621
|
const ace = editor.ow.ace;
|
|
41553
41622
|
this.instance = ace.edit(fakeMirror);
|
|
41554
41623
|
if (editor.o.direction === 'rtl') {
|
|
@@ -41569,15 +41638,15 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41569
41638
|
this.instance.setOption('wrap', editor.o.sourceEditorNativeOptions.wrap);
|
|
41570
41639
|
this.instance.getSession().setUseWorker(false);
|
|
41571
41640
|
this.instance.$blockScrolling = Infinity;
|
|
41572
|
-
this.instance.on('change', this.
|
|
41641
|
+
this.instance.on('change', this.__onChange);
|
|
41573
41642
|
this.instance.on('focus', this.proxyOnFocus);
|
|
41574
41643
|
this.instance.on('mousedown', this.proxyOnMouseDown);
|
|
41575
41644
|
this.instance.on('blur', this.proxyOnBlur);
|
|
41576
|
-
if (editor.getRealMode() !==
|
|
41645
|
+
if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
|
|
41577
41646
|
this.setValue(this.getValue());
|
|
41578
41647
|
}
|
|
41579
41648
|
const onResize = this.j.async.throttle(()=>{
|
|
41580
|
-
if (editor.isInDestruct || editor.getMode() ===
|
|
41649
|
+
if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
|
|
41581
41650
|
return;
|
|
41582
41651
|
}
|
|
41583
41652
|
const hasFocus = this.instance.isFocused();
|
|
@@ -41595,7 +41664,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41595
41664
|
};
|
|
41596
41665
|
let loading = false;
|
|
41597
41666
|
const initAceEditor = ()=>{
|
|
41598
|
-
if (editor.isInDestruct || editor.getRealMode() !==
|
|
41667
|
+
if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
|
|
41599
41668
|
return;
|
|
41600
41669
|
}
|
|
41601
41670
|
// ACE (~400 KiB from the CDN) is only needed once the source view
|
|
@@ -41604,7 +41673,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41604
41673
|
if (!this.aceExists()) {
|
|
41605
41674
|
if (!loading) {
|
|
41606
41675
|
loading = true;
|
|
41607
|
-
(0,
|
|
41676
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
|
|
41608
41677
|
}
|
|
41609
41678
|
return;
|
|
41610
41679
|
}
|
|
@@ -41616,7 +41685,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41616
41685
|
initAceEditor();
|
|
41617
41686
|
}
|
|
41618
41687
|
destruct() {
|
|
41619
|
-
this.instance.off('change', this.
|
|
41688
|
+
this.instance.off('change', this.__onChange);
|
|
41620
41689
|
this.instance.off('focus', this.proxyOnFocus);
|
|
41621
41690
|
this.instance.off('mousedown', this.proxyOnMouseDown);
|
|
41622
41691
|
this.instance.destroy();
|
|
@@ -41625,13 +41694,29 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41625
41694
|
setValue(value) {
|
|
41626
41695
|
if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
|
|
41627
41696
|
const html = this.j.e.fire('beautifyHTML', value);
|
|
41628
|
-
if ((0,
|
|
41697
|
+
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html)) {
|
|
41629
41698
|
value = html;
|
|
41630
41699
|
}
|
|
41631
41700
|
}
|
|
41632
|
-
|
|
41701
|
+
// ACE reports its own `setValue` as two changes, the removal of the
|
|
41702
|
+
// old text and the insertion of the new one. Fed back into the
|
|
41703
|
+
// editor they became two history entries, `content -> ''` and
|
|
41704
|
+
// `'' -> content`, so the first undo after a switch to the source
|
|
41705
|
+
// view and back emptied the editor. The text came from the editor
|
|
41706
|
+
// in the first place, so there is nothing to send back.
|
|
41707
|
+
this.__settingValue = true;
|
|
41708
|
+
try {
|
|
41709
|
+
this.instance.setValue(value);
|
|
41710
|
+
} finally{
|
|
41711
|
+
this.__settingValue = false;
|
|
41712
|
+
}
|
|
41633
41713
|
this.instance.clearSelection();
|
|
41634
41714
|
}
|
|
41715
|
+
__onChange() {
|
|
41716
|
+
if (!this.__settingValue) {
|
|
41717
|
+
this.toWYSIWYG();
|
|
41718
|
+
}
|
|
41719
|
+
}
|
|
41635
41720
|
getValue() {
|
|
41636
41721
|
return this.instance.getValue();
|
|
41637
41722
|
}
|
|
@@ -41705,9 +41790,12 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41705
41790
|
this.j.e.fire('focus', e);
|
|
41706
41791
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "proxyOnMouseDown", (e)=>{
|
|
41707
41792
|
this.j.e.fire('mousedown', e);
|
|
41708
|
-
});
|
|
41793
|
+
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__settingValue", false);
|
|
41709
41794
|
}
|
|
41710
41795
|
}
|
|
41796
|
+
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41797
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41798
|
+
], AceEditor.prototype, "__onChange", null);
|
|
41711
41799
|
|
|
41712
41800
|
|
|
41713
41801
|
/***/ }),
|