@dangl/angular-material-shared 2.9.0-beta0047 → 2.9.0-beta0048
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/package.json +1 -1
- package/tinymce-assets/icons/default/icons.js +9 -46
- package/tinymce-assets/icons/default/icons.min.js +1 -1
- package/tinymce-assets/models/dom/model.js +7239 -8193
- package/tinymce-assets/models/dom/model.min.js +1 -1
- package/tinymce-assets/plugins/accordion/plugin.js +879 -1174
- package/tinymce-assets/plugins/accordion/plugin.min.js +5 -1
- package/tinymce-assets/plugins/advlist/plugin.js +200 -412
- package/tinymce-assets/plugins/advlist/plugin.min.js +5 -1
- package/tinymce-assets/plugins/anchor/plugin.js +166 -189
- package/tinymce-assets/plugins/anchor/plugin.min.js +5 -1
- package/tinymce-assets/plugins/autolink/plugin.js +220 -310
- package/tinymce-assets/plugins/autolink/plugin.min.js +5 -1
- package/tinymce-assets/plugins/autoresize/plugin.js +149 -180
- package/tinymce-assets/plugins/autoresize/plugin.min.js +5 -1
- package/tinymce-assets/plugins/autosave/plugin.js +189 -208
- package/tinymce-assets/plugins/autosave/plugin.min.js +5 -1
- package/tinymce-assets/plugins/charmap/plugin.js +1566 -905
- package/tinymce-assets/plugins/charmap/plugin.min.js +5 -1
- package/tinymce-assets/plugins/code/plugin.js +61 -73
- package/tinymce-assets/plugins/code/plugin.min.js +4 -0
- package/tinymce-assets/plugins/codesample/plugin.js +2409 -3592
- package/tinymce-assets/plugins/codesample/plugin.min.js +12 -8
- package/tinymce-assets/plugins/directionality/plugin.js +304 -545
- package/tinymce-assets/plugins/directionality/plugin.min.js +5 -1
- package/tinymce-assets/plugins/emoticons/plugin.js +488 -702
- package/tinymce-assets/plugins/emoticons/plugin.min.js +5 -1
- package/tinymce-assets/plugins/fullscreen/plugin.js +1049 -1409
- package/tinymce-assets/plugins/fullscreen/plugin.min.js +5 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +2 -5
- package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +5 -8
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +1 -4
- package/tinymce-assets/plugins/help/plugin.js +809 -739
- package/tinymce-assets/plugins/help/plugin.min.js +5 -1
- package/tinymce-assets/plugins/image/plugin.js +1291 -1475
- package/tinymce-assets/plugins/image/plugin.min.js +5 -1
- package/tinymce-assets/plugins/importcss/plugin.js +269 -328
- package/tinymce-assets/plugins/importcss/plugin.min.js +5 -1
- package/tinymce-assets/plugins/insertdatetime/plugin.js +141 -140
- package/tinymce-assets/plugins/insertdatetime/plugin.min.js +5 -1
- package/tinymce-assets/plugins/link/plugin.js +1084 -1419
- package/tinymce-assets/plugins/link/plugin.min.js +5 -1
- package/tinymce-assets/plugins/lists/plugin.js +1805 -2177
- package/tinymce-assets/plugins/lists/plugin.min.js +5 -1
- package/tinymce-assets/plugins/media/plugin.js +1047 -1305
- package/tinymce-assets/plugins/media/plugin.min.js +5 -1
- package/tinymce-assets/plugins/nonbreaking/plugin.js +88 -93
- package/tinymce-assets/plugins/nonbreaking/plugin.min.js +4 -0
- package/tinymce-assets/plugins/pagebreak/plugin.js +85 -91
- package/tinymce-assets/plugins/pagebreak/plugin.min.js +4 -0
- package/tinymce-assets/plugins/preview/plugin.js +74 -742
- package/tinymce-assets/plugins/preview/plugin.min.js +5 -1
- package/tinymce-assets/plugins/quickbars/plugin.js +375 -582
- package/tinymce-assets/plugins/quickbars/plugin.min.js +5 -1
- package/tinymce-assets/plugins/save/plugin.js +82 -100
- package/tinymce-assets/plugins/save/plugin.min.js +5 -1
- package/tinymce-assets/plugins/searchreplace/plugin.js +906 -1183
- package/tinymce-assets/plugins/searchreplace/plugin.min.js +5 -1
- package/tinymce-assets/plugins/table/plugin.js +3094 -3651
- package/tinymce-assets/plugins/table/plugin.min.js +5 -1
- package/tinymce-assets/plugins/template/index.js +7 -0
- package/tinymce-assets/plugins/template/plugin.js +567 -0
- package/tinymce-assets/plugins/template/plugin.min.js +5 -0
- package/tinymce-assets/plugins/visualblocks/plugin.js +63 -71
- package/tinymce-assets/plugins/visualblocks/plugin.min.js +5 -1
- package/tinymce-assets/plugins/visualchars/plugin.js +436 -685
- package/tinymce-assets/plugins/visualchars/plugin.min.js +5 -1
- package/tinymce-assets/plugins/wordcount/plugin.js +307 -382
- package/tinymce-assets/plugins/wordcount/plugin.min.js +5 -1
- package/tinymce-assets/skins/content/dark/content.css +4 -0
- package/tinymce-assets/skins/content/dark/content.js +6 -1
- package/tinymce-assets/skins/content/dark/content.min.css +4 -0
- package/tinymce-assets/skins/content/default/content.css +4 -0
- package/tinymce-assets/skins/content/default/content.js +6 -1
- package/tinymce-assets/skins/content/default/content.min.css +4 -0
- package/tinymce-assets/skins/content/document/content.css +4 -0
- package/tinymce-assets/skins/content/document/content.js +6 -1
- package/tinymce-assets/skins/content/document/content.min.css +4 -0
- package/tinymce-assets/skins/content/tinymce-5/content.css +4 -0
- package/tinymce-assets/skins/content/tinymce-5/content.js +6 -1
- package/tinymce-assets/skins/content/tinymce-5/content.min.css +4 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.css +4 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.js +6 -1
- package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +4 -0
- package/tinymce-assets/skins/content/writer/content.css +4 -0
- package/tinymce-assets/skins/content/writer/content.js +6 -1
- package/tinymce-assets/skins/content/writer/content.min.css +4 -0
- package/tinymce-assets/skins/ui/oxide/content.css +53 -148
- package/tinymce-assets/skins/ui/oxide/content.inline.css +53 -148
- package/tinymce-assets/skins/ui/oxide/content.inline.js +6 -1
- package/tinymce-assets/skins/ui/oxide/content.inline.min.css +5 -1
- package/tinymce-assets/skins/ui/oxide/content.js +6 -1
- package/tinymce-assets/skins/ui/oxide/content.min.css +5 -1
- package/tinymce-assets/skins/ui/oxide/skin.css +207 -1585
- package/tinymce-assets/skins/ui/oxide/skin.js +2 -1
- package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +2 -1
- package/tinymce-assets/skins/ui/oxide-dark/content.css +46 -148
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +53 -148
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +6 -1
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +5 -1
- package/tinymce-assets/skins/ui/oxide-dark/content.js +6 -1
- package/tinymce-assets/skins/ui/oxide-dark/content.min.css +5 -1
- package/tinymce-assets/skins/ui/oxide-dark/skin.css +219 -1597
- package/tinymce-assets/skins/ui/oxide-dark/skin.js +2 -1
- package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +2 -1
- package/tinymce-assets/skins/ui/tinymce-5/content.css +53 -148
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +53 -148
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +6 -1
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +5 -1
- package/tinymce-assets/skins/ui/tinymce-5/content.js +6 -1
- package/tinymce-assets/skins/ui/tinymce-5/content.min.css +5 -1
- package/tinymce-assets/skins/ui/tinymce-5/skin.css +194 -1597
- package/tinymce-assets/skins/ui/tinymce-5/skin.js +2 -1
- package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +2 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +46 -148
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +53 -148
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +6 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +5 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +6 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +5 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +202 -1605
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +2 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -1
- package/tinymce-assets/themes/silver/theme.js +28439 -32466
- package/tinymce-assets/themes/silver/theme.min.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version
|
|
2
|
+
* TinyMCE version 6.8.6 (TBD)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -7,34 +7,28 @@
|
|
|
7
7
|
|
|
8
8
|
var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
9
|
|
|
10
|
-
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
11
10
|
const hasProto = (v, constructor, predicate) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const isType = (type) => (value) => typeOf(value) === type;
|
|
37
|
-
const eq = (t) => (a) => t === a;
|
|
11
|
+
var _a;
|
|
12
|
+
if (predicate(v, constructor.prototype)) {
|
|
13
|
+
return true;
|
|
14
|
+
} else {
|
|
15
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const typeOf = x => {
|
|
19
|
+
const t = typeof x;
|
|
20
|
+
if (x === null) {
|
|
21
|
+
return 'null';
|
|
22
|
+
} else if (t === 'object' && Array.isArray(x)) {
|
|
23
|
+
return 'array';
|
|
24
|
+
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
25
|
+
return 'string';
|
|
26
|
+
} else {
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const isType = type => value => typeOf(value) === type;
|
|
31
|
+
const eq = t => a => t === a;
|
|
38
32
|
const isString = isType('string');
|
|
39
33
|
const isUndefined = eq(undefined);
|
|
40
34
|
|
|
@@ -44,209 +38,196 @@
|
|
|
44
38
|
|
|
45
39
|
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
46
40
|
|
|
47
|
-
const fireRestoreDraft =
|
|
48
|
-
const fireStoreDraft =
|
|
49
|
-
const fireRemoveDraft =
|
|
50
|
-
|
|
51
|
-
const parse =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const option =
|
|
61
|
-
const register$1 =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
41
|
+
const fireRestoreDraft = editor => editor.dispatch('RestoreDraft');
|
|
42
|
+
const fireStoreDraft = editor => editor.dispatch('StoreDraft');
|
|
43
|
+
const fireRemoveDraft = editor => editor.dispatch('RemoveDraft');
|
|
44
|
+
|
|
45
|
+
const parse = timeString => {
|
|
46
|
+
const multiples = {
|
|
47
|
+
s: 1000,
|
|
48
|
+
m: 60000
|
|
49
|
+
};
|
|
50
|
+
const parsedTime = /^(\d+)([ms]?)$/.exec(timeString);
|
|
51
|
+
return (parsedTime && parsedTime[2] ? multiples[parsedTime[2]] : 1) * parseInt(timeString, 10);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const option = name => editor => editor.options.get(name);
|
|
55
|
+
const register$1 = editor => {
|
|
56
|
+
const registerOption = editor.options.register;
|
|
57
|
+
const timeProcessor = value => {
|
|
58
|
+
const valid = isString(value);
|
|
59
|
+
if (valid) {
|
|
60
|
+
return {
|
|
61
|
+
value: parse(value),
|
|
62
|
+
valid
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
return {
|
|
66
|
+
valid: false,
|
|
67
|
+
message: 'Must be a string.'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
registerOption('autosave_ask_before_unload', {
|
|
72
|
+
processor: 'boolean',
|
|
73
|
+
default: true
|
|
74
|
+
});
|
|
75
|
+
registerOption('autosave_prefix', {
|
|
76
|
+
processor: 'string',
|
|
77
|
+
default: 'tinymce-autosave-{path}{query}{hash}-{id}-'
|
|
78
|
+
});
|
|
79
|
+
registerOption('autosave_restore_when_empty', {
|
|
80
|
+
processor: 'boolean',
|
|
81
|
+
default: false
|
|
82
|
+
});
|
|
83
|
+
registerOption('autosave_interval', {
|
|
84
|
+
processor: timeProcessor,
|
|
85
|
+
default: '30s'
|
|
86
|
+
});
|
|
87
|
+
registerOption('autosave_retention', {
|
|
88
|
+
processor: timeProcessor,
|
|
89
|
+
default: '20m'
|
|
90
|
+
});
|
|
92
91
|
};
|
|
93
92
|
const shouldAskBeforeUnload = option('autosave_ask_before_unload');
|
|
94
93
|
const shouldRestoreWhenEmpty = option('autosave_restore_when_empty');
|
|
95
94
|
const getAutoSaveInterval = option('autosave_interval');
|
|
96
95
|
const getAutoSaveRetention = option('autosave_retention');
|
|
97
|
-
const getAutoSavePrefix =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.replace(/{query}/g, location.search)
|
|
101
|
-
.replace(/{hash}/g, location.hash)
|
|
102
|
-
.replace(/{id}/g, editor.id);
|
|
96
|
+
const getAutoSavePrefix = editor => {
|
|
97
|
+
const location = document.location;
|
|
98
|
+
return editor.options.get('autosave_prefix').replace(/{path}/g, location.pathname).replace(/{query}/g, location.search).replace(/{hash}/g, location.hash).replace(/{id}/g, editor.id);
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
const isEmpty = (editor, html) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const fragment = new DOMParser().parseFromString(trimmedHtml, 'text/html');
|
|
116
|
-
return editor.dom.isEmpty(fragment);
|
|
117
|
-
}
|
|
102
|
+
if (isUndefined(html)) {
|
|
103
|
+
return editor.dom.isEmpty(editor.getBody());
|
|
104
|
+
} else {
|
|
105
|
+
const trimmedHtml = global$1.trim(html);
|
|
106
|
+
if (trimmedHtml === '') {
|
|
107
|
+
return true;
|
|
108
|
+
} else {
|
|
109
|
+
const fragment = new DOMParser().parseFromString(trimmedHtml, 'text/html');
|
|
110
|
+
return editor.dom.isEmpty(fragment);
|
|
118
111
|
}
|
|
112
|
+
}
|
|
119
113
|
};
|
|
120
|
-
const hasDraft =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
const hasDraft = editor => {
|
|
115
|
+
var _a;
|
|
116
|
+
const time = parseInt((_a = global$2.getItem(getAutoSavePrefix(editor) + 'time')) !== null && _a !== void 0 ? _a : '0', 10) || 0;
|
|
117
|
+
if (new Date().getTime() - time > getAutoSaveRetention(editor)) {
|
|
118
|
+
removeDraft(editor, false);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
128
122
|
};
|
|
129
123
|
const removeDraft = (editor, fire) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
};
|
|
137
|
-
const storeDraft =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
editor
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
124
|
+
const prefix = getAutoSavePrefix(editor);
|
|
125
|
+
global$2.removeItem(prefix + 'draft');
|
|
126
|
+
global$2.removeItem(prefix + 'time');
|
|
127
|
+
if (fire !== false) {
|
|
128
|
+
fireRemoveDraft(editor);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const storeDraft = editor => {
|
|
132
|
+
const prefix = getAutoSavePrefix(editor);
|
|
133
|
+
if (!isEmpty(editor) && editor.isDirty()) {
|
|
134
|
+
global$2.setItem(prefix + 'draft', editor.getContent({
|
|
135
|
+
format: 'raw',
|
|
136
|
+
no_events: true
|
|
137
|
+
}));
|
|
138
|
+
global$2.setItem(prefix + 'time', new Date().getTime().toString());
|
|
139
|
+
fireStoreDraft(editor);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const restoreDraft = editor => {
|
|
143
|
+
var _a;
|
|
144
|
+
const prefix = getAutoSavePrefix(editor);
|
|
145
|
+
if (hasDraft(editor)) {
|
|
146
|
+
editor.setContent((_a = global$2.getItem(prefix + 'draft')) !== null && _a !== void 0 ? _a : '', { format: 'raw' });
|
|
147
|
+
fireRestoreDraft(editor);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const startStoreDraft = editor => {
|
|
151
|
+
const interval = getAutoSaveInterval(editor);
|
|
152
|
+
global$3.setEditorInterval(editor, () => {
|
|
153
|
+
storeDraft(editor);
|
|
154
|
+
}, interval);
|
|
155
|
+
};
|
|
156
|
+
const restoreLastDraft = editor => {
|
|
157
|
+
editor.undoManager.transact(() => {
|
|
158
|
+
restoreDraft(editor);
|
|
159
|
+
removeDraft(editor);
|
|
160
|
+
});
|
|
161
|
+
editor.focus();
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const get = editor => ({
|
|
165
|
+
hasDraft: () => hasDraft(editor),
|
|
166
|
+
storeDraft: () => storeDraft(editor),
|
|
167
|
+
restoreDraft: () => restoreDraft(editor),
|
|
168
|
+
removeDraft: fire => removeDraft(editor, fire),
|
|
169
|
+
isEmpty: html => isEmpty(editor, html)
|
|
173
170
|
});
|
|
174
171
|
|
|
175
172
|
var global = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
|
176
173
|
|
|
177
|
-
const setup =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
if (msg) {
|
|
191
|
-
e.preventDefault();
|
|
192
|
-
e.returnValue = msg;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const makeSetupHandler = (editor) => (api) => {
|
|
198
|
-
const shouldEnable = () => hasDraft(editor) && !editor.mode.isReadOnly();
|
|
199
|
-
api.setEnabled(shouldEnable());
|
|
200
|
-
const editorEventCallback = () => api.setEnabled(shouldEnable());
|
|
201
|
-
editor.on('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
|
202
|
-
return () => editor.off('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
|
203
|
-
};
|
|
204
|
-
const register = (editor) => {
|
|
205
|
-
// TODO: This was moved from makeSetupHandler as it would only be called when the menu item was rendered?
|
|
206
|
-
// Is it safe to start this process when the plugin is registered?
|
|
207
|
-
startStoreDraft(editor);
|
|
208
|
-
const onAction = () => {
|
|
209
|
-
restoreLastDraft(editor);
|
|
210
|
-
};
|
|
211
|
-
editor.ui.registry.addButton('restoredraft', {
|
|
212
|
-
tooltip: 'Restore last draft',
|
|
213
|
-
icon: 'restore-draft',
|
|
214
|
-
onAction,
|
|
215
|
-
onSetup: makeSetupHandler(editor)
|
|
216
|
-
});
|
|
217
|
-
editor.ui.registry.addMenuItem('restoredraft', {
|
|
218
|
-
text: 'Restore last draft',
|
|
219
|
-
icon: 'restore-draft',
|
|
220
|
-
onAction,
|
|
221
|
-
onSetup: makeSetupHandler(editor)
|
|
174
|
+
const setup = editor => {
|
|
175
|
+
editor.editorManager.on('BeforeUnload', e => {
|
|
176
|
+
let msg;
|
|
177
|
+
global$1.each(global.get(), editor => {
|
|
178
|
+
if (editor.plugins.autosave) {
|
|
179
|
+
editor.plugins.autosave.storeDraft();
|
|
180
|
+
}
|
|
181
|
+
if (!msg && editor.isDirty() && shouldAskBeforeUnload(editor)) {
|
|
182
|
+
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
|
|
183
|
+
}
|
|
222
184
|
});
|
|
185
|
+
if (msg) {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
e.returnValue = msg;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const makeSetupHandler = editor => api => {
|
|
193
|
+
api.setEnabled(hasDraft(editor));
|
|
194
|
+
const editorEventCallback = () => api.setEnabled(hasDraft(editor));
|
|
195
|
+
editor.on('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
|
196
|
+
return () => editor.off('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
|
197
|
+
};
|
|
198
|
+
const register = editor => {
|
|
199
|
+
startStoreDraft(editor);
|
|
200
|
+
const onAction = () => {
|
|
201
|
+
restoreLastDraft(editor);
|
|
202
|
+
};
|
|
203
|
+
editor.ui.registry.addButton('restoredraft', {
|
|
204
|
+
tooltip: 'Restore last draft',
|
|
205
|
+
icon: 'restore-draft',
|
|
206
|
+
onAction,
|
|
207
|
+
onSetup: makeSetupHandler(editor)
|
|
208
|
+
});
|
|
209
|
+
editor.ui.registry.addMenuItem('restoredraft', {
|
|
210
|
+
text: 'Restore last draft',
|
|
211
|
+
icon: 'restore-draft',
|
|
212
|
+
onAction,
|
|
213
|
+
onSetup: makeSetupHandler(editor)
|
|
214
|
+
});
|
|
223
215
|
};
|
|
224
216
|
|
|
225
|
-
/**
|
|
226
|
-
* This class contains all core logic for the autosave plugin.
|
|
227
|
-
*
|
|
228
|
-
* @class tinymce.autosave.Plugin
|
|
229
|
-
* @private
|
|
230
|
-
*/
|
|
231
217
|
var Plugin = () => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
return get(editor);
|
|
218
|
+
global$4.add('autosave', editor => {
|
|
219
|
+
register$1(editor);
|
|
220
|
+
setup(editor);
|
|
221
|
+
register(editor);
|
|
222
|
+
editor.on('init', () => {
|
|
223
|
+
if (shouldRestoreWhenEmpty(editor) && editor.dom.isEmpty(editor.getBody())) {
|
|
224
|
+
restoreDraft(editor);
|
|
225
|
+
}
|
|
242
226
|
});
|
|
227
|
+
return get(editor);
|
|
228
|
+
});
|
|
243
229
|
};
|
|
244
230
|
|
|
245
231
|
Plugin();
|
|
246
|
-
/** *****
|
|
247
|
-
* DO NOT EXPORT ANYTHING
|
|
248
|
-
*
|
|
249
|
-
* IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
|
|
250
|
-
*******/
|
|
251
232
|
|
|
252
233
|
})();
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* TinyMCE version 6.8.6 (TBD)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":e;var r,o,a,s})(t));const r=(void 0,t=>undefined===t);var o=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),s=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=t=>{const e=/^(\d+)([ms]?)$/.exec(t);return(e&&e[2]?{s:1e3,m:6e4}[e[2]]:1)*parseInt(t,10)},i=t=>e=>e.options.get(t),u=i("autosave_ask_before_unload"),l=i("autosave_restore_when_empty"),c=i("autosave_interval"),d=i("autosave_retention"),m=t=>{const e=document.location;return t.options.get("autosave_prefix").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},v=(t,e)=>{if(r(e))return t.dom.isEmpty(t.getBody());{const r=s.trim(e);if(""===r)return!0;{const e=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(e)}}},f=t=>{var e;const r=parseInt(null!==(e=a.getItem(m(t)+"time"))&&void 0!==e?e:"0",10)||0;return!((new Date).getTime()-r>d(t)&&(p(t,!1),1))},p=(t,e)=>{const r=m(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&(t=>{t.dispatch("RemoveDraft")})(t)},g=t=>{const e=m(t);!v(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),(t=>{t.dispatch("StoreDraft")})(t))},y=t=>{var e;const r=m(t);f(t)&&(t.setContent(null!==(e=a.getItem(r+"draft"))&&void 0!==e?e:"",{format:"raw"}),(t=>{t.dispatch("RestoreDraft")})(t))};var D=tinymce.util.Tools.resolve("tinymce.EditorManager");const h=t=>e=>{e.setEnabled(f(t));const r=()=>e.setEnabled(f(t));return t.on("StoreDraft RestoreDraft RemoveDraft",r),()=>t.off("StoreDraft RestoreDraft RemoveDraft",r)};t.add("autosave",(t=>((t=>{const r=t.options.register,o=t=>{const r=e(t);return r?{value:n(t),valid:r}:{valid:!1,message:"Must be a string."}};r("autosave_ask_before_unload",{processor:"boolean",default:!0}),r("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),r("autosave_restore_when_empty",{processor:"boolean",default:!1}),r("autosave_interval",{processor:o,default:"30s"}),r("autosave_retention",{processor:o,default:"20m"})})(t),(t=>{t.editorManager.on("BeforeUnload",(t=>{let e;s.each(D.get(),(t=>{t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))})),e&&(t.preventDefault(),t.returnValue=e)}))})(t),(t=>{(t=>{const e=c(t);o.setEditorInterval(t,(()=>{g(t)}),e)})(t);const e=()=>{(t=>{t.undoManager.transact((()=>{y(t),p(t)})),t.focus()})(t)};t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)})})(t),t.on("init",(()=>{l(t)&&t.dom.isEmpty(t.getBody())&&y(t)})),(t=>({hasDraft:()=>f(t),storeDraft:()=>g(t),restoreDraft:()=>y(t),removeDraft:e=>p(t,e),isEmpty:e=>v(t,e)}))(t))))}();
|