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/build/vdom.css
CHANGED
package/build/vdom.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)
|
|
4
|
-
* Version: v3.
|
|
4
|
+
* Version: v3.16.2
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -411,12 +411,16 @@ var helpers_1 = __webpack_require__(4);
|
|
|
411
411
|
var async_1 = __webpack_require__(5);
|
|
412
412
|
var autobind_decorator_1 = __webpack_require__(15);
|
|
413
413
|
var isProperty = function (key) { return key !== 'children'; };
|
|
414
|
-
var isNew = function (prev, next) {
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
414
|
+
var isNew = function (prev, next) {
|
|
415
|
+
return function (key) {
|
|
416
|
+
return prev[key] !== next[key];
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
var isGone = function (prev, next) {
|
|
420
|
+
return function (key) {
|
|
421
|
+
return !(key in next);
|
|
422
|
+
};
|
|
423
|
+
};
|
|
420
424
|
var updateDom = function (dom, prevProps, nextProps) {
|
|
421
425
|
Object.keys(prevProps)
|
|
422
426
|
.filter(isProperty)
|
|
@@ -681,14 +685,16 @@ var Async = (function () {
|
|
|
681
685
|
this.timers = new Map();
|
|
682
686
|
this.promisesRejections = new Set();
|
|
683
687
|
this.requestsIdle = new Set();
|
|
684
|
-
this.
|
|
688
|
+
this.requestsRaf = new Set();
|
|
689
|
+
this.requestIdleCallbackNative = (_b = (_a = window['requestIdleCallback']) === null || _a === void 0 ? void 0 : _a.bind(window)) !== null && _b !== void 0 ? _b : (function (callback, options) {
|
|
690
|
+
var _a;
|
|
685
691
|
var start = Date.now();
|
|
686
692
|
return _this.setTimeout(function () {
|
|
687
693
|
callback({
|
|
688
694
|
didTimeout: false,
|
|
689
695
|
timeRemaining: function () { return Math.max(0, 50 - (Date.now() - start)); }
|
|
690
696
|
});
|
|
691
|
-
}, 1);
|
|
697
|
+
}, (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : 1);
|
|
692
698
|
});
|
|
693
699
|
this.cancelIdleCallbackNative = (_d = (_c = window['cancelIdleCallback']) === null || _c === void 0 ? void 0 : _c.bind(window)) !== null && _d !== void 0 ? _d : (function (request) {
|
|
694
700
|
_this.clearTimeout(request);
|
|
@@ -860,33 +866,39 @@ var Async = (function () {
|
|
|
860
866
|
var t = {};
|
|
861
867
|
return Promise.race([p, t]).then(function (v) { return (v === t ? 'pending' : 'fulfilled'); }, function () { return 'rejected'; });
|
|
862
868
|
};
|
|
863
|
-
Async.prototype.requestIdleCallback = function (callback) {
|
|
864
|
-
var request = this.requestIdleCallbackNative(callback);
|
|
869
|
+
Async.prototype.requestIdleCallback = function (callback, options) {
|
|
870
|
+
var request = this.requestIdleCallbackNative(callback, options);
|
|
865
871
|
this.requestsIdle.add(request);
|
|
866
872
|
return request;
|
|
867
873
|
};
|
|
868
|
-
Async.prototype.requestIdlePromise = function () {
|
|
874
|
+
Async.prototype.requestIdlePromise = function (options) {
|
|
869
875
|
var _this = this;
|
|
870
876
|
return this.promise(function (res) {
|
|
871
|
-
var request = _this.requestIdleCallback(function () { return res(request); });
|
|
877
|
+
var request = _this.requestIdleCallback(function () { return res(request); }, options);
|
|
872
878
|
});
|
|
873
879
|
};
|
|
874
880
|
Async.prototype.cancelIdleCallback = function (request) {
|
|
875
881
|
this.requestsIdle.delete(request);
|
|
876
882
|
return this.cancelIdleCallbackNative(request);
|
|
877
883
|
};
|
|
884
|
+
Async.prototype.requestAnimationFrame = function (callback) {
|
|
885
|
+
var request = requestAnimationFrame(callback);
|
|
886
|
+
this.requestsRaf.add(request);
|
|
887
|
+
return request;
|
|
888
|
+
};
|
|
889
|
+
Async.prototype.cancelAnimationFrame = function (request) {
|
|
890
|
+
this.requestsRaf.delete(request);
|
|
891
|
+
cancelAnimationFrame(request);
|
|
892
|
+
};
|
|
878
893
|
Async.prototype.clear = function () {
|
|
879
894
|
var _this = this;
|
|
880
|
-
this.requestsIdle.forEach(function (key) {
|
|
881
|
-
|
|
882
|
-
});
|
|
895
|
+
this.requestsIdle.forEach(function (key) { return _this.cancelIdleCallback(key); });
|
|
896
|
+
this.requestsRaf.forEach(function (key) { return _this.cancelAnimationFrame(key); });
|
|
883
897
|
this.timers.forEach(function (key) {
|
|
884
|
-
(0, async_1.clearTimeout)(_this.timers.get(key));
|
|
898
|
+
return (0, async_1.clearTimeout)(_this.timers.get(key));
|
|
885
899
|
});
|
|
886
900
|
this.timers.clear();
|
|
887
|
-
this.promisesRejections.forEach(function (reject) {
|
|
888
|
-
reject();
|
|
889
|
-
});
|
|
901
|
+
this.promisesRejections.forEach(function (reject) { return reject(); });
|
|
890
902
|
this.promisesRejections.clear();
|
|
891
903
|
};
|
|
892
904
|
Async.prototype.destruct = function () {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jodit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.2",
|
|
4
4
|
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
|
|
5
5
|
"main": "build/jodit.min.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"coverage": "npx type-coverage ./src --detail --ignore-files 'build/**' --ignore-files 'test/**' --ignore-files 'examples/**'",
|
|
9
9
|
"newversion": "npm run lint && npm run clean && npm test && npm version patch --no-git-tag-version && npm run build && npm run newversiongit && npm publish ./ && rm -rf types/",
|
|
10
|
-
"newversiongit": "git add --all && git commit -m \"New version $npm_package_version. Read more https://github.com/xdan/jodit/blob/master/CHANGELOG.
|
|
10
|
+
"newversiongit": "git add --all && git commit -m \"New version $npm_package_version. Read more https://github.com/xdan/jodit/blob/master/CHANGELOG.md \" && git tag $npm_package_version && git push --tags origin HEAD:master",
|
|
11
11
|
"start": "node server.js --port=2000",
|
|
12
12
|
"clean": "rm -rf build/*",
|
|
13
13
|
"translate": "node ./build-system/utils/lang-translater.js",
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/ace": "^0.0.48",
|
|
64
64
|
"@types/node": "^17.0.21",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
66
|
-
"@typescript-eslint/parser": "^5.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.14.0",
|
|
67
67
|
"autoprefixer": "^10.4.2",
|
|
68
|
-
"axios": "^0.26.
|
|
68
|
+
"axios": "^0.26.1",
|
|
69
69
|
"chai": "^4.3.6",
|
|
70
70
|
"classlist-polyfill": "^1.2.0",
|
|
71
71
|
"compression": "^1.7.4",
|
|
72
72
|
"cross-env": "^7.0.3",
|
|
73
|
-
"css-loader": "^6.
|
|
73
|
+
"css-loader": "^6.7.1",
|
|
74
74
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
75
|
-
"cssnano-preset-advanced": "^5.2.
|
|
75
|
+
"cssnano-preset-advanced": "^5.2.4",
|
|
76
76
|
"es6-promise": "^4.2.8",
|
|
77
|
-
"eslint": "^8.
|
|
77
|
+
"eslint": "^8.11.0",
|
|
78
78
|
"eslint-config-prettier": "^8.5.0",
|
|
79
79
|
"eslint-plugin-header": "^3.1.1",
|
|
80
80
|
"eslint-plugin-prettier": "^4.0.0",
|
|
@@ -84,19 +84,19 @@
|
|
|
84
84
|
"husky": "^7.0.4",
|
|
85
85
|
"karma": "^6.3.17",
|
|
86
86
|
"karma-chai": "^0.1.0",
|
|
87
|
-
"karma-chrome-launcher": "^3.1.
|
|
87
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
88
88
|
"karma-firefox-launcher": "^2.1.2",
|
|
89
89
|
"karma-mocha": "^2.0.1",
|
|
90
90
|
"karma-sourcemap-loader": "^0.3.8",
|
|
91
91
|
"karma-webpack": "^5.0.0",
|
|
92
92
|
"less": "^4.1.2",
|
|
93
93
|
"less-loader": "^10.2.0",
|
|
94
|
-
"lint-staged": "^12.3.
|
|
94
|
+
"lint-staged": "^12.3.5",
|
|
95
95
|
"merge-stream": "^2.0.0",
|
|
96
96
|
"mini-css-extract-plugin": "^2.6.0",
|
|
97
|
-
"mocha": "^9.2.
|
|
97
|
+
"mocha": "^9.2.2",
|
|
98
98
|
"open": "^8.4.0",
|
|
99
|
-
"postcss": ">=8.4.
|
|
99
|
+
"postcss": ">=8.4.8",
|
|
100
100
|
"postcss-css-variables": "^0.18.0",
|
|
101
101
|
"postcss-less": "^6.0.0",
|
|
102
102
|
"postcss-loader": "^6.2.1",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"stylelint-prettier": "^2.0.0",
|
|
111
111
|
"synchronous-promise": "^2.0.15",
|
|
112
112
|
"terser-webpack-plugin": "^5.3.1",
|
|
113
|
-
"ts-loader": "^9.2.
|
|
113
|
+
"ts-loader": "^9.2.8",
|
|
114
114
|
"ts-private-uglifier": "^1.0.2",
|
|
115
115
|
"tslib": "^2.3.1",
|
|
116
116
|
"typescript": "^4.6.2",
|
package/src/README.md
CHANGED
package/src/config.ts
CHANGED
|
@@ -26,6 +26,11 @@ import * as consts from './core/constants';
|
|
|
26
26
|
* Default Editor's Configuration
|
|
27
27
|
*/
|
|
28
28
|
export class Config implements IViewOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Timeout of all asynchronous methods
|
|
31
|
+
*/
|
|
32
|
+
defaultTimeout: number = 100;
|
|
33
|
+
|
|
29
34
|
namespace: string = '';
|
|
30
35
|
|
|
31
36
|
/**
|
|
@@ -157,12 +162,6 @@ export class Config implements IViewOptions {
|
|
|
157
162
|
*/
|
|
158
163
|
saveModeInStorage: boolean = false;
|
|
159
164
|
|
|
160
|
-
/**
|
|
161
|
-
* Options specifies whether the editor is to have its spelling and grammar checked or not
|
|
162
|
-
* @see {@link http://www.w3schools.com/tags/att_global_spellcheck.asp}
|
|
163
|
-
*/
|
|
164
|
-
spellcheck: boolean = true;
|
|
165
|
-
|
|
166
165
|
/**
|
|
167
166
|
* Class name that can be appended to the editor
|
|
168
167
|
*
|
|
@@ -171,7 +170,7 @@ export class Config implements IViewOptions {
|
|
|
171
170
|
*
|
|
172
171
|
* @example
|
|
173
172
|
* ```javascript
|
|
174
|
-
*
|
|
173
|
+
* Jodit.make('#editor', {
|
|
175
174
|
* editorCssClass: 'some_my_class'
|
|
176
175
|
* });
|
|
177
176
|
* ```
|
|
@@ -190,7 +189,7 @@ export class Config implements IViewOptions {
|
|
|
190
189
|
*
|
|
191
190
|
* @example
|
|
192
191
|
* ```javascript
|
|
193
|
-
*
|
|
192
|
+
* Jodit.make('#editor', {
|
|
194
193
|
* style: {
|
|
195
194
|
* font: '12px Arial'
|
|
196
195
|
* }
|
|
@@ -204,7 +203,7 @@ export class Config implements IViewOptions {
|
|
|
204
203
|
*
|
|
205
204
|
* @example
|
|
206
205
|
* ```javascript
|
|
207
|
-
* var editor =
|
|
206
|
+
* var editor = Jodit.make('#editor');
|
|
208
207
|
* document.getElementById('editor').addEventListener('change', function () {
|
|
209
208
|
* console.log(this.value);
|
|
210
209
|
* })
|
|
@@ -219,7 +218,7 @@ export class Config implements IViewOptions {
|
|
|
219
218
|
* 'rtl' – Indicates a Right-To-Left text direction (like in Arabic).
|
|
220
219
|
* @example
|
|
221
220
|
* ```javascript
|
|
222
|
-
*
|
|
221
|
+
* Jodit.make('.editor', {
|
|
223
222
|
* direction: 'rtl'
|
|
224
223
|
* })
|
|
225
224
|
* ```
|
|
@@ -236,7 +235,7 @@ export class Config implements IViewOptions {
|
|
|
236
235
|
* <!-- include in you page lang file -->
|
|
237
236
|
* <script src="jodit/lang/de.js"></script>
|
|
238
237
|
* <script>
|
|
239
|
-
* var editor =
|
|
238
|
+
* var editor = Jodit.make('.editor', {
|
|
240
239
|
* language: 'de'
|
|
241
240
|
* });
|
|
242
241
|
* </script>
|
|
@@ -250,7 +249,7 @@ export class Config implements IViewOptions {
|
|
|
250
249
|
* @example
|
|
251
250
|
* ```html
|
|
252
251
|
* <script>
|
|
253
|
-
* var editor =
|
|
252
|
+
* var editor = Jodit.make('.editor', {
|
|
254
253
|
* debugLanguage: true
|
|
255
254
|
* });
|
|
256
255
|
*
|
|
@@ -265,7 +264,7 @@ export class Config implements IViewOptions {
|
|
|
265
264
|
*
|
|
266
265
|
* @example
|
|
267
266
|
* ```javascript
|
|
268
|
-
* var editor =
|
|
267
|
+
* var editor = Jodit.make('#editor', {
|
|
269
268
|
* language: 'ru',
|
|
270
269
|
* i18n: {
|
|
271
270
|
* ru: {
|
|
@@ -334,7 +333,7 @@ export class Config implements IViewOptions {
|
|
|
334
333
|
* Jodit.MODE_SOURCE syntax highlighting source editor
|
|
335
334
|
* @example
|
|
336
335
|
* ```javascript
|
|
337
|
-
* var editor =
|
|
336
|
+
* var editor = Jodit.make('#editor', {
|
|
338
337
|
* defaultMode: Jodit.MODE_SPLIT
|
|
339
338
|
* });
|
|
340
339
|
* console.log(editor.getRealMode())
|
|
@@ -351,7 +350,7 @@ export class Config implements IViewOptions {
|
|
|
351
350
|
* The colors in HEX representation to select a color for the background and for the text in colorpicker
|
|
352
351
|
* @example
|
|
353
352
|
* ```javascript
|
|
354
|
-
*
|
|
353
|
+
* Jodit.make('#editor', {
|
|
355
354
|
* colors: ['#ff0000', '#00ff00', '#0000ff']
|
|
356
355
|
* })
|
|
357
356
|
* ```
|
|
@@ -449,7 +448,7 @@ export class Config implements IViewOptions {
|
|
|
449
448
|
* The default tab color picker
|
|
450
449
|
* @example
|
|
451
450
|
* ```javascript
|
|
452
|
-
*
|
|
451
|
+
* Jodit.make('#editor2', {
|
|
453
452
|
* colorPickerDefaultTab: 'color'
|
|
454
453
|
* })
|
|
455
454
|
* ```
|
|
@@ -476,11 +475,11 @@ export class Config implements IViewOptions {
|
|
|
476
475
|
* Do not init these plugins
|
|
477
476
|
* @example
|
|
478
477
|
* ```typescript
|
|
479
|
-
* var editor =
|
|
478
|
+
* var editor = Jodit.make('.editor', {
|
|
480
479
|
* disablePlugins: 'table,iframe'
|
|
481
480
|
* });
|
|
482
481
|
* //or
|
|
483
|
-
* var editor =
|
|
482
|
+
* var editor = Jodit.make('.editor', {
|
|
484
483
|
* disablePlugins: ['table', 'iframe']
|
|
485
484
|
* });
|
|
486
485
|
* ```
|
|
@@ -491,7 +490,7 @@ export class Config implements IViewOptions {
|
|
|
491
490
|
* Init and download extra plugins
|
|
492
491
|
* @example
|
|
493
492
|
* ```typescript
|
|
494
|
-
* var editor =
|
|
493
|
+
* var editor = Jodit.make('.editor', {
|
|
495
494
|
* extraPlugins: ['emoji']
|
|
496
495
|
* });
|
|
497
496
|
* ```
|
|
@@ -505,7 +504,7 @@ export class Config implements IViewOptions {
|
|
|
505
504
|
basePath?: string;
|
|
506
505
|
|
|
507
506
|
/**
|
|
508
|
-
*
|
|
507
|
+
* These buttons list will be added to option.buttons
|
|
509
508
|
*/
|
|
510
509
|
extraButtons: Array<string | IControlType> = [];
|
|
511
510
|
|
|
@@ -549,6 +548,41 @@ export class Config implements IViewOptions {
|
|
|
549
548
|
|
|
550
549
|
/**
|
|
551
550
|
* Default attributes for created inside editor elements
|
|
551
|
+
* @example
|
|
552
|
+
* ```js
|
|
553
|
+
* const editor2 = Jodit.make('#editor', {
|
|
554
|
+
* createAttributes: {
|
|
555
|
+
* div: {
|
|
556
|
+
* class: 'test'
|
|
557
|
+
* },
|
|
558
|
+
* ul: function (ul) {
|
|
559
|
+
* ul.classList.add('ui-test');
|
|
560
|
+
* }
|
|
561
|
+
* }
|
|
562
|
+
* });
|
|
563
|
+
*
|
|
564
|
+
* const div2 = editor2.createInside.div();
|
|
565
|
+
* expect(div2.className).equals('test');
|
|
566
|
+
*
|
|
567
|
+
* const ul = editor2.createInside.element('ul');
|
|
568
|
+
* expect(ul.className).equals('ui-test');
|
|
569
|
+
* ```
|
|
570
|
+
* Or JSX in React
|
|
571
|
+
* @example
|
|
572
|
+
* ```jsx
|
|
573
|
+
* import React, {useState, useRef} from 'react';
|
|
574
|
+
* import JoditEditor from "jodit-react";
|
|
575
|
+
*
|
|
576
|
+
* const config = {
|
|
577
|
+
* createAttributes: {
|
|
578
|
+
* div: {
|
|
579
|
+
* class: 'align-center'
|
|
580
|
+
* }
|
|
581
|
+
* }
|
|
582
|
+
* };
|
|
583
|
+
*
|
|
584
|
+
* <JoditEditor config={config}/>
|
|
585
|
+
* ```
|
|
552
586
|
*/
|
|
553
587
|
createAttributes: IDictionary<Attributes | NodeFunction> = {};
|
|
554
588
|
|
|
@@ -572,7 +606,7 @@ export class Config implements IViewOptions {
|
|
|
572
606
|
* Note - this is not the width of the device, the width of the editor
|
|
573
607
|
* @example
|
|
574
608
|
* ```javascript
|
|
575
|
-
*
|
|
609
|
+
* Jodit.make('#editor', {
|
|
576
610
|
* buttons: ['bold', 'italic', 'source'],
|
|
577
611
|
* buttonsMD: ['bold', 'italic'],
|
|
578
612
|
* buttonsXS: ['bold', 'fullsize'],
|
|
@@ -580,32 +614,31 @@ export class Config implements IViewOptions {
|
|
|
580
614
|
* ```
|
|
581
615
|
* @example
|
|
582
616
|
* ```javascript
|
|
583
|
-
*
|
|
617
|
+
* Jodit.make('#editor2', {
|
|
584
618
|
* buttons: [{
|
|
585
|
-
* name: '
|
|
619
|
+
* name: 'empty',
|
|
586
620
|
* icon: 'source',
|
|
587
|
-
* exec: function () {
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
* div.textContent = this.val();
|
|
621
|
+
* exec: function (editor) {
|
|
622
|
+
* const dialog = new Jodit.modules.Dialog({}),
|
|
623
|
+
* text = editor.c.element('textarea');
|
|
624
|
+
*
|
|
592
625
|
* dialog.setHeader('Source code');
|
|
593
626
|
* dialog.setContent(text);
|
|
594
627
|
* dialog.setSize(400, 300);
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
600
|
-
|
|
601
|
-
* dialog.
|
|
628
|
+
*
|
|
629
|
+
* Jodit.modules.Helpers.css(elm, {
|
|
630
|
+
* width: '100%',
|
|
631
|
+
* height: '100%'
|
|
632
|
+
* })
|
|
633
|
+
|
|
634
|
+
* dialog.open();
|
|
602
635
|
* }
|
|
603
636
|
* }]
|
|
604
637
|
* });
|
|
605
638
|
* ```
|
|
606
639
|
* @example
|
|
607
640
|
* ```javascript
|
|
608
|
-
*
|
|
641
|
+
* Jodit.make('#editor2', {
|
|
609
642
|
* buttons: Jodit.defaultOptions.buttons.concat([{
|
|
610
643
|
* name: 'listsss',
|
|
611
644
|
* iconURL: 'stuf/dummy.png',
|
package/src/core/async/async.ts
CHANGED
|
@@ -60,7 +60,7 @@ export class Async implements IAsync {
|
|
|
60
60
|
return timer;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
private clearLabel(label: string) {
|
|
63
|
+
private clearLabel(label: string): void {
|
|
64
64
|
if (label && this.timers.has(label)) {
|
|
65
65
|
clearTimeout(this.timers.get(label) as number);
|
|
66
66
|
this.timers.delete(label);
|
|
@@ -84,7 +84,7 @@ export class Async implements IAsync {
|
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```javascript
|
|
87
|
-
* var jodit =
|
|
87
|
+
* var jodit = Jodit.make('.editor');
|
|
88
88
|
* jodit.e.on('mousemove', jodit.async.debounce(() => {
|
|
89
89
|
* // Do expensive things
|
|
90
90
|
* }, 100));
|
|
@@ -100,14 +100,14 @@ export class Async implements IAsync {
|
|
|
100
100
|
|
|
101
101
|
const promises: Function[] = [];
|
|
102
102
|
|
|
103
|
-
const callFn = (...args: any[]) => {
|
|
103
|
+
const callFn = (...args: any[]): void => {
|
|
104
104
|
if (!fired) {
|
|
105
105
|
timer = 0;
|
|
106
106
|
const res = fn(...args);
|
|
107
107
|
fired = true;
|
|
108
108
|
|
|
109
109
|
if (promises.length) {
|
|
110
|
-
const runPromises = () => {
|
|
110
|
+
const runPromises = (): void => {
|
|
111
111
|
promises.forEach(res => res());
|
|
112
112
|
promises.length = 0;
|
|
113
113
|
};
|
|
@@ -117,7 +117,7 @@ export class Async implements IAsync {
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
const onFire = (...args: any[]) => {
|
|
120
|
+
const onFire = (...args: any[]): void => {
|
|
121
121
|
fired = false;
|
|
122
122
|
|
|
123
123
|
if (!timeout) {
|
|
@@ -139,7 +139,7 @@ export class Async implements IAsync {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
return isPlainObject(timeout) && timeout.promisify
|
|
142
|
-
? (...args: any[]) => {
|
|
142
|
+
? (...args: any[]): Promise<any> => {
|
|
143
143
|
const promise = this.promise(res => {
|
|
144
144
|
promises.push(res);
|
|
145
145
|
});
|
|
@@ -157,7 +157,7 @@ export class Async implements IAsync {
|
|
|
157
157
|
*
|
|
158
158
|
* @example
|
|
159
159
|
* ```javascript
|
|
160
|
-
* var jodit =
|
|
160
|
+
* var jodit = Jodit.make('.editor');
|
|
161
161
|
* jodit.e.on(document.body, 'scroll', jodit.async.throttle(function() {
|
|
162
162
|
* // Do expensive things
|
|
163
163
|
* }, 100));
|
|
@@ -183,7 +183,7 @@ export class Async implements IAsync {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (!timer) {
|
|
186
|
-
callee = () => {
|
|
186
|
+
callee = (): void => {
|
|
187
187
|
if (needInvoke) {
|
|
188
188
|
fn(...lastArgs);
|
|
189
189
|
needInvoke = false;
|
|
@@ -220,7 +220,9 @@ export class Async implements IAsync {
|
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
if (!promise.finally && process.env.TARGET_ES !== 'es2018') {
|
|
223
|
-
promise.finally = (
|
|
223
|
+
promise.finally = (
|
|
224
|
+
onfinally?: (() => void) | undefined | null
|
|
225
|
+
): Promise<T> => {
|
|
224
226
|
promise.then(onfinally).catch(onfinally);
|
|
225
227
|
return promise;
|
|
226
228
|
};
|
|
@@ -274,10 +276,14 @@ export class Async implements IAsync {
|
|
|
274
276
|
}
|
|
275
277
|
|
|
276
278
|
private requestsIdle: Set<number> = new Set();
|
|
279
|
+
private requestsRaf: Set<number> = new Set();
|
|
277
280
|
|
|
278
281
|
private requestIdleCallbackNative =
|
|
279
282
|
(window as any)['requestIdleCallback']?.bind(window) ??
|
|
280
|
-
((
|
|
283
|
+
((
|
|
284
|
+
callback: IdleRequestCallback,
|
|
285
|
+
options?: { timeout: number }
|
|
286
|
+
): number => {
|
|
281
287
|
const start = Date.now();
|
|
282
288
|
|
|
283
289
|
return this.setTimeout(() => {
|
|
@@ -285,7 +291,7 @@ export class Async implements IAsync {
|
|
|
285
291
|
didTimeout: false,
|
|
286
292
|
timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
|
|
287
293
|
});
|
|
288
|
-
}, 1);
|
|
294
|
+
}, options?.timeout ?? 1);
|
|
289
295
|
});
|
|
290
296
|
|
|
291
297
|
private cancelIdleCallbackNative =
|
|
@@ -294,15 +300,23 @@ export class Async implements IAsync {
|
|
|
294
300
|
this.clearTimeout(request);
|
|
295
301
|
});
|
|
296
302
|
|
|
297
|
-
requestIdleCallback(
|
|
298
|
-
|
|
303
|
+
requestIdleCallback(
|
|
304
|
+
callback: IdleRequestCallback,
|
|
305
|
+
options?: { timeout: number }
|
|
306
|
+
): number {
|
|
307
|
+
const request = this.requestIdleCallbackNative(callback, options);
|
|
299
308
|
this.requestsIdle.add(request);
|
|
300
309
|
return request;
|
|
301
310
|
}
|
|
302
311
|
|
|
303
|
-
requestIdlePromise(
|
|
312
|
+
requestIdlePromise(options?: {
|
|
313
|
+
timeout: number;
|
|
314
|
+
}): RejectablePromise<number> {
|
|
304
315
|
return this.promise<number>(res => {
|
|
305
|
-
const request = this.requestIdleCallback(
|
|
316
|
+
const request = this.requestIdleCallback(
|
|
317
|
+
() => res(request),
|
|
318
|
+
options
|
|
319
|
+
);
|
|
306
320
|
});
|
|
307
321
|
}
|
|
308
322
|
|
|
@@ -311,20 +325,28 @@ export class Async implements IAsync {
|
|
|
311
325
|
return this.cancelIdleCallbackNative(request);
|
|
312
326
|
}
|
|
313
327
|
|
|
328
|
+
requestAnimationFrame(callback: FrameRequestCallback): number {
|
|
329
|
+
const request = requestAnimationFrame(callback);
|
|
330
|
+
this.requestsRaf.add(request);
|
|
331
|
+
return request;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
cancelAnimationFrame(request: number): void {
|
|
335
|
+
this.requestsRaf.delete(request);
|
|
336
|
+
cancelAnimationFrame(request);
|
|
337
|
+
}
|
|
338
|
+
|
|
314
339
|
clear(): void {
|
|
315
|
-
this.requestsIdle.forEach(key =>
|
|
316
|
-
|
|
317
|
-
});
|
|
340
|
+
this.requestsIdle.forEach(key => this.cancelIdleCallback(key));
|
|
341
|
+
this.requestsRaf.forEach(key => this.cancelAnimationFrame(key));
|
|
318
342
|
|
|
319
|
-
this.timers.forEach(key =>
|
|
320
|
-
clearTimeout(this.timers.get(key) as number)
|
|
321
|
-
|
|
343
|
+
this.timers.forEach(key =>
|
|
344
|
+
clearTimeout(this.timers.get(key) as number)
|
|
345
|
+
);
|
|
322
346
|
|
|
323
347
|
this.timers.clear();
|
|
324
348
|
|
|
325
|
-
this.promisesRejections.forEach(reject =>
|
|
326
|
-
reject();
|
|
327
|
-
});
|
|
349
|
+
this.promisesRejections.forEach(reject => reject());
|
|
328
350
|
|
|
329
351
|
this.promisesRejections.clear();
|
|
330
352
|
}
|
package/src/core/constants.ts
CHANGED
|
@@ -107,6 +107,7 @@ export const IS_IE =
|
|
|
107
107
|
*/
|
|
108
108
|
export const TEXT_PLAIN = IS_IE ? 'text' : 'text/plain';
|
|
109
109
|
export const TEXT_HTML = IS_IE ? 'html' : 'text/html';
|
|
110
|
+
export const TEXT_RTF = IS_IE ? 'rtf' : 'text/rtf';
|
|
110
111
|
|
|
111
112
|
export const MARKER_CLASS = 'jodit-selection_marker';
|
|
112
113
|
|
|
@@ -2,3 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
Decorators are designed to make it easier to work with UI components.
|
|
4
4
|
Adding event handlers, state changes, and component status.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { component, watch, hook } from 'jodit/src/core/decorators';
|
|
8
|
+
import { UIElement } from 'jodit/src/ui';
|
|
9
|
+
|
|
10
|
+
@component
|
|
11
|
+
class UISomeReactElement extends UIElement {
|
|
12
|
+
state = {
|
|
13
|
+
color: 'red',
|
|
14
|
+
counter: 1
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
render(): string {
|
|
18
|
+
return `<div>
|
|
19
|
+
This text must be colored <span class="&__counter"></span>
|
|
20
|
+
</div>`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@hook('ready')
|
|
24
|
+
@watch('state.color')
|
|
25
|
+
onChangeColor(): void {
|
|
26
|
+
this.container.style.color = this.state.color;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@hook('ready')
|
|
30
|
+
@watch('state.counter')
|
|
31
|
+
onChangeColor(): void {
|
|
32
|
+
this.getElm('counter').innerText = this.state.counter.toString();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const elm = new UISomeReactElement(jodit);
|
|
37
|
+
elm.state.color = 'yellow';
|
|
38
|
+
elm.state.counter = 55;
|
|
39
|
+
```
|
|
@@ -28,7 +28,7 @@ export function cache<T, R>(
|
|
|
28
28
|
throw error('Getter property descriptor expected');
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
descriptor.get = function (this: T) {
|
|
31
|
+
descriptor.get = function (this: T): R {
|
|
32
32
|
const value = getter.call(this);
|
|
33
33
|
|
|
34
34
|
if (value && (value as IDictionary).noCache === true) {
|