jodit 3.8.7 → 3.9.4

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 (180) hide show
  1. package/.github/workflows/tests.yml +23 -0
  2. package/.idea/dictionaries/v_chupurnov.xml +1 -0
  3. package/.idea/workspace.xml +340 -298
  4. package/CHANGELOG.MD +132 -24
  5. package/README.md +3 -4
  6. package/build/jodit.css +92 -34
  7. package/build/jodit.es2018.css +65 -30
  8. package/build/jodit.es2018.en.css +65 -30
  9. package/build/jodit.es2018.en.js +1214 -693
  10. package/build/jodit.es2018.en.min.css +1 -1
  11. package/build/jodit.es2018.en.min.js +1 -1
  12. package/build/jodit.es2018.js +1214 -693
  13. package/build/jodit.es2018.min.css +1 -1
  14. package/build/jodit.es2018.min.js +1 -1
  15. package/build/jodit.js +2271 -1628
  16. package/build/jodit.min.css +2 -2
  17. package/build/jodit.min.js +1 -1
  18. package/index.d.ts +10 -0
  19. package/package.json +14 -13
  20. package/src/config.ts +1 -1
  21. package/src/core/async.ts +7 -5
  22. package/src/core/constants.ts +2 -0
  23. package/src/core/dom.ts +123 -102
  24. package/src/core/events/{events-native.ts → event-emitter.ts} +14 -9
  25. package/src/core/events/index.ts +1 -1
  26. package/src/core/global.ts +2 -2
  27. package/src/core/helpers/array/to-array.ts +1 -0
  28. package/src/core/helpers/data-bind.ts +2 -2
  29. package/src/core/helpers/size/index.ts +1 -0
  30. package/src/core/helpers/size/object-size.ts +22 -0
  31. package/src/core/helpers/utils/utils.ts +20 -4
  32. package/src/core/request/ajax.ts +212 -0
  33. package/src/core/request/config.ts +37 -0
  34. package/{build-system/minimizer/index.js → src/core/request/index.ts} +2 -1
  35. package/src/core/request/response.ts +39 -0
  36. package/src/core/selection/select.ts +60 -27
  37. package/src/core/selection/style/api/element-has-same-style.ts +13 -0
  38. package/src/core/selection/style/api/{get-closest-wrapper.ts → extract.ts} +26 -43
  39. package/src/core/selection/style/api/finite-state-machine.ts +66 -0
  40. package/src/core/selection/style/api/get-suit-parent.ts +1 -1
  41. package/src/core/selection/style/api/index.ts +12 -5
  42. package/src/core/selection/style/api/{check-special-elements.ts → is-inside-invisible-element.ts} +1 -1
  43. package/src/core/selection/style/api/is-suit-element.ts +36 -5
  44. package/src/core/selection/style/api/toggle/toggle-css.ts +134 -0
  45. package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +49 -0
  46. package/src/core/selection/style/api/toggle-commit-styles.ts +27 -0
  47. package/src/core/selection/style/api/unwrap-children.ts +45 -16
  48. package/src/core/selection/style/api/wrap-and-commit-style.ts +68 -0
  49. package/src/core/selection/style/api/wrap-ordered-list.ts +37 -0
  50. package/src/core/selection/style/api/wrap-unwrapped-text.ts +29 -27
  51. package/src/core/selection/style/apply-style.ts +161 -91
  52. package/src/core/selection/style/commit-style.ts +13 -0
  53. package/src/core/traits/elms.ts +1 -0
  54. package/src/core/ui/button/button/button.less +2 -0
  55. package/src/core/ui/helpers/buttons.ts +14 -6
  56. package/src/core/ui/helpers/get-control-type.ts +3 -1
  57. package/src/core/ui/list/list.less +1 -0
  58. package/src/core/ui/popup/popup.less +5 -3
  59. package/src/core/view/view-with-toolbar.ts +4 -0
  60. package/src/core/view/view.ts +3 -3
  61. package/src/modules/context-menu/context-menu.ts +1 -1
  62. package/src/modules/file-browser/README.MD +1 -1
  63. package/src/modules/file-browser/data-provider.ts +22 -42
  64. package/src/modules/file-browser/file-browser.ts +3 -0
  65. package/src/modules/index.ts +1 -1
  66. package/src/modules/status-bar/status-bar.less +27 -1
  67. package/src/modules/status-bar/status-bar.ts +15 -1
  68. package/src/modules/table.ts +197 -168
  69. package/src/modules/uploader/uploader.ts +4 -3
  70. package/src/modules/widget/tabs/tabs.less +1 -0
  71. package/src/plugins/bold.ts +2 -2
  72. package/src/plugins/fix/clean-html.ts +37 -16
  73. package/src/plugins/font.ts +11 -1
  74. package/src/plugins/indent.ts +25 -18
  75. package/src/plugins/index.ts +1 -0
  76. package/src/plugins/mobile.ts +10 -14
  77. package/src/plugins/ordered-list.ts +40 -1
  78. package/src/plugins/powered-by-jodit.ts +39 -0
  79. package/src/plugins/print/preview.ts +9 -2
  80. package/src/plugins/resizer/resizer.less +10 -7
  81. package/src/plugins/resizer/resizer.ts +12 -14
  82. package/src/plugins/size/assests/resize-handler.svg +4 -0
  83. package/src/plugins/size/resize-handler.ts +5 -5
  84. package/src/plugins/size/size.less +6 -8
  85. package/src/plugins/size/size.ts +1 -3
  86. package/src/plugins/source/source.ts +16 -2
  87. package/src/plugins/table/config.ts +3 -1
  88. package/src/plugins/table/select-cells.ts +23 -5
  89. package/src/plugins/table/table.less +0 -1
  90. package/src/styles/themes/dark.less +11 -1
  91. package/src/types/ajax.d.ts +15 -6
  92. package/src/types/async.d.ts +5 -4
  93. package/src/types/events.d.ts +12 -12
  94. package/src/types/style.d.ts +2 -0
  95. package/src/types/toolbar.d.ts +2 -1
  96. package/src/types/view.d.ts +3 -2
  97. package/types/core/async.d.ts +3 -3
  98. package/types/core/constants.d.ts +1 -0
  99. package/types/core/dom.d.ts +27 -20
  100. package/types/core/events/{events-native.d.ts → event-emitter.d.ts} +8 -3
  101. package/types/core/events/index.d.ts +1 -1
  102. package/types/core/global.d.ts +2 -2
  103. package/types/core/helpers/size/index.d.ts +1 -0
  104. package/{src/types/core.js → types/core/helpers/size/object-size.d.ts} +2 -3
  105. package/types/core/helpers/utils/utils.d.ts +12 -4
  106. package/types/core/{ajax.d.ts → request/ajax.d.ts} +5 -15
  107. package/types/core/request/config.d.ts +14 -0
  108. package/{build-system/rules/css.js → types/core/request/index.d.ts} +2 -7
  109. package/types/core/request/response.d.ts +16 -0
  110. package/types/core/selection/style/api/element-has-same-style.d.ts +4 -0
  111. package/types/core/selection/style/api/{get-closest-wrapper.d.ts → extract.d.ts} +6 -5
  112. package/types/core/selection/style/api/finite-state-machine.d.ts +21 -0
  113. package/types/core/selection/style/api/index.d.ts +12 -5
  114. package/types/core/selection/style/api/{check-special-elements.d.ts → is-inside-invisible-element.d.ts} +1 -1
  115. package/types/core/selection/style/api/is-suit-element.d.ts +10 -0
  116. package/types/core/selection/style/api/toggle/toggle-css.d.ts +11 -0
  117. package/types/core/selection/style/api/toggle/toggle-ordered-list.d.ts +11 -0
  118. package/types/core/selection/style/api/{toggle-styles.d.ts → toggle-commit-styles.d.ts} +1 -3
  119. package/types/core/selection/style/api/{post-process-list-element.d.ts → wrap-and-commit-style.d.ts} +3 -3
  120. package/types/core/selection/style/api/wrap-ordered-list.d.ts +12 -0
  121. package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -2
  122. package/types/core/selection/style/apply-style.d.ts +1 -4
  123. package/types/core/selection/style/commit-style.d.ts +7 -0
  124. package/types/core/ui/helpers/buttons.d.ts +2 -2
  125. package/types/core/view/view-with-toolbar.d.ts +2 -1
  126. package/types/core/view/view.d.ts +2 -2
  127. package/types/modules/file-browser/data-provider.d.ts +1 -1
  128. package/types/modules/index.d.ts +1 -1
  129. package/types/modules/status-bar/status-bar.d.ts +6 -1
  130. package/types/modules/table.d.ts +2 -2
  131. package/types/plugins/fix/clean-html.d.ts +4 -0
  132. package/types/plugins/index.d.ts +1 -0
  133. package/types/plugins/ordered-list.d.ts +8 -1
  134. package/{build-system/plugins/banner.js → types/plugins/powered-by-jodit.d.ts} +7 -10
  135. package/types/plugins/size/resize-handler.d.ts +1 -1
  136. package/types/plugins/source/source.d.ts +1 -1
  137. package/types/types/ajax.d.ts +15 -6
  138. package/types/types/async.d.ts +5 -4
  139. package/types/types/events.d.ts +12 -12
  140. package/types/types/style.d.ts +2 -0
  141. package/types/types/toolbar.d.ts +2 -1
  142. package/types/types/view.d.ts +3 -2
  143. package/.editorconfig +0 -15
  144. package/.eslintignore +0 -3
  145. package/.eslintrc.js +0 -109
  146. package/.prettierrc.json +0 -9
  147. package/.stylelintrc.json +0 -16
  148. package/app.css +0 -112
  149. package/build-system/index.js +0 -78
  150. package/build-system/loaders/css-variables-prefixes.js +0 -12
  151. package/build-system/loaders/lang-loader.js +0 -57
  152. package/build-system/loaders/style.js +0 -31
  153. package/build-system/loaders/svg-loader.js +0 -21
  154. package/build-system/minimizer/css.js +0 -20
  155. package/build-system/minimizer/js.js +0 -41
  156. package/build-system/plugins/define.js +0 -22
  157. package/build-system/plugins/extract-css.js +0 -21
  158. package/build-system/plugins/index.js +0 -31
  159. package/build-system/plugins/post-build.js +0 -52
  160. package/build-system/rules/extra-typescript.js +0 -22
  161. package/build-system/rules/index.js +0 -17
  162. package/build-system/rules/internal-typescript.js +0 -23
  163. package/build-system/rules/langs.js +0 -20
  164. package/build-system/rules/svg.js +0 -16
  165. package/build-system/utils/filename.js +0 -14
  166. package/build-system/utils/post-build.js +0 -28
  167. package/build-system/variables.js +0 -51
  168. package/composer.json +0 -12
  169. package/src/core/ajax.ts +0 -269
  170. package/src/core/selection/style/api/post-process-list-element.ts +0 -33
  171. package/src/core/selection/style/api/toggle-styles.ts +0 -74
  172. package/src/types/core.d.ts +0 -7
  173. package/src/types/core.js.map +0 -1
  174. package/src/types/storage.d.ts +0 -13
  175. package/src/types/storage.js +0 -8
  176. package/src/types/storage.js.map +0 -1
  177. package/types/types/core.js +0 -8
  178. package/types/types/core.js.map +0 -1
  179. package/types/types/storage.js +0 -8
  180. package/types/types/storage.js.map +0 -1
