@dangl/angular-material-shared 2.9.0-beta0036 → 2.9.0-beta0039
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/fesm2022/dangl-angular-material-shared-tiny-mce.mjs +38 -31
- package/fesm2022/dangl-angular-material-shared-tiny-mce.mjs.map +1 -1
- package/fesm2022/dangl-angular-material-shared.mjs +36 -51
- package/fesm2022/dangl-angular-material-shared.mjs.map +1 -1
- package/package.json +11 -10
- package/tinymce-assets/icons/default/icons.js +46 -9
- package/tinymce-assets/icons/default/icons.min.js +1 -1
- package/tinymce-assets/models/dom/model.js +8198 -7244
- package/tinymce-assets/models/dom/model.min.js +1 -4
- package/tinymce-assets/plugins/accordion/plugin.js +1174 -879
- package/tinymce-assets/plugins/accordion/plugin.min.js +1 -4
- package/tinymce-assets/plugins/advlist/plugin.js +412 -200
- package/tinymce-assets/plugins/advlist/plugin.min.js +1 -4
- package/tinymce-assets/plugins/anchor/plugin.js +189 -166
- package/tinymce-assets/plugins/anchor/plugin.min.js +1 -4
- package/tinymce-assets/plugins/autolink/plugin.js +310 -220
- package/tinymce-assets/plugins/autolink/plugin.min.js +1 -4
- package/tinymce-assets/plugins/autoresize/plugin.js +180 -149
- package/tinymce-assets/plugins/autoresize/plugin.min.js +1 -4
- package/tinymce-assets/plugins/autosave/plugin.js +208 -189
- package/tinymce-assets/plugins/autosave/plugin.min.js +1 -4
- package/tinymce-assets/plugins/charmap/plugin.js +905 -1566
- package/tinymce-assets/plugins/charmap/plugin.min.js +1 -4
- package/tinymce-assets/plugins/code/plugin.js +73 -61
- package/tinymce-assets/plugins/code/plugin.min.js +0 -3
- package/tinymce-assets/plugins/codesample/plugin.js +3593 -2402
- package/tinymce-assets/plugins/codesample/plugin.min.js +8 -3
- package/tinymce-assets/plugins/directionality/plugin.js +545 -304
- package/tinymce-assets/plugins/directionality/plugin.min.js +1 -4
- package/tinymce-assets/plugins/emoticons/js/emojiimages.min.js +0 -2
- package/tinymce-assets/plugins/emoticons/js/emojis.min.js +0 -1
- package/tinymce-assets/plugins/emoticons/plugin.js +702 -488
- package/tinymce-assets/plugins/emoticons/plugin.min.js +1 -4
- package/tinymce-assets/plugins/fullscreen/plugin.js +1409 -1049
- package/tinymce-assets/plugins/fullscreen/plugin.min.js +1 -4
- package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +5 -2
- package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +4 -1
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +8 -5
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +4 -1
- package/tinymce-assets/plugins/help/plugin.js +739 -809
- package/tinymce-assets/plugins/help/plugin.min.js +1 -4
- package/tinymce-assets/plugins/image/plugin.js +1475 -1291
- package/tinymce-assets/plugins/image/plugin.min.js +1 -4
- package/tinymce-assets/plugins/importcss/plugin.js +328 -269
- package/tinymce-assets/plugins/importcss/plugin.min.js +1 -4
- package/tinymce-assets/plugins/insertdatetime/plugin.js +140 -141
- package/tinymce-assets/plugins/insertdatetime/plugin.min.js +1 -4
- package/tinymce-assets/plugins/link/plugin.js +1419 -1084
- package/tinymce-assets/plugins/link/plugin.min.js +1 -4
- package/tinymce-assets/plugins/lists/plugin.js +2177 -1805
- package/tinymce-assets/plugins/lists/plugin.min.js +1 -4
- package/tinymce-assets/plugins/media/plugin.js +1305 -1047
- package/tinymce-assets/plugins/media/plugin.min.js +1 -4
- package/tinymce-assets/plugins/nonbreaking/plugin.js +93 -88
- package/tinymce-assets/plugins/nonbreaking/plugin.min.js +0 -3
- package/tinymce-assets/plugins/pagebreak/plugin.js +91 -85
- package/tinymce-assets/plugins/pagebreak/plugin.min.js +0 -3
- package/tinymce-assets/plugins/preview/plugin.js +742 -74
- package/tinymce-assets/plugins/preview/plugin.min.js +1 -4
- package/tinymce-assets/plugins/quickbars/plugin.js +582 -375
- package/tinymce-assets/plugins/quickbars/plugin.min.js +1 -4
- package/tinymce-assets/plugins/save/plugin.js +100 -82
- package/tinymce-assets/plugins/save/plugin.min.js +1 -4
- package/tinymce-assets/plugins/searchreplace/plugin.js +1183 -906
- package/tinymce-assets/plugins/searchreplace/plugin.min.js +1 -4
- package/tinymce-assets/plugins/table/plugin.js +3651 -3094
- package/tinymce-assets/plugins/table/plugin.min.js +1 -4
- package/tinymce-assets/plugins/visualblocks/plugin.js +71 -63
- package/tinymce-assets/plugins/visualblocks/plugin.min.js +1 -4
- package/tinymce-assets/plugins/visualchars/plugin.js +685 -436
- package/tinymce-assets/plugins/visualchars/plugin.min.js +1 -4
- package/tinymce-assets/plugins/wordcount/plugin.js +382 -307
- package/tinymce-assets/plugins/wordcount/plugin.min.js +1 -4
- package/tinymce-assets/skins/content/dark/content.css +9 -0
- package/tinymce-assets/skins/content/dark/content.js +10 -2
- package/tinymce-assets/skins/content/dark/content.min.css +9 -0
- package/tinymce-assets/skins/content/default/content.css +9 -0
- package/tinymce-assets/skins/content/default/content.js +10 -2
- package/tinymce-assets/skins/content/default/content.min.css +9 -0
- package/tinymce-assets/skins/content/document/content.css +9 -0
- package/tinymce-assets/skins/content/document/content.js +10 -2
- package/tinymce-assets/skins/content/document/content.min.css +9 -0
- package/tinymce-assets/skins/content/tinymce-5/content.css +9 -0
- package/tinymce-assets/skins/content/tinymce-5/content.js +10 -2
- package/tinymce-assets/skins/content/tinymce-5/content.min.css +9 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.css +9 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.js +10 -2
- package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +9 -0
- package/tinymce-assets/skins/content/writer/content.css +9 -0
- package/tinymce-assets/skins/content/writer/content.js +10 -2
- package/tinymce-assets/skins/content/writer/content.min.css +9 -0
- package/tinymce-assets/skins/ui/oxide/content.css +157 -49
- package/tinymce-assets/skins/ui/oxide/content.inline.css +157 -49
- package/tinymce-assets/skins/ui/oxide/content.inline.js +10 -2
- package/tinymce-assets/skins/ui/oxide/content.inline.min.css +10 -1
- package/tinymce-assets/skins/ui/oxide/content.js +10 -2
- package/tinymce-assets/skins/ui/oxide/content.min.css +10 -1
- package/tinymce-assets/skins/ui/oxide/skin.css +1592 -214
- package/tinymce-assets/skins/ui/oxide/skin.js +1 -2
- package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +1 -2
- package/tinymce-assets/skins/ui/oxide-dark/content.css +157 -42
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +157 -49
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +10 -2
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +10 -1
- package/tinymce-assets/skins/ui/oxide-dark/content.js +10 -2
- package/tinymce-assets/skins/ui/oxide-dark/content.min.css +10 -1
- package/tinymce-assets/skins/ui/oxide-dark/skin.css +1595 -217
- package/tinymce-assets/skins/ui/oxide-dark/skin.js +1 -2
- package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +1 -2
- package/tinymce-assets/skins/ui/tinymce-5/content.css +157 -49
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +157 -49
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +10 -2
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +10 -1
- package/tinymce-assets/skins/ui/tinymce-5/content.js +10 -2
- package/tinymce-assets/skins/ui/tinymce-5/content.min.css +10 -1
- package/tinymce-assets/skins/ui/tinymce-5/skin.css +1606 -203
- package/tinymce-assets/skins/ui/tinymce-5/skin.js +1 -2
- package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +1 -2
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +157 -42
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +157 -49
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +10 -2
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +10 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +10 -2
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +10 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +1607 -204
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +1 -2
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -2
- package/tinymce-assets/themes/silver/theme.js +32786 -28738
- package/tinymce-assets/themes/silver/theme.min.js +1 -4
- package/types/dangl-angular-material-shared-tiny-mce.d.ts +13 -13
- package/types/dangl-angular-material-shared.d.ts +26 -26
- package/tinymce-assets/plugins/template/index.js +0 -7
- package/tinymce-assets/plugins/template/plugin.js +0 -567
- package/tinymce-assets/plugins/template/plugin.min.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version
|
|
2
|
+
* TinyMCE version 7.9.3 (2026-05-19)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -8,252 +8,464 @@
|
|
|
8
8
|
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
9
|
|
|
10
10
|
const applyListFormat = (editor, listName, styleValue) => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
|
|
12
|
+
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const register$2 = editor => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const register$2 = (editor) => {
|
|
16
|
+
editor.addCommand('ApplyUnorderedListStyle', (ui, value) => {
|
|
17
|
+
applyListFormat(editor, 'UL', value['list-style-type']);
|
|
18
|
+
});
|
|
19
|
+
editor.addCommand('ApplyOrderedListStyle', (ui, value) => {
|
|
20
|
+
applyListFormat(editor, 'OL', value['list-style-type']);
|
|
21
|
+
});
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const option = name => editor => editor.options.get(name);
|
|
25
|
-
const register$1 = editor => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
const option = (name) => (editor) => editor.options.get(name);
|
|
25
|
+
const register$1 = (editor) => {
|
|
26
|
+
const registerOption = editor.options.register;
|
|
27
|
+
registerOption('advlist_number_styles', {
|
|
28
|
+
processor: 'string[]',
|
|
29
|
+
default: 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman'.split(',')
|
|
30
|
+
});
|
|
31
|
+
registerOption('advlist_bullet_styles', {
|
|
32
|
+
processor: 'string[]',
|
|
33
|
+
default: 'default,disc,circle,square'.split(',')
|
|
34
|
+
});
|
|
35
35
|
};
|
|
36
36
|
const getNumberStyles = option('advlist_number_styles');
|
|
37
37
|
const getBulletStyles = option('advlist_bullet_styles');
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
39
|
+
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
40
|
+
const isNullable = (a) => a === null || a === undefined;
|
|
41
|
+
const isNonNullable = (a) => !isNullable(a);
|
|
43
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The `Optional` type represents a value (of any type) that potentially does
|
|
45
|
+
* not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
|
|
46
|
+
* value does exist) or a `None` (in which case the value does not exist). This
|
|
47
|
+
* module defines a whole lot of FP-inspired utility functions for dealing with
|
|
48
|
+
* `Optional` objects.
|
|
49
|
+
*
|
|
50
|
+
* Comparison with null or undefined:
|
|
51
|
+
* - We don't get fancy null coalescing operators with `Optional`
|
|
52
|
+
* - We do get fancy helper functions with `Optional`
|
|
53
|
+
* - `Optional` support nesting, and allow for the type to still be nullable (or
|
|
54
|
+
* another `Optional`)
|
|
55
|
+
* - There is no option to turn off strict-optional-checks like there is for
|
|
56
|
+
* strict-null-checks
|
|
57
|
+
*/
|
|
44
58
|
class Optional {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
// The internal representation has a `tag` and a `value`, but both are
|
|
60
|
+
// private: able to be console.logged, but not able to be accessed by code
|
|
61
|
+
constructor(tag, value) {
|
|
62
|
+
this.tag = tag;
|
|
63
|
+
this.value = value;
|
|
64
|
+
}
|
|
65
|
+
// --- Identities ---
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new `Optional<T>` that **does** contain a value.
|
|
68
|
+
*/
|
|
69
|
+
static some(value) {
|
|
70
|
+
return new Optional(true, value);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a new `Optional<T>` that **does not** contain a value. `T` can be
|
|
74
|
+
* any type because we don't actually have a `T`.
|
|
75
|
+
*/
|
|
76
|
+
static none() {
|
|
77
|
+
return Optional.singletonNone;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Perform a transform on an `Optional` type. Regardless of whether this
|
|
81
|
+
* `Optional` contains a value or not, `fold` will return a value of type `U`.
|
|
82
|
+
* If this `Optional` does not contain a value, the `U` will be created by
|
|
83
|
+
* calling `onNone`. If this `Optional` does contain a value, the `U` will be
|
|
84
|
+
* created by calling `onSome`.
|
|
85
|
+
*
|
|
86
|
+
* For the FP enthusiasts in the room, this function:
|
|
87
|
+
* 1. Could be used to implement all of the functions below
|
|
88
|
+
* 2. Forms a catamorphism
|
|
89
|
+
*/
|
|
90
|
+
fold(onNone, onSome) {
|
|
91
|
+
if (this.tag) {
|
|
92
|
+
return onSome(this.value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return onNone();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Determine if this `Optional` object contains a value.
|
|
100
|
+
*/
|
|
101
|
+
isSome() {
|
|
102
|
+
return this.tag;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Determine if this `Optional` object **does not** contain a value.
|
|
106
|
+
*/
|
|
107
|
+
isNone() {
|
|
108
|
+
return !this.tag;
|
|
109
|
+
}
|
|
110
|
+
// --- Functor (name stolen from Haskell / maths) ---
|
|
111
|
+
/**
|
|
112
|
+
* Perform a transform on an `Optional` object, **if** there is a value. If
|
|
113
|
+
* you provide a function to turn a T into a U, this is the function you use
|
|
114
|
+
* to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
|
|
115
|
+
* a value then the output will also contain a value (that value being the
|
|
116
|
+
* output of `mapper(this.value)`), and if this **does not** contain a value
|
|
117
|
+
* then neither will the output.
|
|
118
|
+
*/
|
|
119
|
+
map(mapper) {
|
|
120
|
+
if (this.tag) {
|
|
121
|
+
return Optional.some(mapper(this.value));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return Optional.none();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// --- Monad (name stolen from Haskell / maths) ---
|
|
128
|
+
/**
|
|
129
|
+
* Perform a transform on an `Optional` object, **if** there is a value.
|
|
130
|
+
* Unlike `map`, here the transform itself also returns an `Optional`.
|
|
131
|
+
*/
|
|
132
|
+
bind(binder) {
|
|
133
|
+
if (this.tag) {
|
|
134
|
+
return binder(this.value);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return Optional.none();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// --- Traversable (name stolen from Haskell / maths) ---
|
|
141
|
+
/**
|
|
142
|
+
* For a given predicate, this function finds out if there **exists** a value
|
|
143
|
+
* inside this `Optional` object that meets the predicate. In practice, this
|
|
144
|
+
* means that for `Optional`s that do not contain a value it returns false (as
|
|
145
|
+
* no predicate-meeting value exists).
|
|
146
|
+
*/
|
|
147
|
+
exists(predicate) {
|
|
148
|
+
return this.tag && predicate(this.value);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* For a given predicate, this function finds out if **all** the values inside
|
|
152
|
+
* this `Optional` object meet the predicate. In practice, this means that
|
|
153
|
+
* for `Optional`s that do not contain a value it returns true (as all 0
|
|
154
|
+
* objects do meet the predicate).
|
|
155
|
+
*/
|
|
156
|
+
forall(predicate) {
|
|
157
|
+
return !this.tag || predicate(this.value);
|
|
158
|
+
}
|
|
159
|
+
filter(predicate) {
|
|
160
|
+
if (!this.tag || predicate(this.value)) {
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return Optional.none();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// --- Getters ---
|
|
168
|
+
/**
|
|
169
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
170
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
171
|
+
* value.
|
|
172
|
+
*/
|
|
173
|
+
getOr(replacement) {
|
|
174
|
+
return this.tag ? this.value : replacement;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
178
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
179
|
+
* value. Unlike `getOr`, in this method the `replacement` object is also
|
|
180
|
+
* `Optional` - meaning that this method will always return an `Optional`.
|
|
181
|
+
*/
|
|
182
|
+
or(replacement) {
|
|
183
|
+
return this.tag ? this : replacement;
|
|
60
184
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
return Optional.none();
|
|
185
|
+
/**
|
|
186
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
187
|
+
* `replacement` value if the provided `Optional` object does not contain a
|
|
188
|
+
* value. Unlike `getOr`, in this method the `replacement` value is
|
|
189
|
+
* "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
|
|
190
|
+
* pass a function which (if called) will **return** the `value` you want to
|
|
191
|
+
* use.
|
|
192
|
+
*/
|
|
193
|
+
getOrThunk(thunk) {
|
|
194
|
+
return this.tag ? this.value : thunk();
|
|
73
195
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Get the value out of the inside of the `Optional` object, using a default
|
|
198
|
+
* `replacement` value if the provided Optional object does not contain a
|
|
199
|
+
* value.
|
|
200
|
+
*
|
|
201
|
+
* Unlike `or`, in this method the `replacement` value is "thunked" - that is
|
|
202
|
+
* to say that you don't pass a value to `orThunk`, you pass a function which
|
|
203
|
+
* (if called) will **return** the `value` you want to use.
|
|
204
|
+
*
|
|
205
|
+
* Unlike `getOrThunk`, in this method the `replacement` value is also
|
|
206
|
+
* `Optional`, meaning that this method will always return an `Optional`.
|
|
207
|
+
*/
|
|
208
|
+
orThunk(thunk) {
|
|
209
|
+
return this.tag ? this : thunk();
|
|
80
210
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Get the value out of the inside of the `Optional` object, throwing an
|
|
213
|
+
* exception if the provided `Optional` object does not contain a value.
|
|
214
|
+
*
|
|
215
|
+
* WARNING:
|
|
216
|
+
* You should only be using this function if you know that the `Optional`
|
|
217
|
+
* object **is not** empty (otherwise you're throwing exceptions in production
|
|
218
|
+
* code, which is bad).
|
|
219
|
+
*
|
|
220
|
+
* In tests this is more acceptable.
|
|
221
|
+
*
|
|
222
|
+
* Prefer other methods to this, such as `.each`.
|
|
223
|
+
*/
|
|
224
|
+
getOrDie(message) {
|
|
225
|
+
if (!this.tag) {
|
|
226
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
return this.value;
|
|
230
|
+
}
|
|
93
231
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return this.tag ? this.value : thunk();
|
|
103
|
-
}
|
|
104
|
-
orThunk(thunk) {
|
|
105
|
-
return this.tag ? this : thunk();
|
|
106
|
-
}
|
|
107
|
-
getOrDie(message) {
|
|
108
|
-
if (!this.tag) {
|
|
109
|
-
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
110
|
-
} else {
|
|
111
|
-
return this.value;
|
|
232
|
+
// --- Interop with null and undefined ---
|
|
233
|
+
/**
|
|
234
|
+
* Creates an `Optional` value from a nullable (or undefined-able) input.
|
|
235
|
+
* Null, or undefined, is converted to `None`, and anything else is converted
|
|
236
|
+
* to `Some`.
|
|
237
|
+
*/
|
|
238
|
+
static from(value) {
|
|
239
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
112
240
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Converts an `Optional` to a nullable type, by getting the value if it
|
|
243
|
+
* exists, or returning `null` if it does not.
|
|
244
|
+
*/
|
|
245
|
+
getOrNull() {
|
|
246
|
+
return this.tag ? this.value : null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Converts an `Optional` to an undefined-able type, by getting the value if
|
|
250
|
+
* it exists, or returning `undefined` if it does not.
|
|
251
|
+
*/
|
|
252
|
+
getOrUndefined() {
|
|
253
|
+
return this.value;
|
|
254
|
+
}
|
|
255
|
+
// --- Utilities ---
|
|
256
|
+
/**
|
|
257
|
+
* If the `Optional` contains a value, perform an action on that value.
|
|
258
|
+
* Unlike the rest of the methods on this type, `.each` has side-effects. If
|
|
259
|
+
* you want to transform an `Optional<T>` **into** something, then this is not
|
|
260
|
+
* the method for you. If you want to use an `Optional<T>` to **do**
|
|
261
|
+
* something, then this is the method for you - provided you're okay with not
|
|
262
|
+
* doing anything in the case where the `Optional` doesn't have a value inside
|
|
263
|
+
* it. If you're not sure whether your use-case fits into transforming
|
|
264
|
+
* **into** something or **doing** something, check whether it has a return
|
|
265
|
+
* value. If it does, you should be performing a transform.
|
|
266
|
+
*/
|
|
267
|
+
each(worker) {
|
|
268
|
+
if (this.tag) {
|
|
269
|
+
worker(this.value);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Turn the `Optional` object into an array that contains all of the values
|
|
274
|
+
* stored inside the `Optional`. In practice, this means the output will have
|
|
275
|
+
* either 0 or 1 elements.
|
|
276
|
+
*/
|
|
277
|
+
toArray() {
|
|
278
|
+
return this.tag ? [this.value] : [];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Turn the `Optional` object into a string for debugging or printing. Not
|
|
282
|
+
* recommended for production code, but good for debugging. Also note that
|
|
283
|
+
* these days an `Optional` object can be logged to the console directly, and
|
|
284
|
+
* its inner value (if it exists) will be visible.
|
|
285
|
+
*/
|
|
286
|
+
toString() {
|
|
287
|
+
return this.tag ? `some(${this.value})` : 'none()';
|
|
126
288
|
}
|
|
127
|
-
}
|
|
128
|
-
toArray() {
|
|
129
|
-
return this.tag ? [this.value] : [];
|
|
130
|
-
}
|
|
131
|
-
toString() {
|
|
132
|
-
return this.tag ? `some(${ this.value })` : 'none()';
|
|
133
|
-
}
|
|
134
289
|
}
|
|
290
|
+
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
291
|
+
// reuse the same object
|
|
135
292
|
Optional.singletonNone = new Optional(false);
|
|
136
293
|
|
|
294
|
+
const nativeIndexOf = Array.prototype.indexOf;
|
|
295
|
+
/* eslint-enable */
|
|
296
|
+
const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
|
|
297
|
+
const contains = (xs, x) => rawIndexOf(xs, x) > -1;
|
|
137
298
|
const findUntil = (xs, pred, until) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
299
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
300
|
+
const x = xs[i];
|
|
301
|
+
if (pred(x, i)) {
|
|
302
|
+
return Optional.some(x);
|
|
303
|
+
}
|
|
304
|
+
else if (until(x, i)) {
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return Optional.none();
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// There are many variations of Object iteration that are faster than the 'for-in' style:
|
|
312
|
+
// http://jsperf.com/object-keys-iteration/107
|
|
313
|
+
//
|
|
314
|
+
// Use the native keys if it is available (IE9+), otherwise fall back to manually filtering
|
|
315
|
+
const keys = Object.keys;
|
|
316
|
+
const each = (obj, f) => {
|
|
317
|
+
const props = keys(obj);
|
|
318
|
+
for (let k = 0, len = props.length; k < len; k++) {
|
|
319
|
+
const i = props[k];
|
|
320
|
+
const x = obj[i];
|
|
321
|
+
f(x, i);
|
|
144
322
|
}
|
|
145
|
-
}
|
|
146
|
-
return Optional.none();
|
|
147
323
|
};
|
|
324
|
+
const map = (obj, f) => {
|
|
325
|
+
return tupleMap(obj, (x, i) => ({
|
|
326
|
+
k: i,
|
|
327
|
+
v: f(x, i)
|
|
328
|
+
}));
|
|
329
|
+
};
|
|
330
|
+
const tupleMap = (obj, f) => {
|
|
331
|
+
const r = {};
|
|
332
|
+
each(obj, (x, i) => {
|
|
333
|
+
const tuple = f(x, i);
|
|
334
|
+
r[tuple.k] = tuple.v;
|
|
335
|
+
});
|
|
336
|
+
return r;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
148
340
|
|
|
149
|
-
const isCustomList = list => /\btox\-/.test(list.className);
|
|
341
|
+
const isCustomList = (list) => /\btox\-/.test(list.className);
|
|
150
342
|
const isChildOfBody = (editor, elm) => {
|
|
151
|
-
|
|
343
|
+
return editor.dom.isChildOf(elm, editor.getBody());
|
|
152
344
|
};
|
|
153
|
-
const matchNodeNames = regex => node => isNonNullable(node) && regex.test(node.nodeName);
|
|
345
|
+
const matchNodeNames = (regex) => (node) => isNonNullable(node) && regex.test(node.nodeName);
|
|
154
346
|
const isListNode = matchNodeNames(/^(OL|UL|DL)$/);
|
|
155
347
|
const isTableCellNode = matchNodeNames(/^(TH|TD)$/);
|
|
156
|
-
const inList = (editor, parents, nodeName) => findUntil(parents, parent => isListNode(parent) && !isCustomList(parent), isTableCellNode)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
348
|
+
const inList = (editor, parents, nodeName) => findUntil(parents, (parent) => isListNode(parent) && !isCustomList(parent), isTableCellNode)
|
|
349
|
+
.exists((list) => list.nodeName === nodeName && isChildOfBody(editor, list));
|
|
350
|
+
const getSelectedStyleType = (editor) => {
|
|
351
|
+
const listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
|
352
|
+
const style = editor.dom.getStyle(listElm, 'listStyleType');
|
|
353
|
+
return Optional.from(style);
|
|
161
354
|
};
|
|
355
|
+
// Lists/core/Util.ts - Duplicated in Lists plugin
|
|
162
356
|
const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
|
|
163
357
|
const isWithinNonEditableList = (editor, element) => {
|
|
164
|
-
|
|
165
|
-
|
|
358
|
+
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
|
|
359
|
+
return isWithinNonEditable(editor, parentList) || !editor.selection.isEditable();
|
|
166
360
|
};
|
|
167
361
|
const setNodeChangeHandler = (editor, nodeChangeHandler) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
362
|
+
const initialNode = editor.selection.getNode();
|
|
363
|
+
// Set the initial state
|
|
364
|
+
nodeChangeHandler({
|
|
365
|
+
parents: editor.dom.getParents(initialNode),
|
|
366
|
+
element: initialNode
|
|
367
|
+
});
|
|
368
|
+
editor.on('NodeChange', nodeChangeHandler);
|
|
369
|
+
return () => editor.off('NodeChange', nodeChangeHandler);
|
|
175
370
|
};
|
|
176
371
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return
|
|
180
|
-
|
|
372
|
+
// <ListStyles>
|
|
373
|
+
const styleValueToText = (styleValue) => {
|
|
374
|
+
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, (chr) => {
|
|
375
|
+
return chr.toUpperCase();
|
|
376
|
+
});
|
|
181
377
|
};
|
|
182
|
-
const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
|
|
183
|
-
const makeSetupHandler = (editor, nodeName) => api => {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
378
|
+
const normalizeStyleValue = (styleValue) => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
|
|
379
|
+
const makeSetupHandler = (editor, nodeName) => (api) => {
|
|
380
|
+
const updateButtonState = (editor, parents) => {
|
|
381
|
+
const element = editor.selection.getStart(true);
|
|
382
|
+
api.setActive(inList(editor, parents, nodeName));
|
|
383
|
+
api.setEnabled(!isWithinNonEditableList(editor, element));
|
|
384
|
+
};
|
|
385
|
+
const nodeChangeHandler = (e) => updateButtonState(editor, e.parents);
|
|
386
|
+
return setNodeChangeHandler(editor, nodeChangeHandler);
|
|
191
387
|
};
|
|
192
388
|
const addSplitButton = (editor, id, tooltip, cmd, nodeName, styles) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
389
|
+
const listStyleTypeAliases = {
|
|
390
|
+
'lower-latin': 'lower-alpha',
|
|
391
|
+
'upper-latin': 'upper-alpha',
|
|
392
|
+
'lower-alpha': 'lower-latin',
|
|
393
|
+
'upper-alpha': 'upper-latin'
|
|
394
|
+
};
|
|
395
|
+
const stylesContainsAliasMap = map(listStyleTypeAliases, (alias) => contains(styles, alias));
|
|
396
|
+
editor.ui.registry.addSplitButton(id, {
|
|
397
|
+
tooltip,
|
|
398
|
+
icon: nodeName === "OL" /* ListType.OrderedList */ ? 'ordered-list' : 'unordered-list',
|
|
399
|
+
presets: 'listpreview',
|
|
400
|
+
columns: nodeName === "OL" /* ListType.OrderedList */ ? 3 : 4,
|
|
401
|
+
fetch: (callback) => {
|
|
402
|
+
const items = global.map(styles, (styleValue) => {
|
|
403
|
+
const iconStyle = nodeName === "OL" /* ListType.OrderedList */ ? 'num' : 'bull';
|
|
404
|
+
const iconName = styleValue === 'decimal' ? 'default' : styleValue;
|
|
405
|
+
const itemValue = normalizeStyleValue(styleValue);
|
|
406
|
+
const displayText = styleValueToText(styleValue);
|
|
407
|
+
return {
|
|
408
|
+
type: 'choiceitem',
|
|
409
|
+
value: itemValue,
|
|
410
|
+
icon: 'list-' + iconStyle + '-' + iconName,
|
|
411
|
+
text: displayText
|
|
412
|
+
};
|
|
413
|
+
});
|
|
414
|
+
callback(items);
|
|
415
|
+
},
|
|
416
|
+
onAction: () => editor.execCommand(cmd),
|
|
417
|
+
onItemAction: (_splitButtonApi, value) => {
|
|
418
|
+
applyListFormat(editor, nodeName, value);
|
|
419
|
+
},
|
|
420
|
+
select: (value) => {
|
|
421
|
+
const listStyleType = getSelectedStyleType(editor);
|
|
422
|
+
return listStyleType.exists((listStyle) => value === listStyle || (listStyleTypeAliases[listStyle] === value && !stylesContainsAliasMap[value]));
|
|
423
|
+
},
|
|
424
|
+
onSetup: makeSetupHandler(editor, nodeName)
|
|
425
|
+
});
|
|
223
426
|
};
|
|
224
427
|
const addButton = (editor, id, tooltip, cmd, nodeName, styleValue) => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
428
|
+
editor.ui.registry.addToggleButton(id, {
|
|
429
|
+
active: false,
|
|
430
|
+
tooltip,
|
|
431
|
+
icon: nodeName === "OL" /* ListType.OrderedList */ ? 'ordered-list' : 'unordered-list',
|
|
432
|
+
onSetup: makeSetupHandler(editor, nodeName),
|
|
433
|
+
// Need to make sure the button removes rather than applies if a list of the same type is selected
|
|
434
|
+
onAction: () => editor.queryCommandState(cmd) || styleValue === '' ? editor.execCommand(cmd) : applyListFormat(editor, nodeName, styleValue)
|
|
435
|
+
});
|
|
232
436
|
};
|
|
233
437
|
const addControl = (editor, id, tooltip, cmd, nodeName, styles) => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
438
|
+
if (styles.length > 1) {
|
|
439
|
+
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
addButton(editor, id, tooltip, cmd, nodeName, normalizeStyleValue(styles[0]));
|
|
443
|
+
}
|
|
239
444
|
};
|
|
240
|
-
const register = editor => {
|
|
241
|
-
|
|
242
|
-
|
|
445
|
+
const register = (editor) => {
|
|
446
|
+
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', "OL" /* ListType.OrderedList */, getNumberStyles(editor));
|
|
447
|
+
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', "UL" /* ListType.UnorderedList */, getBulletStyles(editor));
|
|
243
448
|
};
|
|
244
449
|
|
|
245
450
|
var Plugin = () => {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
451
|
+
global$1.add('advlist', (editor) => {
|
|
452
|
+
if (editor.hasPlugin('lists')) {
|
|
453
|
+
register$1(editor);
|
|
454
|
+
register(editor);
|
|
455
|
+
register$2(editor);
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
// eslint-disable-next-line no-console
|
|
459
|
+
console.error('Please use the Lists plugin together with the List Styles plugin.');
|
|
460
|
+
}
|
|
461
|
+
});
|
|
255
462
|
};
|
|
256
463
|
|
|
257
464
|
Plugin();
|
|
465
|
+
/** *****
|
|
466
|
+
* DO NOT EXPORT ANYTHING
|
|
467
|
+
*
|
|
468
|
+
* IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
|
|
469
|
+
*******/
|
|
258
470
|
|
|
259
471
|
})();
|