jodit 3.8.8 → 3.9.2

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 (118) hide show
  1. package/.github/workflows/tests.yml +23 -0
  2. package/.idea/dictionaries/v_chupurnov.xml +1 -0
  3. package/.idea/workspace.xml +295 -286
  4. package/CHANGELOG.MD +110 -24
  5. package/README.md +3 -3
  6. package/build/jodit.css +2 -2
  7. package/build/jodit.es2018.css +1 -1
  8. package/build/jodit.es2018.en.css +1 -1
  9. package/build/jodit.es2018.en.js +329 -210
  10. package/build/jodit.es2018.en.min.js +1 -1
  11. package/build/jodit.es2018.js +329 -210
  12. package/build/jodit.es2018.min.js +1 -1
  13. package/build/jodit.js +1066 -881
  14. package/build/jodit.min.css +1 -1
  15. package/build/jodit.min.js +1 -1
  16. package/package.json +1 -1
  17. package/src/core/async.ts +1 -1
  18. package/src/core/constants.ts +2 -0
  19. package/src/core/dom.ts +113 -99
  20. package/src/core/events/{events-native.ts → event-emitter.ts} +14 -9
  21. package/src/core/events/index.ts +1 -1
  22. package/src/core/global.ts +2 -2
  23. package/src/core/helpers/array/to-array.ts +1 -0
  24. package/src/core/helpers/data-bind.ts +2 -2
  25. package/src/core/helpers/utils/utils.ts +20 -4
  26. package/src/core/request/ajax.ts +212 -0
  27. package/src/core/request/config.ts +37 -0
  28. package/{build-system/minimizer/index.js → src/core/request/index.ts} +2 -1
  29. package/src/core/request/response.ts +39 -0
  30. package/src/core/selection/select.ts +59 -27
  31. package/src/core/selection/style/api/element-has-same-style.ts +13 -0
  32. package/src/core/selection/style/api/get-suit-parent.ts +1 -1
  33. package/src/core/selection/style/api/is-suit-element.ts +24 -4
  34. package/src/core/selection/style/api/unwrap-children.ts +45 -16
  35. package/src/core/selection/style/api/wrap-unwrapped-text.ts +28 -23
  36. package/src/core/selection/style/apply-style.ts +14 -8
  37. package/src/core/traits/elms.ts +1 -0
  38. package/src/core/ui/helpers/get-control-type.ts +3 -1
  39. package/src/core/view/view.ts +3 -3
  40. package/src/modules/context-menu/context-menu.ts +1 -1
  41. package/src/modules/file-browser/README.MD +1 -1
  42. package/src/modules/file-browser/data-provider.ts +22 -42
  43. package/src/modules/file-browser/file-browser.ts +3 -0
  44. package/src/modules/index.ts +1 -1
  45. package/src/modules/table.ts +106 -101
  46. package/src/modules/uploader/uploader.ts +4 -3
  47. package/src/plugins/fix/clean-html.ts +37 -16
  48. package/src/plugins/indent.ts +25 -18
  49. package/src/plugins/size/resize-handler.ts +1 -1
  50. package/src/plugins/size/size.ts +1 -3
  51. package/src/plugins/source/source.ts +1 -1
  52. package/src/plugins/table/select-cells.ts +23 -5
  53. package/src/types/ajax.d.ts +15 -6
  54. package/src/types/async.d.ts +1 -1
  55. package/src/types/events.d.ts +12 -12
  56. package/src/types/view.d.ts +2 -2
  57. package/types/core/async.d.ts +1 -1
  58. package/types/core/constants.d.ts +1 -0
  59. package/types/core/dom.d.ts +25 -19
  60. package/types/core/events/{events-native.d.ts → event-emitter.d.ts} +8 -3
  61. package/types/core/events/index.d.ts +1 -1
  62. package/types/core/global.d.ts +2 -2
  63. package/types/core/helpers/utils/utils.d.ts +12 -4
  64. package/types/core/{ajax.d.ts → request/ajax.d.ts} +4 -14
  65. package/types/core/request/config.d.ts +14 -0
  66. package/{build-system/rules/css.js → types/core/request/index.d.ts} +2 -7
  67. package/types/core/request/response.d.ts +16 -0
  68. package/types/core/selection/style/api/element-has-same-style.d.ts +4 -0
  69. package/types/core/selection/style/api/is-suit-element.d.ts +1 -0
  70. package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -2
  71. package/types/core/view/view.d.ts +2 -2
  72. package/types/modules/file-browser/data-provider.d.ts +1 -1
  73. package/types/modules/index.d.ts +1 -1
  74. package/types/plugins/fix/clean-html.d.ts +4 -0
  75. package/types/plugins/size/resize-handler.d.ts +1 -1
  76. package/types/plugins/source/source.d.ts +1 -1
  77. package/types/types/ajax.d.ts +15 -6
  78. package/types/types/async.d.ts +1 -1
  79. package/types/types/events.d.ts +12 -12
  80. package/types/types/view.d.ts +2 -2
  81. package/.editorconfig +0 -15
  82. package/.eslintignore +0 -3
  83. package/.eslintrc.js +0 -109
  84. package/.prettierrc.json +0 -9
  85. package/.stylelintrc +0 -17
  86. package/app.css +0 -112
  87. package/build-system/index.js +0 -78
  88. package/build-system/loaders/css-variables-prefixes.js +0 -12
  89. package/build-system/loaders/lang-loader.js +0 -57
  90. package/build-system/loaders/style.js +0 -31
  91. package/build-system/loaders/svg-loader.js +0 -21
  92. package/build-system/minimizer/css.js +0 -20
  93. package/build-system/minimizer/js.js +0 -41
  94. package/build-system/plugins/banner.js +0 -15
  95. package/build-system/plugins/define.js +0 -22
  96. package/build-system/plugins/extract-css.js +0 -14
  97. package/build-system/plugins/index.js +0 -31
  98. package/build-system/plugins/post-build.js +0 -52
  99. package/build-system/rules/extra-typescript.js +0 -22
  100. package/build-system/rules/index.js +0 -17
  101. package/build-system/rules/internal-typescript.js +0 -23
  102. package/build-system/rules/langs.js +0 -20
  103. package/build-system/rules/svg.js +0 -19
  104. package/build-system/utils/filename.js +0 -17
  105. package/build-system/utils/post-build.js +0 -28
  106. package/build-system/variables.js +0 -53
  107. package/composer.json +0 -12
  108. package/src/core/ajax.ts +0 -266
  109. package/src/types/core.d.ts +0 -7
  110. package/src/types/core.js +0 -8
  111. package/src/types/core.js.map +0 -1
  112. package/src/types/storage.d.ts +0 -13
  113. package/src/types/storage.js +0 -8
  114. package/src/types/storage.js.map +0 -1
  115. package/types/types/core.js +0 -8
  116. package/types/types/core.js.map +0 -1
  117. package/types/types/storage.js +0 -8
  118. package/types/types/storage.js.map +0 -1
