jodit 4.2.7 → 4.2.10
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 +23 -5
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +62 -44
- 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 +62 -44
- 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 +59 -44
- 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 +59 -44
- 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/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +62 -46
- 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/ui/group/list.js +2 -1
- package/esm/plugins/color/config.js +37 -1
- package/esm/plugins/image-properties/readers/size.js +11 -6
- package/esm/plugins/image-properties/writers/size.js +4 -1
- package/esm/plugins/inline-popup/config/items/cells.js +1 -31
- package/esm/types/toolbar.d.ts +1 -0
- package/package.json +1 -1
- package/types/types/toolbar.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.10";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -112,7 +112,8 @@ let UIList = class UIList extends UIGroup {
|
|
|
112
112
|
group.append(elm);
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
const isNotRemoved = (b) => !this.removeButtons.includes(b.name)
|
|
115
|
+
const isNotRemoved = (b) => !this.removeButtons.includes(b.name) &&
|
|
116
|
+
(!b.isVisible || b.isVisible?.(this.j, b));
|
|
116
117
|
items.forEach(item => {
|
|
117
118
|
if (isButtonGroup(item)) {
|
|
118
119
|
const buttons = item.buttons.filter(b => b);
|
|
@@ -4,13 +4,49 @@
|
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { Dom } from "jodit/esm/core/dom/dom.js";
|
|
7
|
-
import { css, dataBind } from "jodit/esm/core/helpers/index.js";
|
|
7
|
+
import { css, dataBind, isJoditObject } from "jodit/esm/core/helpers/index.js";
|
|
8
8
|
import { Icon } from "jodit/esm/core/ui/icon.js";
|
|
9
9
|
import { ColorPickerWidget, TabsWidget } from "jodit/esm/modules/widget/index.js";
|
|
10
10
|
import brushIcon from "./brush.svg.js";
|
|
11
11
|
import { Config } from "jodit/esm/config.js";
|
|
12
12
|
Icon.set('brush', brushIcon);
|
|
13
|
+
Config.prototype.controls.brushCell = {
|
|
14
|
+
isVisible: (editor) => {
|
|
15
|
+
return !editor.o.disablePlugins.includes('color');
|
|
16
|
+
},
|
|
17
|
+
icon: 'brush',
|
|
18
|
+
popup: (editor, _, close) => {
|
|
19
|
+
if (!isJoditObject(editor)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const tableModule = editor.getInstance('Table', editor.o), selected = tableModule.getAllSelectedCells();
|
|
23
|
+
if (!selected.length) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const makeColorPicker = (key) => ColorPickerWidget(editor, (value) => {
|
|
27
|
+
selected.forEach(cell => {
|
|
28
|
+
css(cell, key, value);
|
|
29
|
+
});
|
|
30
|
+
editor.lock();
|
|
31
|
+
editor.synchronizeValues();
|
|
32
|
+
close();
|
|
33
|
+
editor.unlock();
|
|
34
|
+
}, css(selected[0], key));
|
|
35
|
+
return TabsWidget(editor, [
|
|
36
|
+
{
|
|
37
|
+
name: 'Background',
|
|
38
|
+
content: makeColorPicker('background-color')
|
|
39
|
+
},
|
|
40
|
+
{ name: 'Text', content: makeColorPicker('color') },
|
|
41
|
+
{ name: 'Border', content: makeColorPicker('border-color') }
|
|
42
|
+
]);
|
|
43
|
+
},
|
|
44
|
+
tooltip: 'Background'
|
|
45
|
+
};
|
|
13
46
|
Config.prototype.controls.brush = {
|
|
47
|
+
isVisible: (editor) => {
|
|
48
|
+
return !editor.o.disablePlugins.includes('color');
|
|
49
|
+
},
|
|
14
50
|
update(editor, button) {
|
|
15
51
|
const color = dataBind(button, 'color');
|
|
16
52
|
const update = (key, value) => {
|
|
@@ -10,16 +10,21 @@ import { normalSizeFromString } from "../utils/utils";
|
|
|
10
10
|
/** @private */
|
|
11
11
|
export async function readSizes(image, values, state) {
|
|
12
12
|
await image.decode();
|
|
13
|
-
const width =
|
|
14
|
-
const height =
|
|
13
|
+
const width = css(image, 'width', true) || attr(image, 'width') || false;
|
|
14
|
+
const height = css(image, 'height', true) || attr(image, 'height') || false;
|
|
15
15
|
values.imageWidth =
|
|
16
16
|
width !== false
|
|
17
17
|
? normalSizeFromString(width)
|
|
18
18
|
: image.offsetWidth || image.naturalWidth;
|
|
19
|
-
values.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
if (isNumeric(values.imageWidth)) {
|
|
20
|
+
values.imageHeight =
|
|
21
|
+
height !== false
|
|
22
|
+
? normalSizeFromString(height)
|
|
23
|
+
: image.offsetHeight || image.naturalHeight;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
values.imageHeight = height || '';
|
|
27
|
+
}
|
|
23
28
|
const { imageWidth, imageHeight } = values;
|
|
24
29
|
const w = parseFloat(imageWidth.toString());
|
|
25
30
|
if (!isNumeric(imageWidth) || !isNumeric(imageHeight)) {
|
|
@@ -3,6 +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
|
+
import { isNumeric } from "jodit/esm/core/helpers/checker/is-numeric.js";
|
|
6
7
|
import { attr } from "jodit/esm/core/helpers/utils/attr.js";
|
|
7
8
|
import { css } from "jodit/esm/core/helpers/utils/css.js";
|
|
8
9
|
import { normalSizeToString } from "../utils/utils";
|
|
@@ -19,7 +20,9 @@ export function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
|
|
|
19
20
|
width: updatedWidth,
|
|
20
21
|
height: updatedWidth && sizeIsLocked ? null : updatedHeight
|
|
21
22
|
});
|
|
22
|
-
attr(image, 'width', attr(image, 'width')
|
|
23
|
+
attr(image, 'width', updatedWidth && isNumeric(imageWidth) && attr(image, 'width')
|
|
24
|
+
? updatedWidth
|
|
25
|
+
: null);
|
|
23
26
|
if (!attr(image, 'width') || sizeIsLocked) {
|
|
24
27
|
updatedHeight = null;
|
|
25
28
|
}
|
|
@@ -5,41 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { isJoditObject, isString } from "jodit/esm/core/helpers/checker/index.js";
|
|
7
7
|
import { css } from "jodit/esm/core/helpers/utils/css.js";
|
|
8
|
-
import { ColorPickerWidget, TabsWidget } from "jodit/esm/modules/widget/index.js";
|
|
9
8
|
const cmd = (control) => control.args && isString(control.args[0])
|
|
10
9
|
? control.args[0].toLowerCase()
|
|
11
10
|
: '';
|
|
12
11
|
export default [
|
|
13
|
-
|
|
14
|
-
name: 'brush',
|
|
15
|
-
popup: (editor, _, close) => {
|
|
16
|
-
if (!isJoditObject(editor)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const tableModule = editor.getInstance('Table', editor.o), selected = tableModule.getAllSelectedCells();
|
|
20
|
-
if (!selected.length) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
const makeColorPicker = (key) => ColorPickerWidget(editor, (value) => {
|
|
24
|
-
selected.forEach(cell => {
|
|
25
|
-
css(cell, key, value);
|
|
26
|
-
});
|
|
27
|
-
editor.lock();
|
|
28
|
-
editor.synchronizeValues();
|
|
29
|
-
close();
|
|
30
|
-
editor.unlock();
|
|
31
|
-
}, css(selected[0], key));
|
|
32
|
-
return TabsWidget(editor, [
|
|
33
|
-
{
|
|
34
|
-
name: 'Background',
|
|
35
|
-
content: makeColorPicker('background-color')
|
|
36
|
-
},
|
|
37
|
-
{ name: 'Text', content: makeColorPicker('color') },
|
|
38
|
-
{ name: 'Border', content: makeColorPicker('border-color') }
|
|
39
|
-
]);
|
|
40
|
-
},
|
|
41
|
-
tooltip: 'Background'
|
|
42
|
-
},
|
|
12
|
+
'brushCell',
|
|
43
13
|
{
|
|
44
14
|
name: 'valign',
|
|
45
15
|
list: ['Top', 'Middle', 'Bottom', 'Normal'],
|
package/esm/types/toolbar.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser
|
|
|
21
21
|
data?: IDictionary;
|
|
22
22
|
isInput?: boolean;
|
|
23
23
|
component?: 'button' | 'select';
|
|
24
|
+
isVisible?: (editor: T, control: IControlType) => boolean;
|
|
24
25
|
/**
|
|
25
26
|
* You can use it function for control - active/not active button
|
|
26
27
|
*
|
package/package.json
CHANGED
package/types/types/toolbar.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser
|
|
|
21
21
|
data?: IDictionary;
|
|
22
22
|
isInput?: boolean;
|
|
23
23
|
component?: 'button' | 'select';
|
|
24
|
+
isVisible?: (editor: T, control: IControlType) => boolean;
|
|
24
25
|
/**
|
|
25
26
|
* You can use it function for control - active/not active button
|
|
26
27
|
*
|