jodit 4.2.41 → 4.2.45

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +65 -5
  2. package/es2015/jodit.css +5 -7
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +121 -45
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.css +5 -7
  15. package/es2018/jodit.fat.min.css +1 -1
  16. package/es2018/jodit.fat.min.js +2 -2
  17. package/es2018/jodit.js +121 -45
  18. package/es2018/jodit.min.css +1 -1
  19. package/es2018/jodit.min.js +2 -2
  20. package/es2018/plugins/debug/debug.css +1 -1
  21. package/es2018/plugins/debug/debug.js +1 -1
  22. package/es2018/plugins/debug/debug.min.js +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021/jodit.css +5 -7
  27. package/es2021/jodit.fat.min.css +1 -1
  28. package/es2021/jodit.fat.min.js +2 -2
  29. package/es2021/jodit.js +121 -45
  30. package/es2021/jodit.min.css +1 -1
  31. package/es2021/jodit.min.js +2 -2
  32. package/es2021/plugins/debug/debug.css +1 -1
  33. package/es2021/plugins/debug/debug.js +1 -1
  34. package/es2021/plugins/debug/debug.min.js +1 -1
  35. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  36. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  37. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  38. package/es2021.en/jodit.css +5 -7
  39. package/es2021.en/jodit.fat.min.css +1 -1
  40. package/es2021.en/jodit.fat.min.js +2 -2
  41. package/es2021.en/jodit.js +121 -45
  42. package/es2021.en/jodit.min.css +1 -1
  43. package/es2021.en/jodit.min.js +2 -2
  44. package/es2021.en/plugins/debug/debug.css +1 -1
  45. package/es2021.en/plugins/debug/debug.js +1 -1
  46. package/es2021.en/plugins/debug/debug.min.js +1 -1
  47. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  48. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  49. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  50. package/es5/164.fat.min.js +1 -1
  51. package/es5/164.min.js +1 -1
  52. package/es5/5.fat.min.js +1 -1
  53. package/es5/5.min.js +1 -1
  54. package/es5/jodit.css +35 -66
  55. package/es5/jodit.fat.min.css +1 -1
  56. package/es5/jodit.fat.min.js +2 -2
  57. package/es5/jodit.js +121 -45
  58. package/es5/jodit.min.css +3 -3
  59. package/es5/jodit.min.js +2 -2
  60. package/es5/plugins/debug/debug.css +1 -1
  61. package/es5/plugins/debug/debug.js +1 -1
  62. package/es5/plugins/debug/debug.min.js +1 -1
  63. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  64. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  65. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  66. package/esm/core/constants.js +1 -1
  67. package/esm/core/helpers/utils/complete-url.d.ts +0 -3
  68. package/esm/core/helpers/utils/complete-url.js +1 -1
  69. package/esm/core/helpers/utils/config-proto.d.ts +18 -0
  70. package/esm/core/helpers/utils/config-proto.js +25 -0
  71. package/esm/core/selection/style/api/extract.js +1 -0
  72. package/esm/jodit.d.ts +11 -1
  73. package/esm/jodit.js +14 -8
  74. package/esm/modules/history/snapshot.d.ts +1 -0
  75. package/esm/modules/history/snapshot.js +8 -1
  76. package/esm/modules/toolbar/button/button.js +18 -9
  77. package/esm/plugins/ai-assistant/langs/index.d.ts +3 -0
  78. package/esm/plugins/ai-assistant/langs/index.js +3 -0
  79. package/esm/plugins/image-properties/readers/align.d.ts +3 -1
  80. package/esm/plugins/image-properties/readers/align.js +3 -1
  81. package/esm/plugins/image-properties/readers/index.d.ts +3 -0
  82. package/esm/plugins/image-properties/readers/link.d.ts +3 -0
  83. package/esm/plugins/image-properties/readers/margin.js +3 -0
  84. package/esm/plugins/image-properties/readers/size.js +3 -0
  85. package/esm/plugins/image-properties/ui/ui-image-form.d.ts +3 -0
  86. package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +3 -0
  87. package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +3 -0
  88. package/esm/plugins/image-properties/utils/open-image-editor.d.ts +3 -0
  89. package/esm/plugins/image-properties/utils/open-image-popup.d.ts +3 -0
  90. package/esm/plugins/image-properties/utils/utils.js +3 -0
  91. package/esm/plugins/image-properties/writers/index.d.ts +3 -0
  92. package/esm/plugins/image-properties/writers/link.d.ts +3 -0
  93. package/esm/plugins/image-properties/writers/margin.d.ts +3 -0
  94. package/esm/plugins/image-properties/writers/size.js +3 -0
  95. package/esm/plugins/source/editor/engines/ace.js +4 -0
  96. package/esm/plugins/source/editor/engines/area.js +2 -1
  97. package/esm/plugins/symbols/config.js +6 -7
  98. package/esm/plugins/symbols/symbols.d.ts +1 -3
  99. package/esm/plugins/symbols/symbols.js +16 -11
  100. package/esm/types/history.d.ts +3 -0
  101. package/package.json +1 -1
  102. package/types/core/helpers/utils/complete-url.d.ts +0 -3
  103. package/types/core/helpers/utils/config-proto.d.ts +18 -0
  104. package/types/jodit.d.ts +11 -1
  105. package/types/modules/history/snapshot.d.ts +1 -0
  106. package/types/plugins/ai-assistant/langs/index.d.ts +3 -0
  107. package/types/plugins/image-properties/readers/align.d.ts +3 -1
  108. package/types/plugins/image-properties/readers/index.d.ts +3 -0
  109. package/types/plugins/image-properties/readers/link.d.ts +3 -0
  110. package/types/plugins/image-properties/ui/ui-image-form.d.ts +3 -0
  111. package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +3 -0
  112. package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +3 -0
  113. package/types/plugins/image-properties/utils/open-image-editor.d.ts +3 -0
  114. package/types/plugins/image-properties/utils/open-image-popup.d.ts +3 -0
  115. package/types/plugins/image-properties/writers/index.d.ts +3 -0
  116. package/types/plugins/image-properties/writers/link.d.ts +3 -0
  117. package/types/plugins/image-properties/writers/margin.d.ts +3 -0
  118. package/types/plugins/symbols/symbols.d.ts +1 -3
  119. package/types/types/history.d.ts +3 -0
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.2.41
4
+ * Version: v4.2.45
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.41";
6
+ export const APP_VERSION = "4.2.45";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -3,7 +3,4 @@
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
- /**
7
- * @module helpers/utils
8
- */
9
6
  export declare const completeUrl: (url: string) => string;
