jodit 4.2.34 → 4.2.37
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 -5
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +41 -24
- package/es2015/jodit.min.js +2 -2
- 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.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +41 -24
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.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 +2 -2
- package/es2021/jodit.js +41 -24
- package/es2021/jodit.min.js +2 -2
- 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 +2 -2
- package/es2021.en/jodit.js +41 -24
- package/es2021.en/jodit.min.js +2 -2
- 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/164.fat.min.js +1 -1
- package/es5/164.min.js +1 -1
- package/es5/5.fat.min.js +1 -1
- package/es5/5.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +41 -24
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- 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/esm/core/constants.js +1 -1
- package/esm/core/selection/selection.js +3 -7
- package/esm/modules/history/snapshot.d.ts +1 -1
- package/esm/modules/history/snapshot.js +10 -8
- package/esm/plugins/link/link.js +10 -4
- package/esm/plugins/resizer/resizer.d.ts +1 -0
- package/esm/plugins/resizer/resizer.js +13 -0
- package/package.json +1 -1
- package/types/modules/history/snapshot.d.ts +1 -1
- package/types/plugins/resizer/resizer.d.ts +1 -0
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.2.
|
|
6
|
+
export const APP_VERSION = "4.2.37";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -17,7 +17,7 @@ import * as consts from "../constants.js";
|
|
|
17
17
|
import { INSEPARABLE_TAGS, INVISIBLE_SPACE, IS_PROD } from "../constants.js";
|
|
18
18
|
import { autobind } from "../decorators/index.js";
|
|
19
19
|
import { Dom } from "../dom/dom.js";
|
|
20
|
-
import { $$, attr,
|
|
20
|
+
import { $$, attr, css, error, getScrollParent, scrollIntoViewIfNeeded, size, toArray } from "../helpers/index.js";
|
|
21
21
|
import { isFunction, isMarker, isString } from "../helpers/checker/index.js";
|
|
22
22
|
import { assert } from "../helpers/utils/assert.js";
|
|
23
23
|
import { moveTheNodeAlongTheEdgeOutward } from "./helpers/move-the-node-along-the-edge-outward.js";
|
|
@@ -555,11 +555,7 @@ export class Selection {
|
|
|
555
555
|
String(dw).indexOf('%') < 0) {
|
|
556
556
|
dw += 'px';
|
|
557
557
|
}
|
|
558
|
-
|
|
559
|
-
// @ts-ignore
|
|
560
|
-
this.j.o.resizer.forImageChangeAttributes ? attr : css, image, 'width',
|
|
561
|
-
// @ts-ignore
|
|
562
|
-
dw);
|
|
558
|
+
attr(image, 'width', dw);
|
|
563
559
|
}
|
|
564
560
|
if (styles && typeof styles === 'object') {
|
|
565
561
|
css(image, styles);
|
|
@@ -582,7 +578,7 @@ export class Selection {
|
|
|
582
578
|
* [[FileBrowser]] or [[Uploader]]
|
|
583
579
|
* @example
|
|
584
580
|
* ```javascript
|
|
585
|
-
*
|
|
581
|
+
* const editor = Jodit.make("#redactor");
|
|
586
582
|
* editor.e.on('afterInsertImage', function (image) {
|
|
587
583
|
* image.className = 'bloghead4';
|
|
588
584
|
* });
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { ViewComponent } from "../../core/component/index.js";
|
|
7
|
-
import { IS_PROD
|
|
8
|
-
import { Dom } from "../../core/dom/
|
|
7
|
+
import { IS_PROD } from "../../core/constants.js";
|
|
8
|
+
import { Dom } from "../../core/dom/dom.js";
|
|
9
9
|
/**
|
|
10
10
|
* Module for creating snapshot of editor which includes html content and the current selection
|
|
11
11
|
*/
|
|
@@ -119,10 +119,12 @@ export class Snapshot extends ViewComponent {
|
|
|
119
119
|
endOffset: 0
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
snapshot.html = this.
|
|
122
|
+
snapshot.html = this.__getCleanedEditorValue(this.j.editor);
|
|
123
123
|
const sel = this.j.s.sel;
|
|
124
124
|
if (sel && sel.rangeCount) {
|
|
125
|
-
const range = sel.getRangeAt(0)
|
|
125
|
+
const range = sel.getRangeAt(0);
|
|
126
|
+
const startContainer = this.calcHierarchyLadder(range.startContainer);
|
|
127
|
+
const endContainer = this.calcHierarchyLadder(range.endContainer);
|
|
126
128
|
let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
|
|
127
129
|
if (!startContainer.length &&
|
|
128
130
|
range.startContainer !== this.j.editor) {
|
|
@@ -149,8 +151,8 @@ export class Snapshot extends ViewComponent {
|
|
|
149
151
|
restore(snapshot) {
|
|
150
152
|
this.transaction(() => {
|
|
151
153
|
const scroll = this.storeScrollState();
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
+
const html = this.__getCleanedEditorValue(this.j.editor);
|
|
155
|
+
if (html !== snapshot.html) {
|
|
154
156
|
this.j.value = snapshot.html;
|
|
155
157
|
}
|
|
156
158
|
this.restoreOnlySelection(snapshot);
|
|
@@ -196,9 +198,9 @@ export class Snapshot extends ViewComponent {
|
|
|
196
198
|
static isIgnoredNode(node) {
|
|
197
199
|
return (Dom.isText(node) && !node.nodeValue) || Dom.isTemporary(node);
|
|
198
200
|
}
|
|
199
|
-
|
|
201
|
+
__getCleanedEditorValue(node) {
|
|
200
202
|
const clone = node.cloneNode(true);
|
|
201
|
-
|
|
203
|
+
Dom.temporaryList(clone).forEach(Dom.unwrap);
|
|
202
204
|
return clone.innerHTML;
|
|
203
205
|
}
|
|
204
206
|
}
|
package/esm/plugins/link/link.js
CHANGED
|
@@ -101,13 +101,19 @@ export class link extends Plugin {
|
|
|
101
101
|
__generateForm(current, close) {
|
|
102
102
|
const { jodit } = this;
|
|
103
103
|
const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
104
|
-
const html = formTemplate(jodit)
|
|
104
|
+
const html = formTemplate(jodit);
|
|
105
|
+
const form = isString(html)
|
|
105
106
|
? jodit.c.fromHTML(html, {
|
|
106
107
|
target_checkbox_box: openInNewTabCheckbox,
|
|
107
108
|
nofollow_checkbox_box: noFollowCheckbox
|
|
108
109
|
})
|
|
109
|
-
: html
|
|
110
|
-
const
|
|
110
|
+
: html;
|
|
111
|
+
const htmlForm = Dom.isElement(form) ? form : form.container;
|
|
112
|
+
const elements = refs(htmlForm);
|
|
113
|
+
const { insert, unlink, content_input_box } = elements;
|
|
114
|
+
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
115
|
+
const currentElement = current;
|
|
116
|
+
const isImageContent = Dom.isImage(currentElement);
|
|
111
117
|
let { content_input } = elements;
|
|
112
118
|
const { className_input } = elements, { className_select } = elements;
|
|
113
119
|
if (!content_input) {
|
|
@@ -178,7 +184,7 @@ export class link extends Plugin {
|
|
|
178
184
|
jodit.history.snapshot.restore(snapshot);
|
|
179
185
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
180
186
|
const ci = jodit.createInside;
|
|
181
|
-
if (!link) {
|
|
187
|
+
if (!link || !Dom.isOrContains(jodit.editor, link)) {
|
|
182
188
|
if (!jodit.s.isCollapsed()) {
|
|
183
189
|
const node = jodit.s.current();
|
|
184
190
|
if (Dom.isTag(node, 'img')) {
|
|
@@ -34,6 +34,7 @@ export declare class resizer extends Plugin {
|
|
|
34
34
|
* Click in the editor area
|
|
35
35
|
*/
|
|
36
36
|
protected onEditorClick(e: MouseEvent): void;
|
|
37
|
+
protected __afterInsertImage(image: HTMLImageElement): void;
|
|
37
38
|
private addEventListeners;
|
|
38
39
|
private onStartResizing;
|
|
39
40
|
private onEndResizing;
|
|
@@ -129,6 +129,16 @@ export class resizer extends Plugin {
|
|
|
129
129
|
node = node.parentNode;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
__afterInsertImage(image) {
|
|
133
|
+
if (this.j.o.resizer.forImageChangeAttributes) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const width = attr(image, 'width');
|
|
137
|
+
if (width && !css(image, 'width', true)) {
|
|
138
|
+
css(image, 'width', width);
|
|
139
|
+
attr(image, 'width', null);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
132
142
|
addEventListeners() {
|
|
133
143
|
const editor = this.j;
|
|
134
144
|
editor.e
|
|
@@ -424,6 +434,9 @@ export class resizer extends Plugin {
|
|
|
424
434
|
__decorate([
|
|
425
435
|
watch(':click')
|
|
426
436
|
], resizer.prototype, "onEditorClick", null);
|
|
437
|
+
__decorate([
|
|
438
|
+
watch(':afterInsertImage')
|
|
439
|
+
], resizer.prototype, "__afterInsertImage", null);
|
|
427
440
|
__decorate([
|
|
428
441
|
autobind
|
|
429
442
|
], resizer.prototype, "onStartResizing", null);
|
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ export declare class resizer extends Plugin {
|
|
|
34
34
|
* Click in the editor area
|
|
35
35
|
*/
|
|
36
36
|
protected onEditorClick(e: MouseEvent): void;
|
|
37
|
+
protected __afterInsertImage(image: HTMLImageElement): void;
|
|
37
38
|
private addEventListeners;
|
|
38
39
|
private onStartResizing;
|
|
39
40
|
private onEndResizing;
|