@@ -81,6 +81,10 @@ export declare class cleanHtml extends Plugin {
81
81
  buttons: Plugin['buttons'];
82
82
  /** @override */
83
83
  protected afterInit(jodit: IJodit): void;
84
+ /**
85
+ * Replaces an element with a newer one if specified in the configuration match
86
+ */
87
+ private replaceIfMatched;
84
88
  /**
85
89
  * Clean HTML code on every change
86
90
  */
@@ -35,5 +35,5 @@ export declare class resizeHandler extends Plugin {
35
35
  */
36
36
  private handle;
37
37
  /** @override **/
38
- protected beforeDestruct(editor: IJodit): void;
38
+ protected beforeDestruct(): void;
39
39
  }
@@ -45,5 +45,5 @@ export declare class source extends Plugin {
45
45
  afterInit(editor: IJodit): void;
46
46
  private initSourceEditor;
47
47
  /** @override */
48
- beforeDestruct(jodit: IJodit): void;
48
+ beforeDestruct(): void;
49
49
  }
@@ -20,24 +20,33 @@ export interface IRequest {
20
20
  data: DataVariant;
21
21
  }
22
22
 
23
- export interface IAjax extends IDestructible {
24
- status: number;
25
23
 
26
- response: string;
24
+ export interface IResponse<T> {
25
+ readonly status: number;
26
+ readonly statusText: string;
27
+ readonly url: string;
28
+ readonly request: IRequest;
27
29
 
30
+ json(): Promise<T>;
31
+ text(): Promise<string>;
32
+ }
33
+
34
+ export interface IAjax<T> extends IDestructible {
28
35
  options: AjaxOptions;
29
36
  o: this['options'];
30
37
 
31
38
  jodit: IViewBased;
32
39
 
33
- abort(): IAjax;
40
+ abort(): IAjax<T>;
34
41
 
35
- send(): Promise<any>;
42
+ send(): Promise<IResponse<T>>;
36
43
 
37
44
  prepareRequest(): IRequest;
38
45
  }
39
46
 
40
47
  export interface AjaxOptions {
48
+ successStatuses: number[];
49
+
41
50
  /**
42
51
  * json or text The type of data that you're expecting back
43
52
  * from the server. if `json` the return value passes through the `JSON.parse`
@@ -80,7 +89,7 @@ export interface AjaxOptions {
80
89
  withCredentials?: boolean;
81
90
 
82
91
  queryBuild?: (
83
- this: IAjax,
92
+ this: IAjax<any>,
84
93
  obj: string | IDictionary<string | object> | FormData,
85
94
  prefix?: string
86
95
  ) => string | FormData;
@@ -35,7 +35,7 @@ export interface IAsync extends IDestructible {
35
35
  promise<T>(
36
36
  executor: (
37
37
  resolve: (value: T | PromiseLike<T>) => void,
38
- reject?: (reason?: any) => void
38
+ reject: (reason?: any) => void
39
39
  ) => void
40
40
  ): RejectablePromise<T>;
41
41
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  import type { CallbackFunction, IDestructible } from './types';
10
10
 
11
- interface IEventsNative extends IDestructible {
11
+ interface IEventEmitter extends IDestructible {
12
12
  /**
13
13
  * Get current event name
14
14
  *
@@ -29,7 +29,7 @@ interface IEventsNative extends IDestructible {
29
29
  /**
30
30
  * Doesn't start any handler
31
31
  */
32
- mute(event?: string): IEventsNative;
32
+ mute(event?: string): IEventEmitter;
33
33
 
34
34
  /**
35
35
  * No handlers are triggered for the event
@@ -39,7 +39,7 @@ interface IEventsNative extends IDestructible {
39
39
  /**
40
40
  * Returns event handling
41
41
  */
42
- unmute(event?: string): IEventsNative;
42
+ unmute(event?: string): IEventEmitter;
43
43
 
44
44
  /**
45
45
  * Sets the handler for the specified event ( Event List ) for a given element .
@@ -70,30 +70,30 @@ interface IEventsNative extends IDestructible {
70
70
  handler: CallbackFunction,
71
71
  handlerOrSelector?: void,
72
72
  onTop?: boolean
73
- ): IEventsNative;
73
+ ): IEventEmitter;
74
74
 
75
75
  on(
76
76
  subject: HTMLElement,
77
77
  events: string,
78
78
  handler: CallbackFunction,
79
79
  onTop?: boolean
80
- ): IEventsNative;
80
+ ): IEventEmitter;
81
81
 
82
82
  on(
83
83
  subject: object,
84
84
  events: string,
85
85
  handler: CallbackFunction,
86
86
  onTop?: boolean
87
- ): IEventsNative;
87
+ ): IEventEmitter;
88
88
 
89
89
  on(
90
90
  subjectOrEvents: object | string,
91
91
  eventsOrCallback: string | CallbackFunction,
92
92
  handlerOrSelector?: CallbackFunction | void,
93
93
  onTop?: boolean
94
- ): IEventsNative;
94
+ ): IEventEmitter;
95
95
 
96
- one(...args: Parameters<IEventsNative['on']>): IEventsNative;
96
+ one(...args: Parameters<IEventEmitter['on']>): IEventEmitter;
97
97
 
98
98
  /**
99
99
  * Disable all handlers specified event ( Event List ) for a given element. Either a specific event handler.
@@ -129,17 +129,17 @@ interface IEventsNative extends IDestructible {
129
129
  off(
130
130
  subjectOrEvents: string,
131
131
  eventsOrCallback?: CallbackFunction
132
- ): IEventsNative;
132
+ ): IEventEmitter;
133
133
  off(
134
134
  subjectOrEvents: object,
135
135
  eventsOrCallback?: string,
136
136
  handler?: CallbackFunction
137
- ): IEventsNative;
137
+ ): IEventEmitter;
138
138
  off(
139
139
  subjectOrEvents: object | string,
140
140
  eventsOrCallback?: string | (() => void),
141
141
  handler?: CallbackFunction
142
- ): IEventsNative;
142
+ ): IEventEmitter;
143
143
 
144
144
  stopPropagation(
145
145
  subjectOrEvents: object | string,
@@ -163,7 +163,7 @@ interface IEventsNative extends IDestructible {
163
163
  * ```
164
164
  * or you can trigger native browser listener
165
165
  * ```javascript
166
- * var events = new Jodit.modules.EventsNative();
166
+ * var events = new Jodit.modules.EventEmitter();
167
167
  * events.on(document.body, 'click',function (event) {
168
168
  * alert('click on ' + event.target.id );
169
169
  * });
@@ -18,7 +18,7 @@ import type { Attributes, ICreate } from './create';
18
18
  import type { IStorage } from './storage';
19
19
  import type { IAsync } from './async';
20
20
  import type { IUIButtonState } from './ui';
21
- import type { IEventsNative } from './events';
21
+ import type { IEventEmitter } from './events';
22
22
  import type { IPluginButton } from './plugin';
23
23
  import type { Mods, Elms } from '../core/traits';
24
24
 
@@ -108,7 +108,7 @@ interface IViewBased<T = IViewOptions>
108
108
 
109
109
  progressbar: IProgressBar;
110
110
 
111
- events: IEventsNative;
111
+ events: IEventEmitter;
112
112
  e: this['events'];
113
113
 
114
114
  async: IAsync;
package/.editorconfig DELETED
@@ -1,15 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- indent_size = 2
7
- indent_style = tab
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [{LICENSE,.gitattributes,.gitignore,.npmignore,.eslintignore}]
12
- indent_style = space
13
-
14
- [*.{json,yml,md,yaspellerrc,bowerrc,babelrc,snakeskinrc,eslintrc,tsconfig,pzlrrc}]
15
- indent_style = space
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- node_modules
2
- build
3
- types
package/.eslintrc.js DELETED
@@ -1,109 +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
- // eslint-disable-next-line strict
8
- module.exports = {
9
- root: true,
10
- parser: '@typescript-eslint/parser',
11
- plugins: ['@typescript-eslint', 'header', 'eslint-plugin-tsdoc'],
12
- extends: [
13
- 'eslint:recommended',
14
- 'plugin:prettier/recommended',
15
- 'plugin:@typescript-eslint/eslint-recommended',
16
- 'plugin:@typescript-eslint/recommended'
17
- ],
18
- env: {
19
- browser: true,
20
- node: true
21
- },
22
- rules: {
23
- 'tsdoc/syntax': 'warn',
24
- strict: ['error', 'never'],
25
- 'no-with': 'error',
26
- 'no-caller': 'error',
27
- 'no-delete-var': 'error',
28
- 'no-proto': 'off',
29
- 'valid-typeof': 'error',
30
- 'no-undef': 'off',
31
- eqeqeq: ['error', 'always', { null: 'never' }],
32
-
33
- 'no-new': 'error',
34
- 'no-new-func': 'error',
35
- 'no-new-object': 'error',
36
- 'no-new-symbol': 'error',
37
- 'no-new-wrappers': 'error',
38
- 'no-array-constructor': 'error',
39
- 'new-parens': 'error',
40
- 'max-classes-per-file': ['error', 1],
41
-
42
- 'no-extend-native': 'off',
43
- 'no-global-assign': 'error',
44
- 'no-implicit-globals': 'error',
45
- 'no-implicit-coercion': 'error',
46
- camelcase: 'off',
47
- quotes: ['error', 'single', { avoidEscape: true }],
48
- 'quote-props': [
49
- 'error',
50
- 'as-needed',
51
- { keywords: false, numbers: false }
52
- ],
53
- 'jsx-quotes': 'error',
54
-
55
- 'header/header': [2, 'src/header.js'],
56
- 'no-mixed-spaces-and-tabs': 'off',
57
- 'no-empty': 'off',
58
- '@typescript-eslint/ban-types': 'off',
59
- '@typescript-eslint/ban-ts-comment': 'off',
60
- '@typescript-eslint/no-empty-function': 'off',
61
- '@typescript-eslint/no-this-alias': 'off',
62
- '@typescript-eslint/no-inferrable-types': 'off',
63
- '@typescript-eslint/no-explicit-any': 'off',
64
- '@typescript-eslint/no-var-requires': 'off',
65
- '@typescript-eslint/no-unused-vars': 'off',
66
- '@typescript-eslint/explicit-module-boundary-types': 'error',
67
- 'no-fallthrough': 'off'
68
- },
69
- globals: {
70
- Set: true,
71
- setCursorToChar: true,
72
- createPoint: true,
73
- afterEach: true,
74
- SynchronousPromise: true,
75
- mocha: true,
76
- chai: true,
77
- Promise: true,
78
- defaultPermissions: true,
79
- getOpenedPopup: true,
80
- getOpenedDialog: true,
81
- getBox: true,
82
- offset: true,
83
- i18nkeys: true,
84
- appendTestDiv: true,
85
- getButton: true,
86
- clickTrigger: true,
87
- clickButton: true,
88
- sortAttributes: true,
89
- onLoadImage: true,
90
- sortStyles: true,
91
- simulateEvent: true,
92
- simulatePaste: true,
93
- beforeEach: true,
94
- describe: true,
95
- it: true,
96
- getJodit: true,
97
- Jodit: true,
98
- expect: true,
99
- unmockPromise: true,
100
- appendTestArea: true,
101
- mockPromise: true,
102
- fillBoxBr: true,
103
- selectCells: true,
104
- before: true,
105
- after: true,
106
- FileImage: true,
107
- FileXLS: true
108
- }
109
- };
package/.prettierrc.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "trailingComma": "none",
3
- "tabWidth": 4,
4
- "useTabs": true,
5
- "semi": true,
6
- "singleQuote": true,
7
- "endOfLine": "lf",
8
- "arrowParens": "avoid"
9
- }
package/.stylelintrc DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": ["stylelint-config-idiomatic-order"],
3
- "plugins": ["stylelint-prettier"],
4
- "customSyntax": "postcss-less",
5
- "rules": {
6
- "prettier/prettier": true,
7
- "selector-type-no-unknown": null,
8
- "no-descending-specificity": null,
9
- "property-no-unknown": [
10
- true,
11
- {
12
- "ignoreProperties": ["overflow-scrolling"],
13
- "checkPrefixed": true
14
- }
15
- ]
16
- }
17
- }
package/app.css DELETED
@@ -1,112 +0,0 @@
1
- html,
2
- body {
3
- min-height: 100%;
4
- color: #3c4d62;
5
- font-size: 16px;
6
- }
7
-
8
- html,
9
- body,
10
- div,
11
- span,
12
- applet,
13
- object,
14
- iframe,
15
- h1,
16
- h2,
17
- h3,
18
- h4,
19
- h5,
20
- h6,
21
- p,
22
- blockquote,
23
- pre,
24
- a,
25
- abbr,
26
- acronym,
27
- address,
28
- big,
29
- cite,
30
- code,
31
- del,
32
- dfn,
33
- em,
34
- img,
35
- ins,
36
- kbd,
37
- q,
38
- s,
39
- samp,
40
- small,
41
- strike,
42
- strong,
43
- sub,
44
- sup,
45
- tt,
46
- var,
47
- b,
48
- u,
49
- i,
50
- center,
51
- dl,
52
- dt,
53
- dd,
54
- fieldset,
55
- form,
56
- label,
57
- legend,
58
- table,
59
- caption,
60
- tbody,
61
- tfoot,
62
- thead,
63
- tr,
64
- th,
65
- td,
66
- article,
67
- aside,
68
- canvas,
69
- details,
70
- embed,
71
- figure,
72
- figcaption,
73
- footer,
74
- header,
75
- hgroup,
76
- menu,
77
- nav,
78
- output,
79
- ruby,
80
- section,
81
- summary,
82
- time,
83
- mark,
84
- audio,
85
- video {
86
- padding: 0;
87
- border: 0;
88
- margin: 0;
89
- vertical-align: baseline;
90
- }
91
-
92
- body {
93
- font-family: Helvetica, Arial, sans-serif;
94
- font-size: 16px;
95
- line-height: 18px;
96
- }
97
-
98
- body,
99
- * {
100
- box-sizing: border-box;
101
- }
102
-
103
- .table,
104
- .p {
105
- margin: 0 0 16px 0;
106
- }
107
-
108
- h1,
109
- p {
110
- margin-bottom: 16px;
111
- line-height: 1;
112
- }
@@ -1,78 +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
- // @ts-check
7
- /** eslint-disable tsdoc/syntax */
8
-
9
- const path = require('path');
10
- const fs = require('fs');
11
-
12
- const webpack = require('webpack');
13
-
14
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
15
- const MinimizeJSPlugin = require('terser-webpack-plugin');
16
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
17
- const postcss = require('postcss');
18
- const { variables } = require('./variables');
19
- const { fileName } = require('./utils/filename');
20
-
21
- /**
22
- * @param {array} env
23
- * @param {object} argv
24
- * @param {string} dir
25
- * @param {boolean} onlyTS - build only TypeScript files
26
- */
27
- module.exports = (env, argv, dir = __dirname, onlyTS = false) => {
28
- const vars = variables(argv, dir);
29
-
30
- const { ES, mode, isTest, isProd, debug, ESNext, uglify, outputPath } =
31
- vars;
32
-
33
- console.warn(`ES:${ES} Mode:${mode} Test:${isTest}`);
34
-
35
- return {
36
- cache: !isProd,
37
- mode,
38
- target: ['web', 'es5'],
39
- context: dir,
40
-
41
- stats: {
42
- colors: true
43
- },
44
-
45
- devtool: debug ? 'inline-source-map' : false,
46
-
47
- entry: {
48
- jodit: debug
49
- ? ['webpack-hot-middleware/client.js', './src/index']
50
- : ['./src/index']
51
- },
52
-
53
- output: {
54
- path: outputPath,
55
- filename: fileName(vars)('[name]') + '.js',
56
- publicPath: '/build/',
57
- libraryTarget: 'umd'
58
- },
59
-
60
- resolve: {
61
- extensions: ['.js', '.ts', '.d.ts', '.json', '.less', '.svg']
62
- },
63
-
64
- optimization: {
65
- minimize: !debug && uglify,
66
- moduleIds: debug ? 'named' : 'natural',
67
- minimizer: require('./minimizer').map(mnm =>
68
- mnm({ isTest, ESNext })
69
- )
70
- },
71
-
72
- module: {
73
- rules: require('./rules/index')(vars)
74
- },
75
-
76
- plugins: require('./plugins/index')(vars)
77
- };
78
- };
@@ -1,12 +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 = function (source) {
8
- this.cacheable && this.cacheable(true);
9
- return source.replace(/--([a-z0-9_-]+)/g, '--jd-$1');
10
- };
11
-
12
- module.exports.seperable = true;
@@ -1,57 +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 ts = require('typescript');
8
- const vm = require('vm');
9
-
10
- let keys = [];
11
-
12
- module.exports = function (source) {
13
- this.cacheable && this.cacheable(true);
14
-
15
- let result = [];
16
-
17
- try {
18
- const transpile = ts.transpileModule(source, {
19
- compilerOptions: {
20
- module: ts.ModuleKind.es5
21
- }
22
- });
23
-
24
- const es5export = 'result = ';
25
- const content = transpile.outputText
26
- .replace('export default', es5export)
27
- .replace('exports.default =', es5export);
28
-
29
- const box = {};
30
-
31
- try {
32
- vm.runInNewContext(content, box);
33
- } catch (e) {
34
- vm.runInNewContext('var exports={};' + content, box);
35
- }
36
-
37
- const lang = box.result;
38
-
39
- if (!keys.length) {
40
- keys = Object.keys(lang);
41
- }
42
-
43
- keys.forEach((key, index) => {
44
- result[index] = lang[key];
45
- });
46
-
47
- if (this.resourcePath.indexOf('en.ts') !== -1) {
48
- result = keys; // for English file return keys
49
- }
50
- } catch (e) {
51
- throw new Error('Error in lang-loader: ' + e.message);
52
- }
53
-
54
- return 'module.exports.default = ' + JSON.stringify(result);
55
- };
56
-
57
- module.exports.seperable = true;
@@ -1,31 +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 MiniCssExtractPlugin = require('mini-css-extract-plugin');
8
- const path = require('path');
9
-
10
- module.exports = ({ debug, isTest, superDirname }) => [
11
- debug || isTest ? 'style-loader' : MiniCssExtractPlugin.loader,
12
- {
13
- loader: 'css-loader',
14
- options: {
15
- sourceMap: debug,
16
- importLoaders: 1
17
- }
18
- },
19
- {
20
- loader: path.resolve(
21
- superDirname,
22
- './build-system/loaders/css-variables-prefixes'
23
- )
24
- },
25
- {
26
- loader: 'less-loader',
27
- options: {
28
- sourceMap: debug
29
- }
30
- }
31
- ];
@@ -1,21 +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 = function (content) {
7
- this.cacheable && this.cacheable();
8
- this.value = content;
9
-
10
- return (
11
- 'module.exports = ' +
12
- JSON.stringify(
13
- content
14
- .replace(/[\n\t]+/g, ' ')
15
- .replace(/[\s]+/g, ' ')
16
- .trim()
17
- )
18
- );
19
- };
20
-
21
- module.exports.seperable = true;
@@ -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 CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
8
-
9
- module.exports = () => new CssMinimizerPlugin({
10
- parallel: true,
11
- minimizerOptions: {
12
- preset: [
13
- 'advanced',
14
- {
15
- discardComments: { removeAll: true },
16
- zindex: false
17
- }
18
- ]
19
- }
20
- });