jodit 3.15.2 → 3.16.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.
- package/.idea/workspace.xml +301 -299
- package/CHANGELOG.MD +88 -7
- package/CONTRIBUTING.md +97 -0
- package/README.md +7 -7
- package/build/jodit.css +38 -32
- package/build/jodit.es2018.css +37 -31
- package/build/jodit.es2018.en.css +37 -31
- package/build/jodit.es2018.en.js +1981 -1393
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +2053 -1447
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +3475 -2625
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/build/vdom.css +1 -1
- package/build/vdom.js +32 -20
- package/package.json +13 -13
- package/src/README.md +1 -1
- package/src/config.ts +69 -36
- package/src/core/async/async.ts +46 -24
- package/src/core/constants.ts +1 -0
- package/src/core/decorators/README.md +35 -0
- package/src/core/decorators/cache/cache.ts +1 -1
- package/src/core/decorators/debounce/debounce.ts +20 -9
- package/src/core/decorators/idle/README.md +14 -0
- package/src/core/decorators/idle/idle.ts +1 -1
- package/src/core/decorators/watch/watch.ts +8 -7
- package/src/core/dom/README.md +42 -0
- package/src/core/dom/dom.ts +37 -23
- package/src/core/dom/index.ts +1 -0
- package/src/core/dom/lazy-walker.ts +133 -0
- package/src/core/event-emitter/event-emitter.ts +8 -8
- package/src/core/event-emitter/eventify.ts +73 -0
- package/src/core/event-emitter/index.ts +1 -0
- package/src/core/helpers/html/apply-styles.ts +1 -1
- package/src/core/helpers/html/strip-tags.ts +3 -2
- package/src/core/helpers/string/fuzzy-search-index.ts +58 -0
- package/src/core/helpers/string/i18n.ts +1 -1
- package/src/core/helpers/string/index.ts +3 -2
- package/src/core/helpers/utils/append-script.ts +1 -1
- package/src/core/helpers/utils/css.ts +1 -1
- package/src/core/helpers/utils/selector.ts +1 -1
- package/src/core/helpers/utils/utils.ts +3 -3
- package/src/core/plugin/plugin-system.ts +14 -8
- package/src/core/request/ajax.ts +3 -3
- package/src/core/selection/select.ts +10 -10
- package/src/core/selection/style/api/toggle/toggle-css.ts +5 -2
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -1
- package/src/core/selection/style/apply-style.ts +4 -4
- package/src/core/storage/engines/local-storage-provider.ts +20 -19
- package/src/core/ui/button/button/button.ts +5 -5
- package/src/core/ui/element.ts +2 -2
- package/src/core/ui/form/inputs/input/input.ts +1 -1
- package/src/core/ui/form/inputs/select/select.ts +1 -1
- package/src/core/ui/group/list.ts +2 -2
- package/src/core/vdom/render/index.ts +12 -8
- package/src/core/vdom/v-dom-jodit.ts +1 -1
- package/src/core/view/view.ts +1 -1
- package/src/index.ts +3 -3
- package/src/jodit.ts +72 -55
- package/src/langs/README.md +1 -1
- package/src/langs/ar.js +2 -1
- package/src/langs/cs_cz.js +2 -1
- package/src/langs/de.js +2 -1
- package/src/langs/es.js +2 -1
- package/src/langs/fa.js +2 -1
- package/src/langs/fr.js +2 -1
- package/src/langs/he.js +2 -1
- package/src/langs/hu.js +2 -1
- package/src/langs/id.js +2 -1
- package/src/langs/index.ts +1 -1
- package/src/langs/it.js +2 -1
- package/src/langs/ja.js +2 -1
- package/src/langs/ko.js +2 -1
- package/src/langs/nl.js +2 -1
- package/src/langs/pl.js +2 -1
- package/src/langs/pt_br.js +2 -1
- package/src/langs/ru.js +2 -1
- package/src/langs/tr.js +2 -1
- package/src/langs/zh_cn.js +2 -1
- package/src/langs/zh_tw.js +2 -1
- package/src/modules/dialog/dialog.ts +6 -6
- package/src/modules/dialog/prompt.ts +1 -1
- package/src/modules/file-browser/README.md +2 -2
- package/src/modules/file-browser/builders/context-menu.ts +12 -13
- package/src/modules/file-browser/fetch/load-tree.ts +1 -1
- package/src/modules/file-browser/file-browser.ts +10 -7
- package/src/modules/history/README.md +5 -0
- package/src/modules/{observer → history}/command.ts +5 -5
- package/src/modules/{observer/observer.ts → history/history.ts} +97 -55
- package/src/modules/{observer → history}/snapshot.ts +3 -4
- package/src/modules/{observer → history}/stack.ts +4 -4
- package/src/modules/image-editor/image-editor.ts +8 -8
- package/src/modules/image-editor/templates/form.ts +2 -2
- package/src/modules/index.ts +3 -3
- package/src/modules/status-bar/status-bar.ts +4 -0
- package/src/modules/table/table.ts +2 -2
- package/src/modules/toolbar/button/button.ts +2 -2
- package/src/modules/toolbar/collection/collection.ts +1 -1
- package/src/modules/uploader/helpers/process-old-browser-drag.ts +1 -1
- package/src/modules/uploader/helpers/send-files.ts +1 -1
- package/src/modules/uploader/helpers/send.ts +1 -1
- package/src/modules/uploader/uploader.ts +3 -3
- package/src/modules/widget/color-picker/color-picker.ts +2 -3
- package/src/modules/widget/tabs/tabs.ts +17 -12
- package/src/plugins/add-new-line/add-new-line.ts +8 -8
- package/src/plugins/class-span/class-span.ts +1 -1
- package/src/plugins/clipboard/copy-format.ts +1 -1
- package/src/plugins/clipboard/drag-and-drop-element.ts +4 -2
- package/src/plugins/clipboard/paste/config.ts +19 -3
- package/src/plugins/clipboard/paste/helpers.ts +17 -50
- package/src/plugins/clipboard/paste/interface.ts +6 -0
- package/src/plugins/clipboard/paste/paste.ts +22 -8
- package/src/plugins/clipboard/paste-from-word/config.ts +17 -0
- package/src/plugins/clipboard/paste-from-word/paste-from-word.ts +15 -6
- package/src/plugins/clipboard/paste-storage/paste-storage.ts +6 -6
- package/src/plugins/color/color.ts +2 -2
- package/src/plugins/error-messages/error-messages.ts +2 -2
- package/src/plugins/fix/clean-html/README.md +26 -0
- package/src/plugins/fix/{clean-html.ts → clean-html/clean-html.ts} +59 -142
- package/src/plugins/fix/clean-html/config.ts +106 -0
- package/src/plugins/fix/index.ts +12 -0
- package/src/plugins/fix/wrap-nodes/README.md +27 -0
- package/src/plugins/fix/wrap-nodes/config.ts +24 -0
- package/src/plugins/fix/{wrap-text-nodes.ts → wrap-nodes/wrap-nodes.ts} +9 -4
- package/src/plugins/focus/focus.ts +1 -1
- package/src/plugins/format-block/format-block.ts +1 -1
- package/src/plugins/fullsize/fullsize.ts +4 -4
- package/src/plugins/iframe/iframe.ts +3 -3
- package/src/plugins/image/image-properties/image-properties.ts +12 -13
- package/src/plugins/indent/indent.ts +1 -1
- package/src/plugins/index.ts +2 -2
- package/src/plugins/inline-popup/config/items/a.ts +2 -2
- package/src/plugins/inline-popup/config/items/cells.ts +11 -11
- package/src/plugins/inline-popup/config/items/iframe.ts +1 -1
- package/src/plugins/inline-popup/config/items/img.ts +7 -7
- package/src/plugins/inline-popup/inline-popup.ts +5 -5
- package/src/plugins/keyboard/backspace/backspace.ts +1 -1
- package/src/plugins/keyboard/backspace/cases/check-join-neighbors.ts +1 -1
- package/src/plugins/keyboard/helpers.ts +1 -1
- package/src/plugins/keyboard/hotkeys.ts +1 -1
- package/src/plugins/limit/limit.ts +3 -3
- package/src/plugins/line-height/line-height.ts +1 -1
- package/src/plugins/link/link.ts +8 -8
- package/src/plugins/link/template.ts +2 -2
- package/src/plugins/media/file.ts +1 -1
- package/src/plugins/media/media.ts +1 -1
- package/src/plugins/media/video/config.ts +1 -1
- package/src/plugins/mobile/config.ts +1 -1
- package/src/plugins/mobile/mobile.ts +1 -1
- package/src/plugins/ordered-list/config.ts +61 -0
- package/src/plugins/ordered-list/ordered-list.ts +3 -153
- package/src/plugins/placeholder/placeholder.ts +3 -3
- package/src/plugins/print/helpers.ts +14 -7
- package/src/plugins/print/index.ts +1 -1
- package/src/plugins/print/{preview.less → preview/preview.less} +1 -1
- package/src/plugins/print/{preview.ts → preview/preview.ts} +9 -8
- package/src/plugins/print/print.ts +19 -10
- package/src/plugins/redo-undo/redo-undo.ts +3 -3
- package/src/plugins/resizer/resizer.ts +11 -11
- package/src/plugins/search/README.md +38 -0
- package/src/plugins/search/config.ts +82 -0
- package/src/plugins/search/helpers/index.ts +12 -0
- package/src/plugins/search/helpers/sentence-finder.ts +103 -0
- package/src/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.ts +120 -0
- package/src/plugins/search/search.ts +269 -615
- package/src/plugins/search/ui/search.less +159 -0
- package/src/plugins/search/ui/search.ts +256 -0
- package/src/plugins/select/select.ts +1 -1
- package/src/plugins/size/config.ts +8 -8
- package/src/plugins/size/resize-handler.ts +3 -3
- package/src/plugins/size/size.ts +4 -4
- package/src/plugins/source/editor/engines/ace.ts +9 -9
- package/src/plugins/source/editor/engines/area.ts +3 -3
- package/src/plugins/source/source.ts +6 -6
- package/src/plugins/spellcheck/README.md +1 -0
- package/src/plugins/spellcheck/config.ts +34 -0
- package/src/plugins/spellcheck/spellcheck.svg +4 -0
- package/src/plugins/spellcheck/spellcheck.ts +48 -0
- package/src/plugins/sticky/sticky.ts +3 -3
- package/src/plugins/table/resize-cells.ts +11 -11
- package/src/plugins/table/select-cells.ts +2 -2
- package/src/plugins/tooltip/tooltip.ts +1 -1
- package/src/plugins/xpath/xpath.ts +8 -8
- package/src/polyfills.ts +5 -4
- package/src/styles/icons/README.md +2 -2
- package/src/types/async.d.ts +12 -2
- package/src/types/core.ts +1 -1
- package/src/types/events.d.ts +6 -2
- package/src/types/file-browser.d.ts +1 -2
- package/{types/types/observer.d.ts → src/types/history.d.ts} +11 -7
- package/src/types/index.d.ts +1 -1
- package/src/types/jodit.d.ts +12 -4
- package/src/types/toolbar.d.ts +5 -5
- package/src/types/types.d.ts +11 -4
- package/types/config.d.ts +68 -35
- package/types/core/async/async.d.ts +11 -4
- package/types/core/constants.d.ts +1 -0
- package/types/core/dom/dom.d.ts +3 -5
- package/types/core/dom/index.d.ts +1 -0
- package/types/core/dom/lazy-walker.d.ts +37 -0
- package/types/core/event-emitter/eventify.d.ts +39 -0
- package/types/core/event-emitter/index.d.ts +1 -0
- package/types/core/helpers/string/fuzzy-search-index.d.ts +10 -0
- package/types/core/helpers/string/i18n.d.ts +1 -1
- package/types/core/helpers/string/index.d.ts +3 -2
- package/types/core/helpers/utils/utils.d.ts +1 -1
- package/types/core/selection/select.d.ts +1 -1
- package/types/core/ui/button/button/button.d.ts +4 -4
- package/types/core/view/view.d.ts +1 -1
- package/types/jodit.d.ts +19 -6
- package/types/modules/{observer → history}/command.d.ts +4 -4
- package/types/modules/{observer/observer.d.ts → history/history.d.ts} +17 -9
- package/types/modules/{observer → history}/snapshot.d.ts +1 -1
- package/types/modules/{observer → history}/stack.d.ts +3 -3
- package/types/modules/image-editor/image-editor.d.ts +1 -1
- package/types/modules/index.d.ts +3 -3
- package/types/modules/toolbar/button/button.d.ts +2 -5
- package/types/modules/widget/tabs/tabs.d.ts +1 -1
- package/types/plugins/class-span/class-span.d.ts +1 -1
- package/types/plugins/clipboard/paste/config.d.ts +8 -0
- package/types/plugins/clipboard/paste/helpers.d.ts +2 -2
- package/types/plugins/clipboard/paste/interface.d.ts +5 -0
- package/types/plugins/clipboard/paste-from-word/config.d.ts +5 -0
- package/types/plugins/clipboard/paste-from-word/paste-from-word.d.ts +3 -2
- package/types/plugins/fix/clean-html/clean-html.d.ts +70 -0
- package/types/plugins/fix/{clean-html.d.ts → clean-html/config.d.ts} +2 -57
- package/types/plugins/fix/index.d.ts +10 -0
- package/types/plugins/fix/wrap-nodes/config.d.ts +16 -0
- package/types/plugins/fix/{wrap-text-nodes.d.ts → wrap-nodes/wrap-nodes.d.ts} +5 -2
- package/types/plugins/fullsize/fullsize.d.ts +2 -2
- package/types/plugins/index.d.ts +2 -2
- package/types/plugins/ordered-list/config.d.ts +6 -0
- package/types/plugins/ordered-list/ordered-list.d.ts +1 -1
- package/types/plugins/print/helpers.d.ts +2 -2
- package/types/plugins/print/index.d.ts +1 -1
- package/types/plugins/print/{preview.d.ts → preview/preview.d.ts} +1 -1
- package/types/plugins/search/config.d.ts +36 -0
- package/types/plugins/search/helpers/index.d.ts +10 -0
- package/types/plugins/search/helpers/sentence-finder.d.ts +21 -0
- package/types/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.d.ts +14 -0
- package/types/plugins/search/search.d.ts +25 -39
- package/types/plugins/search/ui/search.d.ts +37 -0
- package/types/plugins/spellcheck/config.d.ts +15 -0
- package/types/plugins/spellcheck/spellcheck.d.ts +19 -0
- package/types/plugins/sticky/sticky.d.ts +2 -2
- package/types/types/async.d.ts +12 -2
- package/types/types/core.d.ts +1 -1
- package/types/types/core.ts +1 -1
- package/types/types/events.d.ts +6 -2
- package/types/types/file-browser.d.ts +1 -2
- package/{src/types/observer.d.ts → types/types/history.d.ts} +11 -7
- package/types/types/index.d.ts +1 -1
- package/types/types/jodit.d.ts +12 -4
- package/types/types/toolbar.d.ts +5 -5
- package/types/types/types.d.ts +11 -4
- package/src/modules/observer/README.md +0 -0
- package/src/plugins/search/search.less +0 -152
package/types/config.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ import type { IExtraPlugin, IDictionary, IViewOptions, NodeFunction, Attributes,
|
|
|
11
11
|
* Default Editor's Configuration
|
|
12
12
|
*/
|
|
13
13
|
export declare class Config implements IViewOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Timeout of all asynchronous methods
|
|
16
|
+
*/
|
|
17
|
+
defaultTimeout: number;
|
|
14
18
|
namespace: string;
|
|
15
19
|
/**
|
|
16
20
|
* Editor loads completely without plugins. Useful when debugging your own plugin.
|
|
@@ -100,11 +104,6 @@ export declare class Config implements IViewOptions {
|
|
|
100
104
|
* if set true then the current mode is saved in a cookie , and is restored after a reload of the page
|
|
101
105
|
*/
|
|
102
106
|
saveModeInStorage: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Options specifies whether the editor is to have its spelling and grammar checked or not
|
|
105
|
-
* @see {@link http://www.w3schools.com/tags/att_global_spellcheck.asp}
|
|
106
|
-
*/
|
|
107
|
-
spellcheck: boolean;
|
|
108
107
|
/**
|
|
109
108
|
* Class name that can be appended to the editor
|
|
110
109
|
*
|
|
@@ -113,7 +112,7 @@ export declare class Config implements IViewOptions {
|
|
|
113
112
|
*
|
|
114
113
|
* @example
|
|
115
114
|
* ```javascript
|
|
116
|
-
*
|
|
115
|
+
* Jodit.make('#editor', {
|
|
117
116
|
* editorCssClass: 'some_my_class'
|
|
118
117
|
* });
|
|
119
118
|
* ```
|
|
@@ -131,7 +130,7 @@ export declare class Config implements IViewOptions {
|
|
|
131
130
|
*
|
|
132
131
|
* @example
|
|
133
132
|
* ```javascript
|
|
134
|
-
*
|
|
133
|
+
* Jodit.make('#editor', {
|
|
135
134
|
* style: {
|
|
136
135
|
* font: '12px Arial'
|
|
137
136
|
* }
|
|
@@ -144,7 +143,7 @@ export declare class Config implements IViewOptions {
|
|
|
144
143
|
*
|
|
145
144
|
* @example
|
|
146
145
|
* ```javascript
|
|
147
|
-
* var editor =
|
|
146
|
+
* var editor = Jodit.make('#editor');
|
|
148
147
|
* document.getElementById('editor').addEventListener('change', function () {
|
|
149
148
|
* console.log(this.value);
|
|
150
149
|
* })
|
|
@@ -158,7 +157,7 @@ export declare class Config implements IViewOptions {
|
|
|
158
157
|
* 'rtl' – Indicates a Right-To-Left text direction (like in Arabic).
|
|
159
158
|
* @example
|
|
160
159
|
* ```javascript
|
|
161
|
-
*
|
|
160
|
+
* Jodit.make('.editor', {
|
|
162
161
|
* direction: 'rtl'
|
|
163
162
|
* })
|
|
164
163
|
* ```
|
|
@@ -174,7 +173,7 @@ export declare class Config implements IViewOptions {
|
|
|
174
173
|
* <!-- include in you page lang file -->
|
|
175
174
|
* <script src="jodit/lang/de.js"></script>
|
|
176
175
|
* <script>
|
|
177
|
-
* var editor =
|
|
176
|
+
* var editor = Jodit.make('.editor', {
|
|
178
177
|
* language: 'de'
|
|
179
178
|
* });
|
|
180
179
|
* </script>
|
|
@@ -187,7 +186,7 @@ export declare class Config implements IViewOptions {
|
|
|
187
186
|
* @example
|
|
188
187
|
* ```html
|
|
189
188
|
* <script>
|
|
190
|
-
* var editor =
|
|
189
|
+
* var editor = Jodit.make('.editor', {
|
|
191
190
|
* debugLanguage: true
|
|
192
191
|
* });
|
|
193
192
|
*
|
|
@@ -201,7 +200,7 @@ export declare class Config implements IViewOptions {
|
|
|
201
200
|
*
|
|
202
201
|
* @example
|
|
203
202
|
* ```javascript
|
|
204
|
-
* var editor =
|
|
203
|
+
* var editor = Jodit.make('#editor', {
|
|
205
204
|
* language: 'ru',
|
|
206
205
|
* i18n: {
|
|
207
206
|
* ru: {
|
|
@@ -254,7 +253,7 @@ export declare class Config implements IViewOptions {
|
|
|
254
253
|
* Jodit.MODE_SOURCE syntax highlighting source editor
|
|
255
254
|
* @example
|
|
256
255
|
* ```javascript
|
|
257
|
-
* var editor =
|
|
256
|
+
* var editor = Jodit.make('#editor', {
|
|
258
257
|
* defaultMode: Jodit.MODE_SPLIT
|
|
259
258
|
* });
|
|
260
259
|
* console.log(editor.getRealMode())
|
|
@@ -269,7 +268,7 @@ export declare class Config implements IViewOptions {
|
|
|
269
268
|
* The colors in HEX representation to select a color for the background and for the text in colorpicker
|
|
270
269
|
* @example
|
|
271
270
|
* ```javascript
|
|
272
|
-
*
|
|
271
|
+
* Jodit.make('#editor', {
|
|
273
272
|
* colors: ['#ff0000', '#00ff00', '#0000ff']
|
|
274
273
|
* })
|
|
275
274
|
* ```
|
|
@@ -279,7 +278,7 @@ export declare class Config implements IViewOptions {
|
|
|
279
278
|
* The default tab color picker
|
|
280
279
|
* @example
|
|
281
280
|
* ```javascript
|
|
282
|
-
*
|
|
281
|
+
* Jodit.make('#editor2', {
|
|
283
282
|
* colorPickerDefaultTab: 'color'
|
|
284
283
|
* })
|
|
285
284
|
* ```
|
|
@@ -303,11 +302,11 @@ export declare class Config implements IViewOptions {
|
|
|
303
302
|
* Do not init these plugins
|
|
304
303
|
* @example
|
|
305
304
|
* ```typescript
|
|
306
|
-
* var editor =
|
|
305
|
+
* var editor = Jodit.make('.editor', {
|
|
307
306
|
* disablePlugins: 'table,iframe'
|
|
308
307
|
* });
|
|
309
308
|
* //or
|
|
310
|
-
* var editor =
|
|
309
|
+
* var editor = Jodit.make('.editor', {
|
|
311
310
|
* disablePlugins: ['table', 'iframe']
|
|
312
311
|
* });
|
|
313
312
|
* ```
|
|
@@ -317,7 +316,7 @@ export declare class Config implements IViewOptions {
|
|
|
317
316
|
* Init and download extra plugins
|
|
318
317
|
* @example
|
|
319
318
|
* ```typescript
|
|
320
|
-
* var editor =
|
|
319
|
+
* var editor = Jodit.make('.editor', {
|
|
321
320
|
* extraPlugins: ['emoji']
|
|
322
321
|
* });
|
|
323
322
|
* ```
|
|
@@ -329,7 +328,7 @@ export declare class Config implements IViewOptions {
|
|
|
329
328
|
*/
|
|
330
329
|
basePath?: string;
|
|
331
330
|
/**
|
|
332
|
-
*
|
|
331
|
+
* These buttons list will be added to option.buttons
|
|
333
332
|
*/
|
|
334
333
|
extraButtons: Array<string | IControlType>;
|
|
335
334
|
/**
|
|
@@ -371,6 +370,41 @@ export declare class Config implements IViewOptions {
|
|
|
371
370
|
extraIcons: IDictionary<string>;
|
|
372
371
|
/**
|
|
373
372
|
* Default attributes for created inside editor elements
|
|
373
|
+
* @example
|
|
374
|
+
* ```js
|
|
375
|
+
* const editor2 = Jodit.make('#editor', {
|
|
376
|
+
* createAttributes: {
|
|
377
|
+
* div: {
|
|
378
|
+
* class: 'test'
|
|
379
|
+
* },
|
|
380
|
+
* ul: function (ul) {
|
|
381
|
+
* ul.classList.add('ui-test');
|
|
382
|
+
* }
|
|
383
|
+
* }
|
|
384
|
+
* });
|
|
385
|
+
*
|
|
386
|
+
* const div2 = editor2.createInside.div();
|
|
387
|
+
* expect(div2.className).equals('test');
|
|
388
|
+
*
|
|
389
|
+
* const ul = editor2.createInside.element('ul');
|
|
390
|
+
* expect(ul.className).equals('ui-test');
|
|
391
|
+
* ```
|
|
392
|
+
* Or JSX in React
|
|
393
|
+
* @example
|
|
394
|
+
* ```jsx
|
|
395
|
+
* import React, {useState, useRef} from 'react';
|
|
396
|
+
* import JoditEditor from "jodit-react";
|
|
397
|
+
*
|
|
398
|
+
* const config = {
|
|
399
|
+
* createAttributes: {
|
|
400
|
+
* div: {
|
|
401
|
+
* class: 'align-center'
|
|
402
|
+
* }
|
|
403
|
+
* }
|
|
404
|
+
* };
|
|
405
|
+
*
|
|
406
|
+
* <JoditEditor config={config}/>
|
|
407
|
+
* ```
|
|
374
408
|
*/
|
|
375
409
|
createAttributes: IDictionary<Attributes | NodeFunction>;
|
|
376
410
|
/**
|
|
@@ -390,7 +424,7 @@ export declare class Config implements IViewOptions {
|
|
|
390
424
|
* Note - this is not the width of the device, the width of the editor
|
|
391
425
|
* @example
|
|
392
426
|
* ```javascript
|
|
393
|
-
*
|
|
427
|
+
* Jodit.make('#editor', {
|
|
394
428
|
* buttons: ['bold', 'italic', 'source'],
|
|
395
429
|
* buttonsMD: ['bold', 'italic'],
|
|
396
430
|
* buttonsXS: ['bold', 'fullsize'],
|
|
@@ -398,32 +432,31 @@ export declare class Config implements IViewOptions {
|
|
|
398
432
|
* ```
|
|
399
433
|
* @example
|
|
400
434
|
* ```javascript
|
|
401
|
-
*
|
|
435
|
+
* Jodit.make('#editor2', {
|
|
402
436
|
* buttons: [{
|
|
403
|
-
* name: '
|
|
437
|
+
* name: 'empty',
|
|
404
438
|
* icon: 'source',
|
|
405
|
-
* exec: function () {
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* div.textContent = this.val();
|
|
439
|
+
* exec: function (editor) {
|
|
440
|
+
* const dialog = new Jodit.modules.Dialog({}),
|
|
441
|
+
* text = editor.c.element('textarea');
|
|
442
|
+
*
|
|
410
443
|
* dialog.setHeader('Source code');
|
|
411
444
|
* dialog.setContent(text);
|
|
412
445
|
* dialog.setSize(400, 300);
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
|
|
419
|
-
* dialog.
|
|
446
|
+
*
|
|
447
|
+
* Jodit.modules.Helpers.css(elm, {
|
|
448
|
+
* width: '100%',
|
|
449
|
+
* height: '100%'
|
|
450
|
+
* })
|
|
451
|
+
|
|
452
|
+
* dialog.open();
|
|
420
453
|
* }
|
|
421
454
|
* }]
|
|
422
455
|
* });
|
|
423
456
|
* ```
|
|
424
457
|
* @example
|
|
425
458
|
* ```javascript
|
|
426
|
-
*
|
|
459
|
+
* Jodit.make('#editor2', {
|
|
427
460
|
* buttons: Jodit.defaultOptions.buttons.concat([{
|
|
428
461
|
* name: 'listsss',
|
|
429
462
|
* iconURL: 'stuf/dummy.png',
|
|
@@ -22,7 +22,7 @@ export declare class Async implements IAsync {
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```javascript
|
|
25
|
-
* var jodit =
|
|
25
|
+
* var jodit = Jodit.make('.editor');
|
|
26
26
|
* jodit.e.on('mousemove', jodit.async.debounce(() => {
|
|
27
27
|
* // Do expensive things
|
|
28
28
|
* }, 100));
|
|
@@ -35,7 +35,7 @@ export declare class Async implements IAsync {
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```javascript
|
|
38
|
-
* var jodit =
|
|
38
|
+
* var jodit = Jodit.make('.editor');
|
|
39
39
|
* jodit.e.on(document.body, 'scroll', jodit.async.throttle(function() {
|
|
40
40
|
* // Do expensive things
|
|
41
41
|
* }, 100));
|
|
@@ -49,11 +49,18 @@ export declare class Async implements IAsync {
|
|
|
49
49
|
*/
|
|
50
50
|
promiseState(p: Promise<any>): Promise<'pending' | 'fulfilled' | 'rejected'>;
|
|
51
51
|
private requestsIdle;
|
|
52
|
+
private requestsRaf;
|
|
52
53
|
private requestIdleCallbackNative;
|
|
53
54
|
private cancelIdleCallbackNative;
|
|
54
|
-
requestIdleCallback(callback: IdleRequestCallback
|
|
55
|
-
|
|
55
|
+
requestIdleCallback(callback: IdleRequestCallback, options?: {
|
|
56
|
+
timeout: number;
|
|
57
|
+
}): number;
|
|
58
|
+
requestIdlePromise(options?: {
|
|
59
|
+
timeout: number;
|
|
60
|
+
}): RejectablePromise<number>;
|
|
56
61
|
cancelIdleCallback(request: number): void;
|
|
62
|
+
requestAnimationFrame(callback: FrameRequestCallback): number;
|
|
63
|
+
cancelAnimationFrame(request: number): void;
|
|
57
64
|
clear(): void;
|
|
58
65
|
isDestructed: boolean;
|
|
59
66
|
destruct(): any;
|
|
@@ -57,6 +57,7 @@ export declare const IS_IE: boolean;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare const TEXT_PLAIN: string;
|
|
59
59
|
export declare const TEXT_HTML: string;
|
|
60
|
+
export declare const TEXT_RTF: string;
|
|
60
61
|
export declare const MARKER_CLASS = "jodit-selection_marker";
|
|
61
62
|
export declare const EMULATE_DBLCLICK_TIMEOUT = 300;
|
|
62
63
|
/**
|
package/types/core/dom/dom.d.ts
CHANGED
|
@@ -21,10 +21,8 @@ export declare class Dom {
|
|
|
21
21
|
* Wrap all inline siblings
|
|
22
22
|
*/
|
|
23
23
|
static wrapInline(current: Node, tag: Node | HTMLTagNames, editor: IJodit): HTMLElement;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
static wrap<K extends HTMLTagNames>(current: Node, tag: K, create: ICreate): HTMLElementTagNameMap[K];
|
|
24
|
+
static wrap<K extends HTMLTagNames>(current: Node | Range, tag: HTMLElement, create: ICreate): HTMLElementTagNameMap[K];
|
|
25
|
+
static wrap<K extends HTMLTagNames>(current: Node | Range, tag: K, create: ICreate): HTMLElementTagNameMap[K];
|
|
28
26
|
/**
|
|
29
27
|
* Remove parent of node and insert this node instead that parent
|
|
30
28
|
*/
|
|
@@ -148,7 +146,7 @@ export declare class Dom {
|
|
|
148
146
|
* Get not empty sibling
|
|
149
147
|
*/
|
|
150
148
|
static findSibling(node: Node, left?: boolean, cond?: (n: Node) => boolean): Nullable<Node>;
|
|
151
|
-
static sibling(node: Node, left
|
|
149
|
+
static sibling(node: Node, left?: boolean): Nullable<Node>;
|
|
152
150
|
/**
|
|
153
151
|
* It goes through all the elements in ascending order, and checks to see if they meet the predetermined condition
|
|
154
152
|
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module dom
|
|
8
|
+
*/
|
|
9
|
+
import type { IAsync, IDestructible } from 'jodit/types';
|
|
10
|
+
import { Eventify } from 'jodit/core/event-emitter/eventify';
|
|
11
|
+
export declare class LazyWalker extends Eventify<{
|
|
12
|
+
visit: (node: Node) => boolean;
|
|
13
|
+
break: (reason?: string) => void;
|
|
14
|
+
end: (affect: boolean) => void;
|
|
15
|
+
}> implements IDestructible {
|
|
16
|
+
private readonly async;
|
|
17
|
+
private readonly options;
|
|
18
|
+
private workNodes;
|
|
19
|
+
setWork(root: Node): this;
|
|
20
|
+
private hadAffect;
|
|
21
|
+
private isWorked;
|
|
22
|
+
private isFinished;
|
|
23
|
+
constructor(async: IAsync, options?: {
|
|
24
|
+
readonly timeout?: number;
|
|
25
|
+
readonly whatToShow?: number;
|
|
26
|
+
readonly reverse?: boolean;
|
|
27
|
+
readonly timeoutChunkSize?: number;
|
|
28
|
+
});
|
|
29
|
+
private idleId;
|
|
30
|
+
private startIdleRequest;
|
|
31
|
+
break(reason?: string): void;
|
|
32
|
+
end(): void;
|
|
33
|
+
private stop;
|
|
34
|
+
destruct(): void;
|
|
35
|
+
private workPerform;
|
|
36
|
+
private visitNode;
|
|
37
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module event-emitter
|
|
8
|
+
*/
|
|
9
|
+
import type { CanUndef } from 'jodit/types';
|
|
10
|
+
/**
|
|
11
|
+
* Class for adding event handling capability
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* class SomeClass extends Eventify<{ start: (node: Node) => boolean; }> {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* setTimeout(() => {
|
|
18
|
+
* if (this.emit('start', document.body)) {
|
|
19
|
+
* console.log('yes');
|
|
20
|
+
* };
|
|
21
|
+
* }, 100);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* const sm = new SomeClass();
|
|
26
|
+
* sm.on('start', (node) => {
|
|
27
|
+
* console.log(node);
|
|
28
|
+
* return true;
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class Eventify<MAP extends {
|
|
33
|
+
[key: string]: (...args: any[]) => any;
|
|
34
|
+
}, EVENT extends keyof MAP = keyof MAP> {
|
|
35
|
+
private map;
|
|
36
|
+
on(name: EVENT, func: MAP[EVENT]): this;
|
|
37
|
+
off(name: keyof MAP, func: MAP[EVENT]): this;
|
|
38
|
+
protected emit(name: EVENT, ...args: Parameters<MAP[EVENT]>): CanUndef<ReturnType<MAP[EVENT]>>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Finds the position of the substring in the string, if any, and returns the length of the found subsequence.
|
|
8
|
+
* Unlike `indexOf` ignores INVISIBLE_SPACE and may fail at `maxDistance` characters
|
|
9
|
+
*/
|
|
10
|
+
export declare function fuzzySearchIndex(needle: string, haystack: string, offset?: number, maxDistance?: number): [number, number];
|
|
@@ -15,7 +15,7 @@ export declare const sprintf: (str: string, args?: (string | number)[] | undefin
|
|
|
15
15
|
* Internationalization method. Uses Jodit.lang object
|
|
16
16
|
* @example
|
|
17
17
|
* ```javascript
|
|
18
|
-
* var editor =
|
|
18
|
+
* var editor = Jodit.make("#redactor", {
|
|
19
19
|
* language: 'ru'
|
|
20
20
|
* });
|
|
21
21
|
* console.log(editor.i18n('Cancel')) //Отмена;
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* @module helpers/string
|
|
8
8
|
*/
|
|
9
9
|
export * from './camel-case';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './fuzzy-search-index';
|
|
11
|
+
export * from './i18n';
|
|
11
12
|
export * from './kebab-case';
|
|
13
|
+
export * from './stringify';
|
|
12
14
|
export * from './trim';
|
|
13
15
|
export * from './ucfirst';
|
|
14
|
-
export * from './i18n';
|
|
@@ -24,7 +24,7 @@ export declare function attr(elm: Element, key: string): null | string;
|
|
|
24
24
|
/**
|
|
25
25
|
* Remove attribute
|
|
26
26
|
*/
|
|
27
|
-
export declare function attr(elm: Element, key: string, value: null):
|
|
27
|
+
export declare function attr(elm: Element, key: string, value: null): void;
|
|
28
28
|
/**
|
|
29
29
|
* Set attribute
|
|
30
30
|
*/
|
|
@@ -188,7 +188,7 @@ export declare class Select implements ISelect {
|
|
|
188
188
|
* Return current selected HTML
|
|
189
189
|
* @example
|
|
190
190
|
* ```javascript
|
|
191
|
-
* const editor =
|
|
191
|
+
* const editor = Jodit.make();
|
|
192
192
|
* console.log(editor.s.html); // html
|
|
193
193
|
* console.log(Jodit.modules.Helpers.stripTags(editor.s.html)); // plain text
|
|
194
194
|
* ```
|
|
@@ -16,8 +16,8 @@ export declare class UIButton extends UIElement implements IUIButton {
|
|
|
16
16
|
/**
|
|
17
17
|
* Marker for buttons
|
|
18
18
|
*/
|
|
19
|
-
isButton: true;
|
|
20
|
-
state: IUIButtonState;
|
|
19
|
+
readonly isButton: true;
|
|
20
|
+
readonly state: IUIButtonState;
|
|
21
21
|
/**
|
|
22
22
|
* Set state
|
|
23
23
|
*/
|
|
@@ -43,7 +43,7 @@ export declare class UIButton extends UIElement implements IUIButton {
|
|
|
43
43
|
protected onChangeActivated(): void;
|
|
44
44
|
protected onChangeName(): void;
|
|
45
45
|
protected onChangeTooltip(): void;
|
|
46
|
-
onChangeTabIndex(): void;
|
|
46
|
+
protected onChangeTabIndex(): void;
|
|
47
47
|
protected onChangeIcon(): void;
|
|
48
48
|
/**
|
|
49
49
|
* Set focus on element
|
|
@@ -57,7 +57,7 @@ export declare class UIButton extends UIElement implements IUIButton {
|
|
|
57
57
|
protected createContainer(): HTMLElement;
|
|
58
58
|
constructor(jodit: IViewBased, state?: IUIButtonStatePartial);
|
|
59
59
|
destruct(): any;
|
|
60
|
-
private actionHandlers;
|
|
60
|
+
private readonly actionHandlers;
|
|
61
61
|
/**
|
|
62
62
|
* Add action handler
|
|
63
63
|
*/
|
|
@@ -38,7 +38,7 @@ export declare abstract class View extends Component implements IViewBased, Mods
|
|
|
38
38
|
readonly version: string;
|
|
39
39
|
/**
|
|
40
40
|
* Return default timeout period in milliseconds for some debounce or throttle functions.
|
|
41
|
-
* By default
|
|
41
|
+
* By default, `{history.timeout}` options
|
|
42
42
|
*/
|
|
43
43
|
get defaultTimeout(): number;
|
|
44
44
|
readonly async: IAsync;
|
package/types/jodit.d.ts
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @module jodit
|
|
10
10
|
*/
|
|
11
|
-
import type { CustomCommand, IDictionary, IPluginSystem, IStatusBar, IWorkPlace, Modes, IFileBrowser, IJodit, IUploader, ICreate, IStorage, CanPromise,
|
|
11
|
+
import type { CustomCommand, IDictionary, IPluginSystem, IStatusBar, IWorkPlace, Modes, IFileBrowser, IJodit, IUploader, ICreate, IStorage, CanPromise, IHistory } from './types';
|
|
12
12
|
import { Config } from './config';
|
|
13
|
+
import * as constants from './core/constants';
|
|
13
14
|
import { Plugin, Select } from './modules/';
|
|
14
15
|
import { ViewWithToolbar } from './core/view/view-with-toolbar';
|
|
15
16
|
/**
|
|
@@ -40,7 +41,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
40
41
|
get text(): string;
|
|
41
42
|
/**
|
|
42
43
|
* Return default timeout period in milliseconds for some debounce or throttle functions.
|
|
43
|
-
* By default
|
|
44
|
+
* By default, `{history.timeout}` options
|
|
44
45
|
*/
|
|
45
46
|
get defaultTimeout(): number;
|
|
46
47
|
/**
|
|
@@ -66,6 +67,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
66
67
|
static readonly modules: IDictionary<Function>;
|
|
67
68
|
static readonly ns: IDictionary<Function>;
|
|
68
69
|
static readonly decorators: IDictionary<Function>;
|
|
70
|
+
static readonly constants: typeof constants;
|
|
69
71
|
static readonly instances: IDictionary<IJodit>;
|
|
70
72
|
static readonly lang: any;
|
|
71
73
|
static readonly core: {
|
|
@@ -111,7 +113,11 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
111
113
|
*/
|
|
112
114
|
get iframe(): HTMLIFrameElement | void;
|
|
113
115
|
set iframe(iframe: HTMLIFrameElement | void);
|
|
114
|
-
get
|
|
116
|
+
get history(): IHistory;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Instead use `Jodit.history`
|
|
119
|
+
*/
|
|
120
|
+
get observer(): IHistory;
|
|
115
121
|
/**
|
|
116
122
|
* In iframe mode editor's window can be different by owner
|
|
117
123
|
*/
|
|
@@ -165,11 +171,16 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
165
171
|
*/
|
|
166
172
|
getEditorValue(removeSelectionMarkers?: boolean, consumer?: string): string;
|
|
167
173
|
private __callChangeCount;
|
|
174
|
+
synchronizeValues(): void;
|
|
168
175
|
/**
|
|
169
176
|
* Set editor html value and if set sync fill source element value
|
|
170
177
|
* When method was called without arguments - it is simple way to synchronize editor to element
|
|
171
178
|
*/
|
|
172
179
|
setEditorValue(value?: string): void;
|
|
180
|
+
/**
|
|
181
|
+
* If some plugin changes the DOM directly, then you need to update the content of the original element
|
|
182
|
+
*/
|
|
183
|
+
protected updateElementValue(): void;
|
|
173
184
|
/**
|
|
174
185
|
* Return source element value
|
|
175
186
|
*/
|
|
@@ -184,7 +195,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
184
195
|
*
|
|
185
196
|
* @example
|
|
186
197
|
* ```javascript
|
|
187
|
-
* var jodit =
|
|
198
|
+
* var jodit = Jodit.make('#editor);
|
|
188
199
|
*
|
|
189
200
|
* jodit.setEditorValue('test test test');
|
|
190
201
|
*
|
|
@@ -260,7 +271,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
260
271
|
*
|
|
261
272
|
* @example
|
|
262
273
|
* ```javascript
|
|
263
|
-
* var editor =
|
|
274
|
+
* var editor = Jodit.make('#editor');
|
|
264
275
|
* console.log(editor.getRealMode());
|
|
265
276
|
* ```
|
|
266
277
|
*/
|
|
@@ -274,7 +285,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
274
285
|
*
|
|
275
286
|
* @example
|
|
276
287
|
* ```javascript
|
|
277
|
-
* var editor =
|
|
288
|
+
* var editor = Jodit.make('#editor');
|
|
278
289
|
* editor.toggleMode();
|
|
279
290
|
* ```
|
|
280
291
|
*/
|
|
@@ -317,6 +328,8 @@ export declare class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
317
328
|
*
|
|
318
329
|
* @param element - Selector or HTMLElement
|
|
319
330
|
* @param options - Editor's options
|
|
331
|
+
*
|
|
332
|
+
* @deprecated - Instead use `Jodit.make`
|
|
320
333
|
*/
|
|
321
334
|
constructor(element: HTMLElement | string, options?: object);
|
|
322
335
|
currentPlace: IWorkPlace;
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* @module modules/
|
|
7
|
+
* @module modules/history
|
|
8
8
|
*/
|
|
9
9
|
import type { SnapshotType } from 'jodit/types';
|
|
10
|
-
import type {
|
|
10
|
+
import type { History } from './history';
|
|
11
11
|
export declare class Command {
|
|
12
12
|
readonly oldValue: SnapshotType;
|
|
13
13
|
readonly newValue: SnapshotType;
|
|
14
|
-
readonly
|
|
14
|
+
private readonly history;
|
|
15
15
|
readonly tick: number;
|
|
16
16
|
undo(): void;
|
|
17
17
|
redo(): void;
|
|
18
|
-
constructor(oldValue: SnapshotType, newValue: SnapshotType,
|
|
18
|
+
constructor(oldValue: SnapshotType, newValue: SnapshotType, history: History, tick: number);
|
|
19
19
|
}
|