@@ -1,23 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- const path = require('path');
8
-
9
- module.exports = ({ dirname, uglify, ES }) => {
10
- return {
11
- test: /\.ts$/,
12
- loader: 'ts-loader',
13
- options: {
14
- transpileOnly: uglify,
15
- allowTsInNodeModules: true,
16
- compilerOptions: {
17
- target: ES
18
- }
19
- },
20
- include: [path.resolve(dirname, './src/')],
21
- exclude: [/langs\/[a-z]{2}\.ts/, /langs\/[a-z]{2}_[a-z]{2}\.ts/]
22
- };
23
- };
@@ -1,20 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- const path = require('path');
8
-
9
- module.exports = ({ dirname }) => {
10
- return {
11
- test: /\.(ts)$/,
12
- use: [
13
- {
14
- loader: path.resolve('../loaders/lang-loader')
15
- }
16
- ],
17
- include: path.resolve(dirname, './src/langs'),
18
- exclude: path.resolve(dirname, './src/langs/index.ts')
19
- };
20
- };
@@ -1,16 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- const path = require('path');
8
-
9
- module.exports = ({ dirname }) => {
10
- return {
11
- test: /\.svg$/i,
12
- use: {
13
- loader: path.resolve(dirname, './build-system/loaders/svg-loader')
14
- }
15
- };
16
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- module.exports.fileName = ({ argv, ES, isTest, excludeLangs, uglify }) =>
8
- argv.filename
9
- ? () => argv.filename
10
- : name =>
11
- name +
12
- (ES === 'es5' || isTest ? '' : '.' + ES) +
13
- (excludeLangs ? '.en' : '') +
14
- (uglify ? '.min' : '');
@@ -1,28 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
- module.exports = class PostBuild {
7
- constructor(fn) {
8
- this.fn = fn;
9
- }
10
-
11
- apply(compiler) {
12
- const handler = stats => {
13
- if (typeof this.fn === 'function') {
14
- try {
15
- this.fn(stats);
16
- } catch (e) {
17
- console.log(e);
18
- }
19
- }
20
- };
21
-
22
- if (compiler.hooks) {
23
- compiler.hooks.done.tap('PostBuild', handler);
24
- } else {
25
- compiler.plugin('done', handler);
26
- }
27
- }
28
- };
@@ -1,51 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- const path = require('path');
8
-
9
- module.exports.variables = (argv, dir) => {
10
- const pkg = require(path.resolve(dir, './package.json'));
11
-
12
- const banner = `/*!
13
- * ${pkg.name} - ${pkg.description}
14
- * Author: ${pkg.author}
15
- * Version: v${pkg.version}
16
- * Url: ${pkg.homepage}
17
- * License(s): ${pkg.license}
18
- */
19
- `;
20
-
21
- const debug = !argv || !argv.mode || !argv.mode.match(/production/);
22
-
23
- const isTest = Boolean(argv && argv.isTest);
24
-
25
- const mode = debug ? 'development' : argv.mode;
26
- const isProd = mode === 'production';
27
- const uglify = !debug && argv && Boolean(argv.uglify);
28
- const excludeLangs = Boolean(argv.excludeLangs) || false;
29
-
30
- const ES = argv && ['es5', 'es2018'].includes(argv.es) ? argv.es : 'es2018';
31
-
32
- const ESNext = ES === 'es2018';
33
- const dirname = dir;
34
- const outputPath = path.join(dir, 'build');
35
-
36
- return {
37
- argv,
38
- outputPath,
39
- banner,
40
- dirname,
41
- pkg,
42
- debug,
43
- isTest,
44
- isProd,
45
- uglify,
46
- excludeLangs,
47
- mode,
48
- ES,
49
- ESNext
50
- };
51
- };
package/composer.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "name": "xdan/jodit",
3
- "description": "Awesome WYSIWYG editor and FileBrowser",
4
- "type": "library",
5
- "license": "MIT",
6
- "authors": [
7
- {
8
- "name": "Chupurnov Valeriy",
9
- "email": "chupurnov@gmail.com"
10
- }
11
- ]
12
- }
package/src/core/ajax.ts DELETED
@@ -1,269 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- import type {
8
- IDictionary,
9
- IRequest,
10
- IViewBased,
11
- AjaxOptions,
12
- IAjax
13
- } from '../types';
14
- import { Config } from '../config';
15
- import {
16
- each,
17
- error,
18
- isPlainObject,
19
- parseQuery,
20
- buildQuery,
21
- isString,
22
- isFunction,
23
- ConfigProto
24
- } from './helpers';
25
-
26
- declare module '../config' {
27
- interface Config {
28
- /**
29
- * A set of key/value pairs that configure the Ajax request. All settings are optional
30
- */
31
- defaultAjaxOptions: AjaxOptions;
32
- }
33
- }
34
-
35
- Config.prototype.defaultAjaxOptions = {
36
- dataType: 'json',
37
- method: 'GET',
38
- url: '',
39
- data: null,
40
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
41
-
42
- headers: {
43
- 'X-REQUESTED-WITH': 'XMLHttpRequest' // compatible with jQuery
44
- },
45
-
46
- withCredentials: false,
47
-
48
- xhr(): XMLHttpRequest {
49
- return new XMLHttpRequest();
50
- }
51
- } as AjaxOptions;
52
-
53
- export class Ajax implements IAjax {
54
- static log: IRequest[] = [];
55
-
56
- private readonly xhr!: XMLHttpRequest;
57
-
58
- private success_response_codes = [200, 201, 202];
59
-
60
- private __buildParams(
61
- obj: string | IDictionary<string | object> | FormData,
62
- prefix?: string
63
- ): string | FormData {
64
- if (isFunction(this.o.queryBuild)) {
65
- return this.o.queryBuild.call(this, obj, prefix);
66
- }
67
-
68
- if (
69
- isString(obj) ||
70
- ((this.j.ow as any).FormData &&
71
- obj instanceof (this.j.ow as any).FormData)
72
- ) {
73
- return obj as string | FormData;
74
- }
75
-
76
- return buildQuery(obj);
77
- }
78
-
79
- status!: number;
80
-
81
- response!: string;
82
-
83
- options: AjaxOptions;
84
- get o(): this['options'] {
85
- return this.options;
86
- }
87
-
88
- /**
89
- * Alias for this.jodit
90
- */
91
- get j(): this['jodit'] {
92
- return this.jodit;
93
- }
94
-
95
- abort(): Ajax {
96
- try {
97
- this.xhr.abort();
98
- } catch {}
99
-
100
- return this;
101
- }
102
-
103
- private resolved = false;
104
- private activated = false;
105
-
106
- send(): Promise<any> {
107
- this.activated = true;
108
-
109
- return new Promise(
110
- (
111
- resolve: (this: XMLHttpRequest, resp: object) => any,
112
- reject: (error: Error) => any
113
- ) => {
114
- const __parse = (resp: string): object => {
115
- let result: object | null = null;
116
-
117
- if (this.o.dataType === 'json') {
118
- result = JSON.parse(resp);
119
- }
120
-
121
- if (!result) {
122
- throw error('No JSON format');
123
- }
124
-
125
- return result;
126
- };
127
-
128
- this.xhr.onabort = () => {
129
- reject(error(this.xhr.statusText));
130
- };
131
-
132
- this.xhr.onerror = () => {
133
- reject(error(this.xhr.statusText));
134
- };
135
-
136
- this.xhr.ontimeout = () => {
137
- reject(error(this.xhr.statusText));
138
- };
139
-
140
- this.xhr.onload = () => {
141
- this.response = this.xhr.responseText;
142
- this.status = this.xhr.status;
143
- this.resolved = true;
144
-
145
- resolve.call(this.xhr, __parse(this.response) || {});
146
- };
147
-
148
- this.xhr.onprogress = (e): void => {
149
- let percentComplete = 0;
150
-
151
- if (e.lengthComputable) {
152
- percentComplete = (e.loaded / e.total) * 100;
153
- }
154
-
155
- this.options.onProgress?.(percentComplete);
156
- };
157
-
158
- this.xhr.onreadystatechange = () => {
159
- this.options.onProgress?.(10);
160
-
161
- if (this.xhr.readyState === XMLHttpRequest.DONE) {
162
- const resp = this.xhr.responseText;
163
-
164
- this.response = resp;
165
- this.status = this.xhr.status;
166
- this.resolved = true;
167
-
168
- if (
169
- this.success_response_codes.indexOf(
170
- this.xhr.status
171
- ) > -1
172
- ) {
173
- resolve.call(this.xhr, __parse(resp));
174
- } else {
175
- reject.call(
176
- this.xhr,
177
- error(
178
- this.xhr.statusText ||
179
- this.j.i18n('Connection error!')
180
- )
181
- );
182
- }
183
- }
184
- };
185
-
186
- this.xhr.withCredentials = this.o.withCredentials || false;
187
-
188
- const { url, data, method } = this.prepareRequest();
189
-
190
- this.xhr.open(method, url, true);
191
-
192
- if (this.o.contentType && this.xhr.setRequestHeader) {
193
- this.xhr.setRequestHeader(
194
- 'Content-type',
195
- this.o.contentType
196
- );
197
- }
198
-
199
- if (this.o.headers && this.xhr.setRequestHeader) {
200
- each(this.o.headers, (key, value) => {
201
- this.xhr.setRequestHeader(key, value);
202
- });
203
- }
204
-
205
- // IE
206
- setTimeout(() => {
207
- this.xhr.send(data ? this.__buildParams(data) : undefined);
208
- }, 0);
209
- }
210
- );
211
- }
212
-
213
- prepareRequest(): IRequest {
214
- if (!this.o.url) {
215
- throw error('Need URL for AJAX request');
216
- }
217
-
218
- let url: string = this.o.url;
219
- const data = this.o.data;
220
- const method = (this.o.method || 'get').toLowerCase();
221
-
222
- if (method === 'get' && data && isPlainObject(data)) {
223
- const qIndex = url.indexOf('?');
224
-
225
- if (qIndex !== -1) {
226
- const urlData = parseQuery(url);
227
- url =
228
- url.substr(0, qIndex) +
229
- '?' +
230
- buildQuery({ ...urlData, ...(data as IDictionary) });
231
- } else {
232
- url += '?' + buildQuery(this.o.data as IDictionary);
233
- }
234
- }
235
-
236
- const request = {
237
- url,
238
- method,
239
- data
240
- };
241
-
242
- Ajax.log.splice(100);
243
- Ajax.log.push(request);
244
-
245
- return request;
246
- }
247
-
248
- constructor(readonly jodit: IViewBased, options: Partial<AjaxOptions>) {
249
- this.options = ConfigProto(
250
- options || {},
251
- Config.prototype.defaultAjaxOptions
252
- ) as AjaxOptions;
253
-
254
- this.xhr = this.o.xhr ? this.o.xhr() : new XMLHttpRequest();
255
-
256
- jodit &&
257
- jodit.events &&
258
- jodit.e.on('beforeDestruct', () => {
259
- this.abort();
260
- });
261
- }
262
-
263
- destruct(): any {
264
- if (this.activated && !this.resolved) {
265
- this.abort();
266
- this.resolved = true;
267
- }
268
- }
269
- }
@@ -1,33 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- import type { CommitStyle } from '../commit-style';
8
- import type { ICreate } from '../../../../types';
9
- import { Dom } from '../../../dom';
10
-
11
- /**
12
- * Post process UL or OL element
13
- */
14
- export function postProcessListElement(
15
- style: CommitStyle,
16
- wrapper: HTMLElement,
17
- ci: ICreate
18
- ): HTMLElement {
19
- // Add extra LI inside UL/OL
20
- if (
21
- /^(OL|UL)$/i.test(style.element) &&
22
- !Dom.isTag(wrapper.firstElementChild, 'li')
23
- ) {
24
- const li = Dom.replace(wrapper, 'li', ci),
25
- ul = Dom.wrap(li, style.element, ci);
26
-
27
- if (ul) {
28
- return ul;
29
- }
30
- }
31
-
32
- return wrapper;
33
- }
@@ -1,74 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- import type { CommitStyle } from '../commit-style';
8
- import type { Nullable } from '../../../../types';
9
- import { attr, css, normalizeCssValue } from '../../../helpers';
10
- import { Dom } from '../../../dom';
11
-
12
- /**
13
- * Add or remove styles to element
14
- *
15
- * @param elm - The element to switch styles
16
- */
17
- export function toggleStyles(
18
- style: CommitStyle,
19
- elm: HTMLElement,
20
- wrap: Nullable<boolean>
21
- ): Nullable<boolean> {
22
- const {
23
- options: { style: styles },
24
- defaultTag,
25
- element
26
- } = style;
27
-
28
- const tag = elm.nodeName.toLowerCase(),
29
- isStyleCommit = style.elementIsDefault && Dom.isInlineBlock(elm);
30
-
31
- // toggle CSS rules
32
- if (styles && (tag === defaultTag || isStyleCommit)) {
33
- Object.keys(styles).forEach(rule => {
34
- if (
35
- wrap === false ||
36
- css(elm, rule) ===
37
- normalizeCssValue(rule, styles[rule] as string)
38
- ) {
39
- css(elm, rule, '');
40
-
41
- if (wrap == null) {
42
- wrap = false;
43
- }
44
- } else {
45
- css(elm, rule, styles[rule]);
46
-
47
- if (wrap == null) {
48
- wrap = true;
49
- }
50
- }
51
- });
52
- }
53
-
54
- const isBlock = Dom.isBlock(elm);
55
-
56
- const isSuitableInline =
57
- !isBlock &&
58
- (!attr(elm, 'style') || (tag !== defaultTag && tag === element));
59
-
60
- // h1 apply h1
61
- const isSameBlockElement = !isSuitableInline && isBlock && tag === element;
62
-
63
- if (isSuitableInline || isSameBlockElement) {
64
- // toggle `<strong>test</strong>` to `test`, and
65
- // `<span style="">test</span>` to `test`
66
- Dom.unwrap(elm);
67
-
68
- if (wrap == null) {
69
- wrap = false;
70
- }
71
- }
72
-
73
- return wrap;
74
- }
@@ -1,7 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
- import type { IComponent, IDictionary } from './types';
7
- export declare type DecoratorHandler = <T extends IComponent & IDictionary>(target: T, propertyKey: string) => void;
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["core.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,13 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
- export declare type StorageValueType = string | number | boolean | object | StorageValueType[];
7
- export interface IStorage<T = StorageValueType> {
8
- set(key: string, value: T): void;
9
- delete(key: string): void;
10
- get<R = T>(key: string): R | void;
11
- exists(key: string): boolean;
12
- clear(): void;
13
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Jodit Editor (https://xdsoft.net/jodit/)
4
- * Released under MIT see LICENSE.txt in the project root for license information.
5
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["storage.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Jodit Editor (https://xdsoft.net/jodit/)
4
- * Released under MIT see LICENSE.txt in the project root for license information.
5
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=core.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["core.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Jodit Editor (https://xdsoft.net/jodit/)
4
- * Released under MIT see LICENSE.txt in the project root for license information.
5
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["storage.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}