@@ -3,10 +3,10 @@
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 { globalWindow } from "../../constants.js";
7
6
  /**
8
7
  * @module helpers/utils
9
8
  */
9
+ import { globalWindow } from "../../constants.js";
10
10
  export const completeUrl = (url) => {
11
11
  if (globalWindow.location.protocol === 'file:' && /^\/\//.test(url)) {
12
12
  url = 'https:' + url;
@@ -39,3 +39,21 @@ import type { IDictionary } from "../../../types";
39
39
  */
40
40
  export declare function ConfigProto(options: IDictionary, proto: IDictionary, deep?: number): IDictionary;
41
41
  export declare function ConfigFlatten(obj: IDictionary): IDictionary;
42
+ /**
43
+ * Returns a plain object from a prototype-based object.
44
+ * ```typescript
45
+ * const editor = Jodit.make('#editor', {
46
+ * image: {
47
+ * dialogWidth: 500
48
+ * }
49
+ * });
50
+ *
51
+ * console.log(editor.o.image.openOnDblClick) // true
52
+ * // But you can't get all options in plain object
53
+ * console.log(JSON.stringify(editor.o.image)); // {"dialogWidth":500}
54
+ *
55
+ * const plain = Jodit.modules.Helpers.ConfigDeepFlatten(editor.o.image);
56
+ * console.log(JSON.stringify(plain)); // {"dialogWidth":500, "openOnDblClick": true, "editSrc": true, ...}
57
+ * ```
58
+ */
59
+ export declare function ConfigDeepFlatten(obj: IDictionary): IDictionary;
@@ -80,3 +80,28 @@ export function ConfigFlatten(obj) {
80
80
  return app;
81
81
  }, {});
82
82
  }
