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/src/jodit.ts
CHANGED
|
@@ -27,16 +27,16 @@ import type {
|
|
|
27
27
|
IFileBrowserCallBackData,
|
|
28
28
|
IStorage,
|
|
29
29
|
CanPromise,
|
|
30
|
-
|
|
30
|
+
IHistory
|
|
31
31
|
} from './types';
|
|
32
32
|
|
|
33
33
|
import { Config } from './config';
|
|
34
|
-
import * as
|
|
34
|
+
import * as constants from './core/constants';
|
|
35
35
|
|
|
36
36
|
import {
|
|
37
37
|
Create,
|
|
38
38
|
Dom,
|
|
39
|
-
|
|
39
|
+
History,
|
|
40
40
|
Plugin,
|
|
41
41
|
Select,
|
|
42
42
|
StatusBar,
|
|
@@ -59,7 +59,8 @@ import {
|
|
|
59
59
|
markAsAtomic,
|
|
60
60
|
ConfigProto,
|
|
61
61
|
kebabCase,
|
|
62
|
-
isJoditObject
|
|
62
|
+
isJoditObject,
|
|
63
|
+
isNumber
|
|
63
64
|
} from './core/helpers/';
|
|
64
65
|
|
|
65
66
|
import { Storage } from './core/storage/';
|
|
@@ -67,7 +68,7 @@ import { Storage } from './core/storage/';
|
|
|
67
68
|
import { ViewWithToolbar } from './core/view/view-with-toolbar';
|
|
68
69
|
|
|
69
70
|
import { instances, pluginSystem, modules, lang } from './core/global';
|
|
70
|
-
import { autobind, cache } from './core/decorators';
|
|
71
|
+
import { autobind, cache, throttle, watch } from './core/decorators';
|
|
71
72
|
|
|
72
73
|
const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
|
|
73
74
|
const __defaultClassesKey = 'data-jodit-default-classes';
|
|
@@ -77,7 +78,7 @@ const __defaultClassesKey = 'data-jodit-default-classes';
|
|
|
77
78
|
*/
|
|
78
79
|
export class Jodit extends ViewWithToolbar implements IJodit {
|
|
79
80
|
/** @override */
|
|
80
|
-
className(): string {
|
|
81
|
+
override className(): string {
|
|
81
82
|
return 'Jodit';
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -123,12 +124,12 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
126
|
* Return default timeout period in milliseconds for some debounce or throttle functions.
|
|
126
|
-
* By default
|
|
127
|
+
* By default, `{history.timeout}` options
|
|
127
128
|
*/
|
|
128
129
|
override get defaultTimeout(): number {
|
|
129
|
-
return this.
|
|
130
|
-
? this.o.
|
|
131
|
-
: Config.defaultOptions.
|
|
130
|
+
return isNumber(this.o.defaultTimeout)
|
|
131
|
+
? this.o.defaultTimeout
|
|
132
|
+
: Config.defaultOptions.defaultTimeout;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
/**
|
|
@@ -173,6 +174,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
173
174
|
static readonly ns: IDictionary<Function> = modules;
|
|
174
175
|
|
|
175
176
|
static readonly decorators: IDictionary<Function> = {};
|
|
177
|
+
static readonly constants: typeof constants = constants;
|
|
176
178
|
static readonly instances: IDictionary<IJodit> = instances;
|
|
177
179
|
|
|
178
180
|
static readonly lang: any = lang;
|
|
@@ -266,8 +268,15 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
266
268
|
this.setPlaceField('iframe', iframe);
|
|
267
269
|
}
|
|
268
270
|
|
|
269
|
-
get
|
|
270
|
-
return this.currentPlace.
|
|
271
|
+
get history(): IHistory {
|
|
272
|
+
return this.currentPlace.history;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @deprecated Instead use `Jodit.history`
|
|
277
|
+
*/
|
|
278
|
+
get observer(): IHistory {
|
|
279
|
+
return this.history;
|
|
271
280
|
}
|
|
272
281
|
|
|
273
282
|
/**
|
|
@@ -369,7 +378,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
369
378
|
return jodit.getInstance<IFileBrowser>('FileBrowser', options);
|
|
370
379
|
}
|
|
371
380
|
|
|
372
|
-
private __mode: Modes =
|
|
381
|
+
private __mode: Modes = constants.MODE_WYSIWYG;
|
|
373
382
|
|
|
374
383
|
/**
|
|
375
384
|
* Editor's mode
|
|
@@ -425,6 +434,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
425
434
|
|
|
426
435
|
set value(html: string) {
|
|
427
436
|
this.setEditorValue(html);
|
|
437
|
+
this.history.processChanges();
|
|
428
438
|
}
|
|
429
439
|
|
|
430
440
|
/**
|
|
@@ -439,7 +449,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
439
449
|
* If returned not undefined getEditorValue will return this value
|
|
440
450
|
* @example
|
|
441
451
|
* ```javascript
|
|
442
|
-
* var editor =
|
|
452
|
+
* var editor = Jodit.make("#redactor");
|
|
443
453
|
* editor.e.on('beforeGetValueFromEditor', function () {
|
|
444
454
|
* return editor.editor.innerHTML.replace(/a/g, 'b');
|
|
445
455
|
* });
|
|
@@ -454,7 +464,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
454
464
|
}
|
|
455
465
|
|
|
456
466
|
value = this.getNativeEditorValue().replace(
|
|
457
|
-
|
|
467
|
+
constants.INVISIBLE_SPACE_REG_EXP(),
|
|
458
468
|
''
|
|
459
469
|
);
|
|
460
470
|
|
|
@@ -475,7 +485,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
475
485
|
*
|
|
476
486
|
* @example
|
|
477
487
|
* ```javascript
|
|
478
|
-
* var editor =
|
|
488
|
+
* var editor = Jodit.make("#redactor");
|
|
479
489
|
* editor.e.on('afterGetValueFromEditor', function (new_value) {
|
|
480
490
|
* new_value.value = new_value.value.replace('a', 'b');
|
|
481
491
|
* });
|
|
@@ -490,6 +500,11 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
490
500
|
|
|
491
501
|
private __callChangeCount = 0;
|
|
492
502
|
|
|
503
|
+
@throttle()
|
|
504
|
+
synchronizeValues(): void {
|
|
505
|
+
this.setEditorValue();
|
|
506
|
+
}
|
|
507
|
+
|
|
493
508
|
/**
|
|
494
509
|
* Set editor html value and if set sync fill source element value
|
|
495
510
|
* When method was called without arguments - it is simple way to synchronize editor to element
|
|
@@ -499,7 +514,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
499
514
|
* Triggered before getEditorValue set value to wysiwyg.
|
|
500
515
|
* @example
|
|
501
516
|
* ```javascript
|
|
502
|
-
* var editor =
|
|
517
|
+
* var editor = Jodit.make("#redactor");
|
|
503
518
|
* editor.e.on('beforeSetValueToEditor', function (old_value) {
|
|
504
519
|
* return old_value.value.replace('a', 'b');
|
|
505
520
|
* });
|
|
@@ -545,21 +560,29 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
545
560
|
if (
|
|
546
561
|
!this.isSilentChange &&
|
|
547
562
|
old_value !== new_value &&
|
|
548
|
-
this.__callChangeCount <
|
|
563
|
+
this.__callChangeCount < constants.SAFE_COUNT_CHANGE_CALL
|
|
549
564
|
) {
|
|
550
565
|
this.setElementValue(new_value);
|
|
551
566
|
this.__callChangeCount += 1;
|
|
552
567
|
|
|
553
568
|
try {
|
|
554
|
-
this.
|
|
569
|
+
this.history.upTick();
|
|
555
570
|
this.e.fire('change', new_value, old_value);
|
|
556
|
-
this.e.fire(this.
|
|
571
|
+
this.e.fire(this.history, 'change', new_value, old_value);
|
|
557
572
|
} finally {
|
|
558
573
|
this.__callChangeCount = 0;
|
|
559
574
|
}
|
|
560
575
|
}
|
|
561
576
|
}
|
|
562
577
|
|
|
578
|
+
/**
|
|
579
|
+
* If some plugin changes the DOM directly, then you need to update the content of the original element
|
|
580
|
+
*/
|
|
581
|
+
@watch(':internalChange')
|
|
582
|
+
protected updateElementValue(): void {
|
|
583
|
+
this.setElementValue(this.getEditorValue());
|
|
584
|
+
}
|
|
585
|
+
|
|
563
586
|
/**
|
|
564
587
|
* Return source element value
|
|
565
588
|
*/
|
|
@@ -600,7 +623,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
600
623
|
*
|
|
601
624
|
* @example
|
|
602
625
|
* ```javascript
|
|
603
|
-
* var jodit =
|
|
626
|
+
* var jodit = Jodit.make('#editor);
|
|
604
627
|
*
|
|
605
628
|
* jodit.setEditorValue('test test test');
|
|
606
629
|
*
|
|
@@ -865,7 +888,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
865
888
|
}
|
|
866
889
|
|
|
867
890
|
isEditorMode(): boolean {
|
|
868
|
-
return this.getRealMode() ===
|
|
891
|
+
return this.getRealMode() === constants.MODE_WYSIWYG;
|
|
869
892
|
}
|
|
870
893
|
|
|
871
894
|
/**
|
|
@@ -875,12 +898,12 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
875
898
|
*
|
|
876
899
|
* @example
|
|
877
900
|
* ```javascript
|
|
878
|
-
* var editor =
|
|
901
|
+
* var editor = Jodit.make('#editor');
|
|
879
902
|
* console.log(editor.getRealMode());
|
|
880
903
|
* ```
|
|
881
904
|
*/
|
|
882
905
|
getRealMode(): Modes {
|
|
883
|
-
if (this.getMode() !==
|
|
906
|
+
if (this.getMode() !== constants.MODE_SPLIT) {
|
|
884
907
|
return this.getMode();
|
|
885
908
|
}
|
|
886
909
|
|
|
@@ -892,10 +915,10 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
892
915
|
Dom.isOrContains(this.editor, active) ||
|
|
893
916
|
Dom.isOrContains(this.toolbar.container, active))
|
|
894
917
|
) {
|
|
895
|
-
return
|
|
918
|
+
return constants.MODE_WYSIWYG;
|
|
896
919
|
}
|
|
897
920
|
|
|
898
|
-
return
|
|
921
|
+
return constants.MODE_SOURCE;
|
|
899
922
|
}
|
|
900
923
|
|
|
901
924
|
/**
|
|
@@ -918,7 +941,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
918
941
|
* @param data - PlainObject `{mode: {string}}` In handler you can change data.mode
|
|
919
942
|
* @example
|
|
920
943
|
* ```javascript
|
|
921
|
-
* var editor =
|
|
944
|
+
* var editor = Jodit.make("#redactor");
|
|
922
945
|
* editor.e.on('beforeSetMode', function (data) {
|
|
923
946
|
* data.mode = Jodit.MODE_SOURCE; // not respond to the mode change. Always make the source code mode
|
|
924
947
|
* });
|
|
@@ -929,12 +952,12 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
929
952
|
}
|
|
930
953
|
|
|
931
954
|
this.__mode = [
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
955
|
+
constants.MODE_SOURCE,
|
|
956
|
+
constants.MODE_WYSIWYG,
|
|
957
|
+
constants.MODE_SPLIT
|
|
935
958
|
].includes(data.mode)
|
|
936
959
|
? data.mode
|
|
937
|
-
:
|
|
960
|
+
: constants.MODE_WYSIWYG;
|
|
938
961
|
|
|
939
962
|
if (this.o.saveModeInStorage) {
|
|
940
963
|
this.storage.set('jodit_default_mode', this.mode);
|
|
@@ -950,7 +973,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
950
973
|
* Triggered after setMode executed
|
|
951
974
|
* @example
|
|
952
975
|
* ```javascript
|
|
953
|
-
* var editor =
|
|
976
|
+
* var editor = Jodit.make("#redactor");
|
|
954
977
|
* editor.e.on('afterSetMode', function () {
|
|
955
978
|
* editor.setEditorValue(''); // clear editor's value after change mode
|
|
956
979
|
* });
|
|
@@ -966,7 +989,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
966
989
|
*
|
|
967
990
|
* @example
|
|
968
991
|
* ```javascript
|
|
969
|
-
* var editor =
|
|
992
|
+
* var editor = Jodit.make('#editor');
|
|
970
993
|
* editor.toggleMode();
|
|
971
994
|
* ```
|
|
972
995
|
*/
|
|
@@ -975,14 +998,14 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
975
998
|
|
|
976
999
|
if (
|
|
977
1000
|
[
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
this.o.useSplitMode ?
|
|
1001
|
+
constants.MODE_SOURCE,
|
|
1002
|
+
constants.MODE_WYSIWYG,
|
|
1003
|
+
this.o.useSplitMode ? constants.MODE_SPLIT : 9
|
|
981
1004
|
].includes(mode + 1)
|
|
982
1005
|
) {
|
|
983
1006
|
mode += 1;
|
|
984
1007
|
} else {
|
|
985
|
-
mode =
|
|
1008
|
+
mode = constants.MODE_WYSIWYG;
|
|
986
1009
|
}
|
|
987
1010
|
|
|
988
1011
|
this.setMode(mode);
|
|
@@ -1078,6 +1101,8 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1078
1101
|
*
|
|
1079
1102
|
* @param element - Selector or HTMLElement
|
|
1080
1103
|
* @param options - Editor's options
|
|
1104
|
+
*
|
|
1105
|
+
* @deprecated - Instead use `Jodit.make`
|
|
1081
1106
|
*/
|
|
1082
1107
|
constructor(element: HTMLElement | string, options?: object) {
|
|
1083
1108
|
super(options as IViewOptions, true);
|
|
@@ -1138,7 +1163,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1138
1163
|
|
|
1139
1164
|
instances[this.id] = this;
|
|
1140
1165
|
|
|
1141
|
-
const init = () => {
|
|
1166
|
+
const init = (): void => {
|
|
1142
1167
|
if (this.e) {
|
|
1143
1168
|
this.e.fire('afterInit', this);
|
|
1144
1169
|
}
|
|
@@ -1276,7 +1301,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1276
1301
|
Config.defaultOptions
|
|
1277
1302
|
) as IWorkPlace['options'])
|
|
1278
1303
|
: this.options,
|
|
1279
|
-
|
|
1304
|
+
history: new History(this),
|
|
1280
1305
|
editorWindow: this.ow
|
|
1281
1306
|
};
|
|
1282
1307
|
|
|
@@ -1291,7 +1316,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1291
1316
|
|
|
1292
1317
|
const opt = this.options;
|
|
1293
1318
|
|
|
1294
|
-
const init = () => {
|
|
1319
|
+
const init = (): void => {
|
|
1295
1320
|
if (
|
|
1296
1321
|
opt.enableDragAndDropFileToEditor &&
|
|
1297
1322
|
opt.uploader &&
|
|
@@ -1325,7 +1350,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1325
1350
|
}
|
|
1326
1351
|
|
|
1327
1352
|
if (!this.isEditorMode()) {
|
|
1328
|
-
this.setMode(
|
|
1353
|
+
this.setMode(constants.MODE_WYSIWYG);
|
|
1329
1354
|
}
|
|
1330
1355
|
|
|
1331
1356
|
this.currentPlace = place;
|
|
@@ -1458,15 +1483,9 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1458
1483
|
* Attach some native event listeners
|
|
1459
1484
|
*/
|
|
1460
1485
|
@autobind
|
|
1461
|
-
private prepareWYSIWYGEditor() {
|
|
1486
|
+
private prepareWYSIWYGEditor(): void {
|
|
1462
1487
|
const { editor } = this;
|
|
1463
1488
|
|
|
1464
|
-
if (this.o.spellcheck) {
|
|
1465
|
-
this.editor.setAttribute('spellcheck', 'true');
|
|
1466
|
-
} else {
|
|
1467
|
-
this.editor.setAttribute('spellcheck', 'false');
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
1489
|
// direction
|
|
1471
1490
|
if (this.o.direction) {
|
|
1472
1491
|
const direction =
|
|
@@ -1485,9 +1504,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1485
1504
|
this.setCurrentPlace(place);
|
|
1486
1505
|
}
|
|
1487
1506
|
})
|
|
1488
|
-
.on(editor, 'compositionend',
|
|
1489
|
-
this.setEditorValue();
|
|
1490
|
-
})
|
|
1507
|
+
.on(editor, 'compositionend', this.synchronizeValues)
|
|
1491
1508
|
.on(
|
|
1492
1509
|
editor,
|
|
1493
1510
|
'selectionchange selectionstart keydown keyup input keypress dblclick mousedown mouseup ' +
|
|
@@ -1510,7 +1527,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1510
1527
|
return false;
|
|
1511
1528
|
}
|
|
1512
1529
|
|
|
1513
|
-
this.
|
|
1530
|
+
this.synchronizeValues();
|
|
1514
1531
|
}
|
|
1515
1532
|
}
|
|
1516
1533
|
);
|
|
@@ -1553,7 +1570,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1553
1570
|
element,
|
|
1554
1571
|
iframe,
|
|
1555
1572
|
editor,
|
|
1556
|
-
|
|
1573
|
+
history
|
|
1557
1574
|
}) => {
|
|
1558
1575
|
if (element !== container) {
|
|
1559
1576
|
if (element.hasAttribute(__defaultStyleDisplayKey)) {
|
|
@@ -1578,7 +1595,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1578
1595
|
element.removeAttribute('style');
|
|
1579
1596
|
}
|
|
1580
1597
|
|
|
1581
|
-
|
|
1598
|
+
statusbar.destruct();
|
|
1582
1599
|
|
|
1583
1600
|
this.e.off(container);
|
|
1584
1601
|
this.e.off(element);
|
|
@@ -1604,7 +1621,7 @@ export class Jodit extends ViewWithToolbar implements IJodit {
|
|
|
1604
1621
|
element.innerHTML = buffer;
|
|
1605
1622
|
}
|
|
1606
1623
|
|
|
1607
|
-
|
|
1624
|
+
history.destruct();
|
|
1608
1625
|
}
|
|
1609
1626
|
);
|
|
1610
1627
|
|
package/src/langs/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Jodit.make('#editor', {
|
|
|
75
75
|
To use internationalization in your own plugin, use the method [[Jodit.i18n]]
|
|
76
76
|
|
|
77
77
|
```js
|
|
78
|
-
const editor =
|
|
78
|
+
const editor = Jodit.make('#redactor', {
|
|
79
79
|
language: 'ru'
|
|
80
80
|
});
|
|
81
81
|
console.log(editor.i18n('Type something')); //'Введите что-либо тут...'
|
package/src/langs/ar.js
CHANGED
package/src/langs/cs_cz.js
CHANGED
package/src/langs/de.js
CHANGED
package/src/langs/es.js
CHANGED
|
@@ -228,5 +228,6 @@ module.exports = {
|
|
|
228
228
|
'Find Previous': 'Buscar Anterior',
|
|
229
229
|
'Find Next': 'Buscar Siguiente',
|
|
230
230
|
'Insert className': 'Insertar nombre de clase',
|
|
231
|
-
'Line height': 'Altura de la línea'
|
|
231
|
+
'Line height': 'Altura de la línea',
|
|
232
|
+
Spellchecking: 'Corrección ortográfica'
|
|
232
233
|
};
|
package/src/langs/fa.js
CHANGED
package/src/langs/fr.js
CHANGED
|
@@ -219,5 +219,6 @@ module.exports = {
|
|
|
219
219
|
'Find Previous': 'Trouvez Précédente',
|
|
220
220
|
'Find Next': 'Suivant',
|
|
221
221
|
'Insert className': 'Insérer un nom de classe',
|
|
222
|
-
'Line height': 'Hauteur de ligne'
|
|
222
|
+
'Line height': 'Hauteur de ligne',
|
|
223
|
+
Spellchecking: 'Vérification Orthographique'
|
|
223
224
|
};
|
package/src/langs/he.js
CHANGED
package/src/langs/hu.js
CHANGED
|
@@ -225,5 +225,6 @@ module.exports = {
|
|
|
225
225
|
'Find Previous': 'Megtalálja Előző',
|
|
226
226
|
'Find Next': 'Következő Keresése',
|
|
227
227
|
'Insert className': 'Helyezze be az osztály nevét',
|
|
228
|
-
'Line height': 'Vonal magassága'
|
|
228
|
+
'Line height': 'Vonal magassága',
|
|
229
|
+
Spellchecking: 'Helyesírás-ellenőrzés'
|
|
229
230
|
};
|
package/src/langs/id.js
CHANGED
|
@@ -224,5 +224,6 @@ module.exports = {
|
|
|
224
224
|
'Find Previous': 'Menemukan Sebelumnya',
|
|
225
225
|
'Find Next': 'Menemukan Berikutnya',
|
|
226
226
|
'Insert className': 'Masukkan nama kelas',
|
|
227
|
-
'Line height': 'Tinggi baris'
|
|
227
|
+
'Line height': 'Tinggi baris',
|
|
228
|
+
Spellchecking: 'Spellchecking'
|
|
228
229
|
};
|
package/src/langs/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ if (!process.env.EXCLUDE_LANGS) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/* Unpack array to hash */
|
|
66
|
-
const get = (value: IDictionary) => value.default || value,
|
|
66
|
+
const get = (value: IDictionary): IDictionary => value.default || value,
|
|
67
67
|
hashLang: IDictionary = {};
|
|
68
68
|
|
|
69
69
|
if (isArray(get(en))) {
|
package/src/langs/it.js
CHANGED
|
@@ -224,5 +224,6 @@ module.exports = {
|
|
|
224
224
|
'Find Previous': 'Trova Precedente',
|
|
225
225
|
'Find Next': 'Trova Successivo',
|
|
226
226
|
'Insert className': 'Inserisci il nome della classe',
|
|
227
|
-
'Line height': 'Altezza linea'
|
|
227
|
+
'Line height': 'Altezza linea',
|
|
228
|
+
Spellchecking: 'Controllo ortografico'
|
|
228
229
|
};
|
package/src/langs/ja.js
CHANGED
package/src/langs/ko.js
CHANGED
package/src/langs/nl.js
CHANGED
package/src/langs/pl.js
CHANGED
|
@@ -225,5 +225,6 @@ module.exports = {
|
|
|
225
225
|
'Find Previous': 'Znaleźć Poprzednie',
|
|
226
226
|
'Find Next': 'Znajdź Dalej',
|
|
227
227
|
'Insert className': 'Wstaw nazwę zajęć',
|
|
228
|
-
'Line height': 'Wysokość linii'
|
|
228
|
+
'Line height': 'Wysokość linii',
|
|
229
|
+
Spellchecking: 'Sprawdzanie pisowni'
|
|
229
230
|
};
|
package/src/langs/pt_br.js
CHANGED
|
@@ -228,5 +228,6 @@ module.exports = {
|
|
|
228
228
|
'Find Previous': 'Encontrar Anteriores',
|
|
229
229
|
'Find Next': 'Localizar Próxima',
|
|
230
230
|
'Insert className': 'Insira o nome da classe',
|
|
231
|
-
'Line height': 'Altura da linha'
|
|
231
|
+
'Line height': 'Altura da linha',
|
|
232
|
+
Spellchecking: 'Verificação ortográfica'
|
|
232
233
|
};
|
package/src/langs/ru.js
CHANGED
|
@@ -223,5 +223,6 @@ module.exports = {
|
|
|
223
223
|
'Find Previous': 'Найти Предыдущие',
|
|
224
224
|
'Find Next': 'Найти Далее',
|
|
225
225
|
'Insert className': 'Вставить название класса',
|
|
226
|
-
'Line height': 'Высота линии'
|
|
226
|
+
'Line height': 'Высота линии',
|
|
227
|
+
Spellchecking: 'Проверка орфографии'
|
|
227
228
|
};
|
package/src/langs/tr.js
CHANGED
package/src/langs/zh_cn.js
CHANGED
package/src/langs/zh_tw.js
CHANGED
|
@@ -111,15 +111,15 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
111
111
|
private startY: number = 0;
|
|
112
112
|
private startPoint = { x: 0, y: 0, w: 0, h: 0 };
|
|
113
113
|
|
|
114
|
-
private lockSelect = () => {
|
|
114
|
+
private lockSelect = (): void => {
|
|
115
115
|
this.setMod('moved', true);
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
private unlockSelect = () => {
|
|
118
|
+
private unlockSelect = (): void => {
|
|
119
119
|
this.setMod('moved', false);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
private setElements(root: HTMLElement, elements: Content) {
|
|
122
|
+
private setElements(root: HTMLElement, elements: Content): void {
|
|
123
123
|
const elements_list: HTMLElement[] = [];
|
|
124
124
|
|
|
125
125
|
asArray<ContentItem | ContentItem[] | IContainer>(elements).forEach(
|
|
@@ -215,7 +215,7 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
@autobind
|
|
218
|
-
private onMouseMove(e: MouseEvent) {
|
|
218
|
+
private onMouseMove(e: MouseEvent): void {
|
|
219
219
|
if (this.draggable && this.o.draggable) {
|
|
220
220
|
this.setPosition(
|
|
221
221
|
this.startPoint.x + e.clientX - this.startX,
|
|
@@ -276,7 +276,7 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
private onResize = () => {
|
|
279
|
+
private onResize = (): void => {
|
|
280
280
|
if (
|
|
281
281
|
this.options &&
|
|
282
282
|
this.o.resizable &&
|
|
@@ -290,7 +290,7 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
@autobind
|
|
293
|
-
private onResizerMouseDown(e: MouseEvent) {
|
|
293
|
+
private onResizerMouseDown(e: MouseEvent): void {
|
|
294
294
|
this.resizable = true;
|
|
295
295
|
this.startX = e.clientX;
|
|
296
296
|
this.startY = e.clientY;
|
|
@@ -141,7 +141,7 @@ Jodit.make('#editor', {
|
|
|
141
141
|
Example:
|
|
142
142
|
|
|
143
143
|
```javascript
|
|
144
|
-
var editor =
|
|
144
|
+
var editor = Jodit.make('#editor', {
|
|
145
145
|
filebrowser: {
|
|
146
146
|
buttons: [
|
|
147
147
|
'filebrowser.upload',
|
|
@@ -330,7 +330,7 @@ Jodit.make('#editor2', {
|
|
|
330
330
|
Example:
|
|
331
331
|
|
|
332
332
|
```javascript
|
|
333
|
-
var editor =
|
|
333
|
+
var editor = Jodit.make('#jodit', {
|
|
334
334
|
uploader: {
|
|
335
335
|
url: 'connector/upload.php',
|
|
336
336
|
baseurl: 'images/'
|