83
+ /**
84
+ * Returns a plain object from a prototype-based object.
85
+ * ```typescript
86
+ * const editor = Jodit.make('#editor', {
87
+ * image: {
88
+ * dialogWidth: 500
89
+ * }
90
+ * });
91
+ *
92
+ * console.log(editor.o.image.openOnDblClick) // true
93
+ * // But you can't get all options in plain object
94
+ * console.log(JSON.stringify(editor.o.image)); // {"dialogWidth":500}
95
+ *
96
+ * const plain = Jodit.modules.Helpers.ConfigDeepFlatten(editor.o.image);
97
+ * console.log(JSON.stringify(plain)); // {"dialogWidth":500, "openOnDblClick": true, "editSrc": true, ...}
98
+ * ```
99
+ */
100
+ export function ConfigDeepFlatten(obj) {
101
+ return keys(obj, false).reduce((app, key) => {
102
+ app[key] = isPlainObject(obj[key])
103
+ ? ConfigDeepFlatten(obj[key])
104
+ : obj[key];
105
+ return app;
106
+ }, {});
107
+ }
@@ -40,6 +40,7 @@ export function extractSelectedPart(wrapper, font, jodit) {
40
40
  }
41
41
  /**
42
42
  * Retrieves content before after the selected area, clears it if it is empty, and inserts before after the framed selection
43
+ * @private
43
44
  */
44
45
  function extractAndMove(wrapper, range, left) {
45
46
  const fragment = range.extractContents();
package/esm/jodit.d.ts CHANGED
@@ -49,7 +49,17 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
49
49
  */
50
50
  get defaultTimeout(): number;
51
51
  /**
52
- * Method wrap usual Has Object in Object helper for prevent deep object merging in options*
52
+ * Method wrap usual object in Object helper for prevent deep object merging in options*
53
+ * ```js
54
+ * const editor = Jodit.make('#editor', {
55
+ * controls: {
56
+ * fontsize: {
57
+ * list: Jodit.atom([8, 9, 10])
58
+ * }
59
+ * }
60
+ * });
61
+ * ```
62
+ * In this case, the array [8, 9, 10] will not be combined with other arrays, but will replace them
53
63
  */
54
64
  static atom<T>(object: T): T;
55
65
  /**
package/esm/jodit.js CHANGED
@@ -75,7 +75,17 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
75
75
  : Config.defaultOptions.defaultTimeout;
76
76
  }
77
77
  /**
78
- * Method wrap usual Has Object in Object helper for prevent deep object merging in options*
78
+ * Method wrap usual object in Object helper for prevent deep object merging in options*
79
+ * ```js
80
+ * const editor = Jodit.make('#editor', {
81
+ * controls: {
82
+ * fontsize: {
83
+ * list: Jodit.atom([8, 9, 10])
84
+ * }
85
+ * }
86
+ * });
87
+ * ```
88
+ * In this case, the array [8, 9, 10] will not be combined with other arrays, but will replace them
79
89
  */
80
90
  static atom(object) {
81
91
  return markAsAtomic(object);
@@ -1080,13 +1090,6 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
1080
1090
  })
1081
1091
  .on('blur', () => (this.editorIsActive = false));
1082
1092
  this.__prepareWYSIWYGEditor();
1083
- // direction
1084
- if (this.o.direction) {
1085
- const direction = this.o.direction.toLowerCase() === 'rtl' ? 'rtl' : 'ltr';
1086
- this.container.style.direction = direction;
1087
- this.container.setAttribute('dir', direction);
1088
- this.toolbar.setDirection(direction);
1089
- }
1090
1093
  if (this.o.triggerChangeEvent) {
1091
1094
  this.e.on('change', this.async.debounce(() => {
1092
1095
  this.e && this.e.fire(this.element, 'change');
@@ -1104,6 +1107,9 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
1104
1107
  const direction = this.o.direction.toLowerCase() === 'rtl' ? 'rtl' : 'ltr';
1105
1108
  this.editor.style.direction = direction;
1106
1109
  this.editor.setAttribute('dir', direction);
1110
+ this.container.style.direction = direction;
1111
+ this.container.setAttribute('dir', direction);
1112
+ this.toolbar.setDirection(direction);
1107
1113
  }
1108
1114
  // proxy events
1109
1115
  this.e
@@ -37,6 +37,7 @@ export declare class Snapshot extends ViewComponent<IJodit> implements ISnapshot
37
37
  private __isBlocked;
38
38
  get isBlocked(): boolean;
39
39
  private __block;
40
+ private __levelOfTransaction;
40
41
  transaction(changes: () => void): void;
41
42
  /**
42
43
  * Creates object a snapshot of editor: html and the current selection. Current selection calculate by
@@ -13,6 +13,7 @@ export class Snapshot extends ViewComponent {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  this.__isBlocked = false;
16
+ this.__levelOfTransaction = 0;
16
17
  }
17
18
  /** @override */
18
19
  className() {
@@ -93,6 +94,7 @@ export class Snapshot extends ViewComponent {
93
94
  }
94
95
  transaction(changes) {
95
96
  this.__block(true);
97
+ this.__levelOfTransaction += 1;
96
98
  try {
97
99
  changes();
98
100
  }
@@ -101,7 +103,12 @@ export class Snapshot extends ViewComponent {
101
103
  throw e;
102
104
  }
103
105
  }
104
- this.__block(false);
106
+ finally {
107
+ this.__levelOfTransaction -= 1;
108
+ if (this.__levelOfTransaction === 0) {
109
+ this.__block(false);
110
+ }
111
+ }
105
112
  }
106
113
  /**
107
114
  * Creates object a snapshot of editor: html and the current selection. Current selection calculate by
@@ -221,17 +221,26 @@ let ToolbarButton = class ToolbarButton extends UIButton {
221
221
  if (isFunction(ctr.popup)) {
222
222
  const popup = this.openPopup();
223
223
  popup.parentElement = this;
224
- if (this.j.e.fire(camelCase(`before-${ctr.name}-open-popup`), this.target, ctr, popup) !== false) {
225
- const target = this.toolbar?.getTarget(this) ?? this.target ?? null;
226
- const elm = ctr.popup(this.j, target, this.__closePopup, this);
227
- if (elm) {
228
- popup
229
- .setContent(isString(elm) ? this.j.c.fromHTML(elm) : elm)
230
- .open(() => position(this.container), false, this.j.o.allowTabNavigation
231
- ? this.container
232
- : undefined);
224
+ try {
225
+ if (this.j.e.fire(camelCase(`before-${ctr.name}-open-popup`), this.target, ctr, popup) !== false) {
226
+ const target = this.toolbar?.getTarget(this) ?? this.target ?? null;
227
+ const elm = ctr.popup(this.j, target, this.__closePopup, this);
228
+ if (elm) {
229
+ popup
230
+ .setContent(isString(elm) ? this.j.c.fromHTML(elm) : elm)
231
+ .open(() => position(this.container), false, this.j.o.allowTabNavigation
232
+ ? this.container
233
+ : undefined);
234
+ }
235
+ else {
236
+ this.__closePopup();
237
+ }
233
238
  }
234
239
  }
240
+ catch (e) {
241
+ this.__closePopup();
242
+ throw e;
243
+ }
235
244
  /**
236
245
  * Fired after the popup was opened for some control button
237
246
  */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/ai-assistant
8
+ */
6
9
  import * as en from "./en.js";
7
10
  import * as es from "./es.js";
8
11
  export { en, es };
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/ai-assistant
8
+ */
6
9
  import * as en from "./en.js";
7
10
  import * as es from "./es.js";
8
11
  export { en, es };
@@ -4,5 +4,7 @@
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import type { EditValues } from "../interface";
7
- /** @private */
7
+ /**
8
+ * @private
9
+ */
8
10
  export declare function readAlign(image: HTMLImageElement, values: EditValues): void;
@@ -4,7 +4,9 @@
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { css } from "../../../core/helpers/utils/css.js";
7
- /** @private */
7
+ /**
8
+ * @private
9
+ */
8
10
  export function readAlign(image, values) {
9
11
  // Align
10
12
  if (image.style.cssFloat &&
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { EditValues, ImagePropertiesState } from "../interface";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { kebabCase } from "../../../core/helpers/string/kebab-case.js";
7
10
  /** @private */
8
11
  export function readMargins(image, values, state) {
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
7
10
  import { attr } from "../../../core/helpers/utils/attr.js";
8
11
  import { css } from "../../../core/helpers/utils/css.js";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IComponent, IContainer, IElms, IJodit, Nullable } from "../../../types";
7
10
  import { UIGroup } from "../../../core/ui/group/group";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import { UIGroup } from "../../../core/ui/group/group";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import { UIElement } from "../../../core/ui/element";
8
11
  import type { ImagePropertiesAPI, ImagePropertiesState } from "../interface";
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IDialog, IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumber } from "../../../core/helpers/checker/is-number.js";
7
10
  import { trim } from "../../../core/helpers/string/trim.js";
8
11
  /** @private */
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  import type { ImagePropertiesState } from "../interface";
8
11
  /**
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  /** @private */
8
11
  export declare function applyLink(j: IJodit, image: HTMLImageElement, imageLink: string, imageLinkOpenInNewTab: boolean): void;
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import type { IJodit } from "../../../types";
7
10
  /** @private */
8
11
  export declare function applyMargin(j: IJodit, marginTop: number | string, marginRight: number | string, marginBottom: number | string, marginLeft: number | string, image: HTMLImageElement, marginIsLocked: boolean): void;
@@ -3,6 +3,9 @@
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
+ /**
7
+ * @module plugins/image-properties
8
+ */
6
9
  import { isNumeric } from "../../../core/helpers/checker/is-numeric.js";
7
10
  import { attr } from "../../../core/helpers/utils/attr.js";
8
11
  import { css } from "../../../core/helpers/utils/css.js";
@@ -77,6 +77,10 @@ export class AceEditor extends SourceEditor {
77
77
  this.container.appendChild(fakeMirror);
78
78
  const ace = editor.ow.ace;
79
79
  this.instance = ace.edit(fakeMirror);
80
+ if (editor.o.direction === 'rtl') {
81
+ this.instance.setOption('rtlText', true);
82
+ this.instance.setOption('rtl', true);
83
+ }
80
84
  this.instance.setTheme(editor.o.sourceEditorNativeOptions.theme);
81
85
  this.instance.renderer.setShowGutter(editor.o.sourceEditorNativeOptions.showGutter);
82
86
  this.instance
@@ -16,7 +16,8 @@ export class TextAreaEditor extends SourceEditor {
16
16
  }
17
17
  init(editor) {
18
18
  this.instance = editor.c.element('textarea', {
19
- class: 'jodit-source__mirror'
19
+ class: 'jodit-source__mirror',
20
+ dir: editor.o.direction === 'rtl' ? 'rtl' : undefined
20
21
  });
21
22
  this.container.appendChild(this.instance);
22
23
  editor.e
@@ -233,13 +233,12 @@ Config.prototype.controls.symbols = {
233
233
  editor.e.on(container, 'close_dialog', close);
234
234
  return box;
235
235
  }
236
- else {
237
- editor
238
- .alert(container, 'Select Special Character', undefined, 'jodit-symbols')
239
- .bindDestruct(editor);
240
- const a = container.querySelector('a');
241
- a && a.focus();
242
- }
236
+ editor
237
+ .alert(container, 'Select Special Character', undefined, 'jodit-symbols')
238
+ .bindDestruct(editor);
239
+ const a = container.querySelector('a');
240
+ a && a.focus();
243
241
  }
242
+ return;
244
243
  }
245
244
  };
@@ -16,11 +16,9 @@ import "./config";
16
16
  * The plugin inserts characters that are not part of the standard keyboard.
17
17
  */
18
18
  export declare class symbols extends Plugin {
19
- /** @override */
20
19
  buttons: Plugin['buttons'];
21
- private countInRow;
20
+ private __countInRow;
22
21
  constructor(jodit: IJodit);
23
- /** @override */
24
22
  afterInit(jodit: IJodit): void;
25
23
  /** @override */
26
24
  protected beforeDestruct(jodit: IJodit): void;
@@ -16,17 +16,15 @@ import * as langs from "./langs/index.js";
16
16
  export class symbols extends Plugin {
17
17
  constructor(jodit) {
18
18
  super(jodit);
19
- /** @override */
20
19
  this.buttons = [
21
20
  {
22
21
  name: 'symbols',
23
22
  group: 'insert'
24
23
  }
25
24
  ];
26
- this.countInRow = 17;
25
+ this.__countInRow = 17;
27
26
  extendLang(langs);
28
27
  }
29
- /** @override */
30
28
  afterInit(jodit) {
31
29
  jodit.e.on('generateSpecialCharactersTable.symbols', () => {
32
30
  const container = jodit.c.fromHTML(`<div class="jodit-symbols__container">
@@ -36,10 +34,15 @@ export class symbols extends Plugin {
36
34
  <div class="jodit-symbols__container_preview">
37
35
  <div class="jodit-symbols__preview"></div>
38
36
  </div>
39
- </div>`), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
37
+ </div>`);
38
+ const preview = container.querySelector('.jodit-symbols__preview');
39
+ const table = container.querySelector('table');
40
+ const body = table.tBodies[0];
41
+ const chars = [];
40
42
  for (let i = 0; i < jodit.o.specialCharacters.length;) {
41
43
  const tr = jodit.c.element('tr');
42
- for (let j = 0; j < this.countInRow && i < jodit.o.specialCharacters.length; j += 1, i += 1) {
44
+ for (let j = 0; j < this.__countInRow &&
45
+ i < jodit.o.specialCharacters.length; j += 1, i += 1) {
43
46
  const td = jodit.c.element('td'), a = jodit.c.fromHTML(`<a
44
47
  data-index="${i}"
45
48
  data-index-j="${j}"
@@ -61,7 +64,9 @@ export class symbols extends Plugin {
61
64
  if (Dom.isTag(this, 'a')) {
62
65
  jodit.s.focus();
63
66
  jodit.s.insertHTML(this.innerHTML);
64
- jodit.e.fire(this, 'close_dialog');
67
+ if (!e?.shiftKey) {
68
+ jodit.e.fire(this, 'close_dialog');
69
+ }
65
70
  e && e.preventDefault();
66
71
  e && e.stopImmediatePropagation();
67
72
  }
@@ -81,18 +86,18 @@ export class symbols extends Plugin {
81
86
  case KEY_DOWN:
82
87
  newIndex =
83
88
  e.key === KEY_UP
84
- ? index - self.countInRow
85
- : index + self.countInRow;
89
+ ? index - self.__countInRow
90
+ : index + self.__countInRow;
86
91
  if (chars[newIndex] === undefined) {
87
92
  newIndex =
88
93
  e.key === KEY_UP
89
94
  ? Math.floor(chars.length /
90
- self.countInRow) *
91
- self.countInRow +
95
+ self.__countInRow) *
96
+ self.__countInRow +
92
97
  jIndex
93
98
  : jIndex;
94
99
  if (newIndex > chars.length - 1) {
95
- newIndex -= self.countInRow;
100
+ newIndex -= self.__countInRow;
96
101
  }
97
102
  }
98
103
  chars[newIndex] && chars[newIndex].focus();
@@ -28,6 +28,9 @@ export interface ISnapshot {
28
28
  make(): SnapshotType;
29
29
  restoreOnlySelection(snapshot: SnapshotType): void;
30
30
  restore(snapshot: SnapshotType): void;
31
+ /**
32
+ * Pack all changes in one transaction without creating history point
33
+ */
31
34
  transaction(changes: () => void): void;
32
35
  }
33
36
  export interface IHistory {