@dangl/angular-material-shared 2.9.0-beta0040 → 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.
Files changed (165) hide show
  1. package/package.json +1 -1
  2. package/tinymce-assets/icons/default/icons.js +9 -46
  3. package/tinymce-assets/icons/default/icons.min.js +1 -1
  4. package/tinymce-assets/models/dom/model.js +7239 -8193
  5. package/tinymce-assets/models/dom/model.min.js +1 -1
  6. package/tinymce-assets/plugins/accordion/plugin.js +879 -1174
  7. package/tinymce-assets/plugins/accordion/plugin.min.js +5 -1
  8. package/tinymce-assets/plugins/advlist/plugin.js +200 -412
  9. package/tinymce-assets/plugins/advlist/plugin.min.js +5 -1
  10. package/tinymce-assets/plugins/anchor/plugin.js +166 -189
  11. package/tinymce-assets/plugins/anchor/plugin.min.js +5 -1
  12. package/tinymce-assets/plugins/autolink/plugin.js +220 -310
  13. package/tinymce-assets/plugins/autolink/plugin.min.js +5 -1
  14. package/tinymce-assets/plugins/autoresize/plugin.js +149 -180
  15. package/tinymce-assets/plugins/autoresize/plugin.min.js +5 -1
  16. package/tinymce-assets/plugins/autosave/plugin.js +189 -208
  17. package/tinymce-assets/plugins/autosave/plugin.min.js +5 -1
  18. package/tinymce-assets/plugins/charmap/plugin.js +1566 -905
  19. package/tinymce-assets/plugins/charmap/plugin.min.js +5 -1
  20. package/tinymce-assets/plugins/code/plugin.js +61 -73
  21. package/tinymce-assets/plugins/code/plugin.min.js +4 -0
  22. package/tinymce-assets/plugins/codesample/plugin.js +2409 -3592
  23. package/tinymce-assets/plugins/codesample/plugin.min.js +12 -8
  24. package/tinymce-assets/plugins/directionality/plugin.js +304 -545
  25. package/tinymce-assets/plugins/directionality/plugin.min.js +5 -1
  26. package/tinymce-assets/plugins/emoticons/plugin.js +488 -702
  27. package/tinymce-assets/plugins/emoticons/plugin.min.js +5 -1
  28. package/tinymce-assets/plugins/fullscreen/plugin.js +1049 -1409
  29. package/tinymce-assets/plugins/fullscreen/plugin.min.js +5 -1
  30. package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +1 -4
  31. package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +1 -4
  32. package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +1 -4
  33. package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +1 -4
  34. package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +1 -4
  35. package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +1 -4
  36. package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +1 -4
  37. package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +1 -4
  38. package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +1 -4
  39. package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +1 -4
  40. package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +1 -4
  41. package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +1 -4
  42. package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +1 -4
  43. package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +1 -4
  44. package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +1 -4
  45. package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +1 -4
  46. package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +1 -4
  47. package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +1 -4
  48. package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +1 -4
  49. package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +1 -4
  50. package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +1 -4
  51. package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +1 -4
  52. package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +1 -4
  53. package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +1 -4
  54. package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +1 -4
  55. package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +1 -4
  56. package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +1 -4
  57. package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +1 -4
  58. package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +1 -4
  59. package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +1 -4
  60. package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +1 -4
  61. package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +2 -5
  62. package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +1 -4
  63. package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +1 -4
  64. package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +1 -4
  65. package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +1 -4
  66. package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +1 -4
  67. package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +5 -8
  68. package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +1 -4
  69. package/tinymce-assets/plugins/help/plugin.js +809 -739
  70. package/tinymce-assets/plugins/help/plugin.min.js +5 -1
  71. package/tinymce-assets/plugins/image/plugin.js +1291 -1475
  72. package/tinymce-assets/plugins/image/plugin.min.js +5 -1
  73. package/tinymce-assets/plugins/importcss/plugin.js +269 -328
  74. package/tinymce-assets/plugins/importcss/plugin.min.js +5 -1
  75. package/tinymce-assets/plugins/insertdatetime/plugin.js +141 -140
  76. package/tinymce-assets/plugins/insertdatetime/plugin.min.js +5 -1
  77. package/tinymce-assets/plugins/link/plugin.js +1084 -1419
  78. package/tinymce-assets/plugins/link/plugin.min.js +5 -1
  79. package/tinymce-assets/plugins/lists/plugin.js +1805 -2177
  80. package/tinymce-assets/plugins/lists/plugin.min.js +5 -1
  81. package/tinymce-assets/plugins/media/plugin.js +1047 -1305
  82. package/tinymce-assets/plugins/media/plugin.min.js +5 -1
  83. package/tinymce-assets/plugins/nonbreaking/plugin.js +88 -93
  84. package/tinymce-assets/plugins/nonbreaking/plugin.min.js +4 -0
  85. package/tinymce-assets/plugins/pagebreak/plugin.js +85 -91
  86. package/tinymce-assets/plugins/pagebreak/plugin.min.js +4 -0
  87. package/tinymce-assets/plugins/preview/plugin.js +74 -742
  88. package/tinymce-assets/plugins/preview/plugin.min.js +5 -1
  89. package/tinymce-assets/plugins/quickbars/plugin.js +375 -582
  90. package/tinymce-assets/plugins/quickbars/plugin.min.js +5 -1
  91. package/tinymce-assets/plugins/save/plugin.js +82 -100
  92. package/tinymce-assets/plugins/save/plugin.min.js +5 -1
  93. package/tinymce-assets/plugins/searchreplace/plugin.js +906 -1183
  94. package/tinymce-assets/plugins/searchreplace/plugin.min.js +5 -1
  95. package/tinymce-assets/plugins/table/plugin.js +3094 -3651
  96. package/tinymce-assets/plugins/table/plugin.min.js +5 -1
  97. package/tinymce-assets/plugins/template/index.js +7 -0
  98. package/tinymce-assets/plugins/template/plugin.js +567 -0
  99. package/tinymce-assets/plugins/template/plugin.min.js +5 -0
  100. package/tinymce-assets/plugins/visualblocks/plugin.js +63 -71
  101. package/tinymce-assets/plugins/visualblocks/plugin.min.js +5 -1
  102. package/tinymce-assets/plugins/visualchars/plugin.js +436 -685
  103. package/tinymce-assets/plugins/visualchars/plugin.min.js +5 -1
  104. package/tinymce-assets/plugins/wordcount/plugin.js +307 -382
  105. package/tinymce-assets/plugins/wordcount/plugin.min.js +5 -1
  106. package/tinymce-assets/skins/content/dark/content.css +4 -0
  107. package/tinymce-assets/skins/content/dark/content.js +6 -1
  108. package/tinymce-assets/skins/content/dark/content.min.css +4 -0
  109. package/tinymce-assets/skins/content/default/content.css +4 -0
  110. package/tinymce-assets/skins/content/default/content.js +6 -1
  111. package/tinymce-assets/skins/content/default/content.min.css +4 -0
  112. package/tinymce-assets/skins/content/document/content.css +4 -0
  113. package/tinymce-assets/skins/content/document/content.js +6 -1
  114. package/tinymce-assets/skins/content/document/content.min.css +4 -0
  115. package/tinymce-assets/skins/content/tinymce-5/content.css +4 -0
  116. package/tinymce-assets/skins/content/tinymce-5/content.js +6 -1
  117. package/tinymce-assets/skins/content/tinymce-5/content.min.css +4 -0
  118. package/tinymce-assets/skins/content/tinymce-5-dark/content.css +4 -0
  119. package/tinymce-assets/skins/content/tinymce-5-dark/content.js +6 -1
  120. package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +4 -0
  121. package/tinymce-assets/skins/content/writer/content.css +4 -0
  122. package/tinymce-assets/skins/content/writer/content.js +6 -1
  123. package/tinymce-assets/skins/content/writer/content.min.css +4 -0
  124. package/tinymce-assets/skins/ui/oxide/content.css +53 -148
  125. package/tinymce-assets/skins/ui/oxide/content.inline.css +53 -148
  126. package/tinymce-assets/skins/ui/oxide/content.inline.js +6 -1
  127. package/tinymce-assets/skins/ui/oxide/content.inline.min.css +5 -1
  128. package/tinymce-assets/skins/ui/oxide/content.js +6 -1
  129. package/tinymce-assets/skins/ui/oxide/content.min.css +5 -1
  130. package/tinymce-assets/skins/ui/oxide/skin.css +207 -1585
  131. package/tinymce-assets/skins/ui/oxide/skin.js +2 -1
  132. package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -1
  133. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +2 -1
  134. package/tinymce-assets/skins/ui/oxide-dark/content.css +46 -148
  135. package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +53 -148
  136. package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +6 -1
  137. package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +5 -1
  138. package/tinymce-assets/skins/ui/oxide-dark/content.js +6 -1
  139. package/tinymce-assets/skins/ui/oxide-dark/content.min.css +5 -1
  140. package/tinymce-assets/skins/ui/oxide-dark/skin.css +219 -1597
  141. package/tinymce-assets/skins/ui/oxide-dark/skin.js +2 -1
  142. package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -1
  143. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +2 -1
  144. package/tinymce-assets/skins/ui/tinymce-5/content.css +53 -148
  145. package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +53 -148
  146. package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +6 -1
  147. package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +5 -1
  148. package/tinymce-assets/skins/ui/tinymce-5/content.js +6 -1
  149. package/tinymce-assets/skins/ui/tinymce-5/content.min.css +5 -1
  150. package/tinymce-assets/skins/ui/tinymce-5/skin.css +194 -1597
  151. package/tinymce-assets/skins/ui/tinymce-5/skin.js +2 -1
  152. package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -1
  153. package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +2 -1
  154. package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +46 -148
  155. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +53 -148
  156. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +6 -1
  157. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +5 -1
  158. package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +6 -1
  159. package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +5 -1
  160. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +202 -1605
  161. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +2 -1
  162. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  163. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -1
  164. package/tinymce-assets/themes/silver/theme.js +28439 -32466
  165. package/tinymce-assets/themes/silver/theme.min.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 7.9.3 (2026-05-19)
2
+ * TinyMCE version 6.8.6 (TBD)
3
3
  */
4
4
 
5
5
  (function () {
@@ -7,648 +7,441 @@
7
7
 
8
8
  var global$1 = 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
- var _a;
13
- if (predicate(v, constructor.prototype)) {
14
- return true;
15
- }
16
- else {
17
- // String-based fallback time
18
- return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
19
- }
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
+ }
20
17
  };
21
- const typeOf = (x) => {
22
- const t = typeof x;
23
- if (x === null) {
24
- return 'null';
25
- }
26
- else if (t === 'object' && Array.isArray(x)) {
27
- return 'array';
28
- }
29
- else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
30
- return 'string';
31
- }
32
- else {
33
- return t;
34
- }
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
+ }
35
29
  };
36
- const isType = (type) => (value) => typeOf(value) === type;
37
- const isSimpleType = (type) => (value) => typeof value === type;
30
+ const isType = type => value => typeOf(value) === type;
31
+ const isSimpleType = type => value => typeof value === type;
38
32
  const isString = isType('string');
39
33
  const isBoolean = isSimpleType('boolean');
40
- const isNullable = (a) => a === null || a === undefined;
41
- const isNonNullable = (a) => !isNullable(a);
34
+ const isNullable = a => a === null || a === undefined;
35
+ const isNonNullable = a => !isNullable(a);
42
36
  const isFunction = isSimpleType('function');
43
37
 
44
- const constant = (value) => {
45
- return () => {
46
- return value;
47
- };
38
+ const option = name => editor => editor.options.get(name);
39
+ const register = editor => {
40
+ const registerOption = editor.options.register;
41
+ const toolbarProcessor = defaultValue => value => {
42
+ const valid = isBoolean(value) || isString(value);
43
+ if (valid) {
44
+ if (isBoolean(value)) {
45
+ return {
46
+ value: value ? defaultValue : '',
47
+ valid
48
+ };
49
+ } else {
50
+ return {
51
+ value: value.trim(),
52
+ valid
53
+ };
54
+ }
55
+ } else {
56
+ return {
57
+ valid: false,
58
+ message: 'Must be a boolean or string.'
59
+ };
60
+ }
61
+ };
62
+ const defaultSelectionToolbar = 'bold italic | quicklink h2 h3 blockquote';
63
+ registerOption('quickbars_selection_toolbar', {
64
+ processor: toolbarProcessor(defaultSelectionToolbar),
65
+ default: defaultSelectionToolbar
66
+ });
67
+ const defaultInsertToolbar = 'quickimage quicktable';
68
+ registerOption('quickbars_insert_toolbar', {
69
+ processor: toolbarProcessor(defaultInsertToolbar),
70
+ default: defaultInsertToolbar
71
+ });
72
+ const defaultImageToolbar = 'alignleft aligncenter alignright';
73
+ registerOption('quickbars_image_toolbar', {
74
+ processor: toolbarProcessor(defaultImageToolbar),
75
+ default: defaultImageToolbar
76
+ });
48
77
  };
49
- const never = constant(false);
50
-
51
- /**
52
- * The `Optional` type represents a value (of any type) that potentially does
53
- * not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
54
- * value does exist) or a `None` (in which case the value does not exist). This
55
- * module defines a whole lot of FP-inspired utility functions for dealing with
56
- * `Optional` objects.
57
- *
58
- * Comparison with null or undefined:
59
- * - We don't get fancy null coalescing operators with `Optional`
60
- * - We do get fancy helper functions with `Optional`
61
- * - `Optional` support nesting, and allow for the type to still be nullable (or
62
- * another `Optional`)
63
- * - There is no option to turn off strict-optional-checks like there is for
64
- * strict-null-checks
65
- */
66
- class Optional {
67
- // The internal representation has a `tag` and a `value`, but both are
68
- // private: able to be console.logged, but not able to be accessed by code
69
- constructor(tag, value) {
70
- this.tag = tag;
71
- this.value = value;
72
- }
73
- // --- Identities ---
74
- /**
75
- * Creates a new `Optional<T>` that **does** contain a value.
76
- */
77
- static some(value) {
78
- return new Optional(true, value);
79
- }
80
- /**
81
- * Create a new `Optional<T>` that **does not** contain a value. `T` can be
82
- * any type because we don't actually have a `T`.
83
- */
84
- static none() {
85
- return Optional.singletonNone;
86
- }
87
- /**
88
- * Perform a transform on an `Optional` type. Regardless of whether this
89
- * `Optional` contains a value or not, `fold` will return a value of type `U`.
90
- * If this `Optional` does not contain a value, the `U` will be created by
91
- * calling `onNone`. If this `Optional` does contain a value, the `U` will be
92
- * created by calling `onSome`.
93
- *
94
- * For the FP enthusiasts in the room, this function:
95
- * 1. Could be used to implement all of the functions below
96
- * 2. Forms a catamorphism
97
- */
98
- fold(onNone, onSome) {
99
- if (this.tag) {
100
- return onSome(this.value);
101
- }
102
- else {
103
- return onNone();
104
- }
105
- }
106
- /**
107
- * Determine if this `Optional` object contains a value.
108
- */
109
- isSome() {
110
- return this.tag;
111
- }
112
- /**
113
- * Determine if this `Optional` object **does not** contain a value.
114
- */
115
- isNone() {
116
- return !this.tag;
117
- }
118
- // --- Functor (name stolen from Haskell / maths) ---
119
- /**
120
- * Perform a transform on an `Optional` object, **if** there is a value. If
121
- * you provide a function to turn a T into a U, this is the function you use
122
- * to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
123
- * a value then the output will also contain a value (that value being the
124
- * output of `mapper(this.value)`), and if this **does not** contain a value
125
- * then neither will the output.
126
- */
127
- map(mapper) {
128
- if (this.tag) {
129
- return Optional.some(mapper(this.value));
130
- }
131
- else {
132
- return Optional.none();
133
- }
134
- }
135
- // --- Monad (name stolen from Haskell / maths) ---
136
- /**
137
- * Perform a transform on an `Optional` object, **if** there is a value.
138
- * Unlike `map`, here the transform itself also returns an `Optional`.
139
- */
140
- bind(binder) {
141
- if (this.tag) {
142
- return binder(this.value);
143
- }
144
- else {
145
- return Optional.none();
146
- }
147
- }
148
- // --- Traversable (name stolen from Haskell / maths) ---
149
- /**
150
- * For a given predicate, this function finds out if there **exists** a value
151
- * inside this `Optional` object that meets the predicate. In practice, this
152
- * means that for `Optional`s that do not contain a value it returns false (as
153
- * no predicate-meeting value exists).
154
- */
155
- exists(predicate) {
156
- return this.tag && predicate(this.value);
157
- }
158
- /**
159
- * For a given predicate, this function finds out if **all** the values inside
160
- * this `Optional` object meet the predicate. In practice, this means that
161
- * for `Optional`s that do not contain a value it returns true (as all 0
162
- * objects do meet the predicate).
163
- */
164
- forall(predicate) {
165
- return !this.tag || predicate(this.value);
166
- }
167
- filter(predicate) {
168
- if (!this.tag || predicate(this.value)) {
169
- return this;
170
- }
171
- else {
172
- return Optional.none();
173
- }
174
- }
175
- // --- Getters ---
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.
180
- */
181
- getOr(replacement) {
182
- return this.tag ? this.value : replacement;
183
- }
184
- /**
185
- * Get the value out of the inside of the `Optional` object, using a default
186
- * `replacement` value if the provided `Optional` object does not contain a
187
- * value. Unlike `getOr`, in this method the `replacement` object is also
188
- * `Optional` - meaning that this method will always return an `Optional`.
189
- */
190
- or(replacement) {
191
- return this.tag ? this : replacement;
192
- }
193
- /**
194
- * Get the value out of the inside of the `Optional` object, using a default
195
- * `replacement` value if the provided `Optional` object does not contain a
196
- * value. Unlike `getOr`, in this method the `replacement` value is
197
- * "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
198
- * pass a function which (if called) will **return** the `value` you want to
199
- * use.
200
- */
201
- getOrThunk(thunk) {
202
- return this.tag ? this.value : thunk();
203
- }
204
- /**
205
- * Get the value out of the inside of the `Optional` object, using a default
206
- * `replacement` value if the provided Optional object does not contain a
207
- * value.
208
- *
209
- * Unlike `or`, in this method the `replacement` value is "thunked" - that is
210
- * to say that you don't pass a value to `orThunk`, you pass a function which
211
- * (if called) will **return** the `value` you want to use.
212
- *
213
- * Unlike `getOrThunk`, in this method the `replacement` value is also
214
- * `Optional`, meaning that this method will always return an `Optional`.
215
- */
216
- orThunk(thunk) {
217
- return this.tag ? this : thunk();
218
- }
219
- /**
220
- * Get the value out of the inside of the `Optional` object, throwing an
221
- * exception if the provided `Optional` object does not contain a value.
222
- *
223
- * WARNING:
224
- * You should only be using this function if you know that the `Optional`
225
- * object **is not** empty (otherwise you're throwing exceptions in production
226
- * code, which is bad).
227
- *
228
- * In tests this is more acceptable.
229
- *
230
- * Prefer other methods to this, such as `.each`.
231
- */
232
- getOrDie(message) {
233
- if (!this.tag) {
234
- throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
235
- }
236
- else {
237
- return this.value;
238
- }
239
- }
240
- // --- Interop with null and undefined ---
241
- /**
242
- * Creates an `Optional` value from a nullable (or undefined-able) input.
243
- * Null, or undefined, is converted to `None`, and anything else is converted
244
- * to `Some`.
245
- */
246
- static from(value) {
247
- return isNonNullable(value) ? Optional.some(value) : Optional.none();
248
- }
249
- /**
250
- * Converts an `Optional` to a nullable type, by getting the value if it
251
- * exists, or returning `null` if it does not.
252
- */
253
- getOrNull() {
254
- return this.tag ? this.value : null;
255
- }
256
- /**
257
- * Converts an `Optional` to an undefined-able type, by getting the value if
258
- * it exists, or returning `undefined` if it does not.
259
- */
260
- getOrUndefined() {
261
- return this.value;
262
- }
263
- // --- Utilities ---
264
- /**
265
- * If the `Optional` contains a value, perform an action on that value.
266
- * Unlike the rest of the methods on this type, `.each` has side-effects. If
267
- * you want to transform an `Optional<T>` **into** something, then this is not
268
- * the method for you. If you want to use an `Optional<T>` to **do**
269
- * something, then this is the method for you - provided you're okay with not
270
- * doing anything in the case where the `Optional` doesn't have a value inside
271
- * it. If you're not sure whether your use-case fits into transforming
272
- * **into** something or **doing** something, check whether it has a return
273
- * value. If it does, you should be performing a transform.
274
- */
275
- each(worker) {
276
- if (this.tag) {
277
- worker(this.value);
278
- }
279
- }
280
- /**
281
- * Turn the `Optional` object into an array that contains all of the values
282
- * stored inside the `Optional`. In practice, this means the output will have
283
- * either 0 or 1 elements.
284
- */
285
- toArray() {
286
- return this.tag ? [this.value] : [];
287
- }
288
- /**
289
- * Turn the `Optional` object into a string for debugging or printing. Not
290
- * recommended for production code, but good for debugging. Also note that
291
- * these days an `Optional` object can be logged to the console directly, and
292
- * its inner value (if it exists) will be visible.
293
- */
294
- toString() {
295
- return this.tag ? `some(${this.value})` : 'none()';
296
- }
297
- }
298
- // Sneaky optimisation: every instance of Optional.none is identical, so just
299
- // reuse the same object
300
- Optional.singletonNone = new Optional(false);
301
-
302
- /**
303
- * Adds two numbers, and wrap to a range.
304
- * If the result overflows to the right, snap to the left.
305
- * If the result overflows to the left, snap to the right.
306
- */
307
- // the division is meant to get a number between 0 and 1 for more information check this discussion: https://stackoverflow.com/questions/58285941/how-to-replace-math-random-with-crypto-getrandomvalues-and-keep-same-result
308
- const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
78
+ const getTextSelectionToolbarItems = option('quickbars_selection_toolbar');
79
+ const getInsertToolbarItems = option('quickbars_insert_toolbar');
80
+ const getImageToolbarItems = option('quickbars_image_toolbar');
309
81
 
310
- /**
311
- * Generate a unique identifier.
312
- *
313
- * The unique portion of the identifier only contains an underscore
314
- * and digits, so that it may safely be used within HTML attributes.
315
- *
316
- * The chance of generating a non-unique identifier has been minimized
317
- * by combining the current time, a random number and a one-up counter.
318
- *
319
- * generate :: String -> String
320
- */
321
82
  let unique = 0;
322
- const generate = (prefix) => {
323
- const date = new Date();
324
- const time = date.getTime();
325
- const random$1 = Math.floor(random() * 1000000000);
326
- unique++;
327
- return prefix + '_' + random$1 + unique + String(time);
83
+ const generate = prefix => {
84
+ const date = new Date();
85
+ const time = date.getTime();
86
+ const random = Math.floor(Math.random() * 1000000000);
87
+ unique++;
88
+ return prefix + '_' + random + unique + String(time);
328
89
  };
329
90
 
330
91
  const insertTable = (editor, columns, rows) => {
331
- editor.execCommand('mceInsertTable', false, { rows, columns });
92
+ editor.execCommand('mceInsertTable', false, {
93
+ rows,
94
+ columns
95
+ });
332
96
  };
333
97
  const insertBlob = (editor, base64, blob) => {
334
- const blobCache = editor.editorUpload.blobCache;
335
- const blobInfo = blobCache.create(generate('mceu'), blob, base64);
336
- blobCache.add(blobInfo);
337
- editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
98
+ const blobCache = editor.editorUpload.blobCache;
99
+ const blobInfo = blobCache.create(generate('mceu'), blob, base64);
100
+ blobCache.add(blobInfo);
101
+ editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
338
102
  };
339
103
 
340
- const blobToBase64 = (blob) => {
341
- return new Promise((resolve) => {
342
- const reader = new FileReader();
343
- reader.onloadend = () => {
344
- resolve(reader.result.split(',')[1]);
345
- };
346
- reader.readAsDataURL(blob);
347
- });
104
+ const blobToBase64 = blob => {
105
+ return new Promise(resolve => {
106
+ const reader = new FileReader();
107
+ reader.onloadend = () => {
108
+ resolve(reader.result.split(',')[1]);
109
+ };
110
+ reader.readAsDataURL(blob);
111
+ });
348
112
  };
349
113
 
350
114
  var global = tinymce.util.Tools.resolve('tinymce.util.Delay');
351
115
 
352
- const pickFile = (editor) => new Promise((resolve) => {
353
- let resolved = false;
354
- const fileInput = document.createElement('input');
355
- fileInput.type = 'file';
356
- fileInput.accept = 'image/*';
357
- fileInput.style.position = 'fixed';
358
- fileInput.style.left = '0';
359
- fileInput.style.top = '0';
360
- fileInput.style.opacity = '0.001';
361
- document.body.appendChild(fileInput);
362
- const resolveFileInput = (value) => {
363
- var _a;
364
- if (!resolved) {
365
- (_a = fileInput.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(fileInput);
366
- resolved = true;
367
- resolve(value);
368
- }
369
- };
370
- const changeHandler = (e) => {
371
- resolveFileInput(Array.prototype.slice.call(e.target.files));
372
- };
373
- fileInput.addEventListener('input', changeHandler);
374
- fileInput.addEventListener('change', changeHandler);
375
- const cancelHandler = (e) => {
376
- const cleanup = () => {
377
- resolveFileInput([]);
378
- };
379
- if (!resolved) {
380
- if (e.type === 'focusin') {
381
- // Chrome will fire `focusin` before the input `change` event
382
- global.setEditorTimeout(editor, cleanup, 1000);
383
- }
384
- else {
385
- cleanup();
386
- }
387
- }
388
- editor.off('focusin remove', cancelHandler);
116
+ const pickFile = editor => new Promise(resolve => {
117
+ let resolved = false;
118
+ const fileInput = document.createElement('input');
119
+ fileInput.type = 'file';
120
+ fileInput.accept = 'image/*';
121
+ fileInput.style.position = 'fixed';
122
+ fileInput.style.left = '0';
123
+ fileInput.style.top = '0';
124
+ fileInput.style.opacity = '0.001';
125
+ document.body.appendChild(fileInput);
126
+ const resolveFileInput = value => {
127
+ var _a;
128
+ if (!resolved) {
129
+ (_a = fileInput.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(fileInput);
130
+ resolved = true;
131
+ resolve(value);
132
+ }
133
+ };
134
+ const changeHandler = e => {
135
+ resolveFileInput(Array.prototype.slice.call(e.target.files));
136
+ };
137
+ fileInput.addEventListener('input', changeHandler);
138
+ fileInput.addEventListener('change', changeHandler);
139
+ const cancelHandler = e => {
140
+ const cleanup = () => {
141
+ resolveFileInput([]);
389
142
  };
390
- editor.on('focusin remove', cancelHandler);
391
- fileInput.click();
143
+ if (!resolved) {
144
+ if (e.type === 'focusin') {
145
+ global.setEditorTimeout(editor, cleanup, 1000);
146
+ } else {
147
+ cleanup();
148
+ }
149
+ }
150
+ editor.off('focusin remove', cancelHandler);
151
+ };
152
+ editor.on('focusin remove', cancelHandler);
153
+ fileInput.click();
392
154
  });
393
155
 
394
- const register$1 = (editor) => {
395
- editor.on('PreInit', () => {
396
- if (!editor.queryCommandSupported('QuickbarInsertImage')) {
397
- editor.addCommand('QuickbarInsertImage', () => {
398
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
399
- pickFile(editor).then((files) => {
400
- if (files.length > 0) {
401
- const blob = files[0];
402
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
403
- blobToBase64(blob).then((base64) => {
404
- insertBlob(editor, base64, blob);
405
- });
406
- }
407
- });
408
- });
156
+ const setupButtons = editor => {
157
+ editor.ui.registry.addButton('quickimage', {
158
+ icon: 'image',
159
+ tooltip: 'Insert image',
160
+ onAction: () => {
161
+ pickFile(editor).then(files => {
162
+ if (files.length > 0) {
163
+ const blob = files[0];
164
+ blobToBase64(blob).then(base64 => {
165
+ insertBlob(editor, base64, blob);
166
+ });
409
167
  }
410
- });
168
+ });
169
+ }
170
+ });
171
+ editor.ui.registry.addButton('quicktable', {
172
+ icon: 'table',
173
+ tooltip: 'Insert table',
174
+ onAction: () => {
175
+ insertTable(editor, 2, 2);
176
+ }
177
+ });
411
178
  };
412
179
 
413
- const option = (name) => (editor) => editor.options.get(name);
414
- const register = (editor) => {
415
- const registerOption = editor.options.register;
416
- const toolbarProcessor = (defaultValue) => (value) => {
417
- const valid = isBoolean(value) || isString(value);
418
- if (valid) {
419
- if (isBoolean(value)) {
420
- return { value: value ? defaultValue : '', valid };
421
- }
422
- else {
423
- return { value: value.trim(), valid };
424
- }
425
- }
426
- else {
427
- return { valid: false, message: 'Must be a boolean or string.' };
428
- }
429
- };
430
- const defaultSelectionToolbar = 'bold italic | quicklink h2 h3 blockquote';
431
- registerOption('quickbars_selection_toolbar', {
432
- processor: toolbarProcessor(defaultSelectionToolbar),
433
- default: defaultSelectionToolbar
434
- });
435
- const defaultInsertToolbar = 'quickimage quicktable';
436
- registerOption('quickbars_insert_toolbar', {
437
- processor: toolbarProcessor(defaultInsertToolbar),
438
- default: defaultInsertToolbar
439
- });
440
- const defaultImageToolbar = 'alignleft aligncenter alignright';
441
- registerOption('quickbars_image_toolbar', {
442
- processor: toolbarProcessor(defaultImageToolbar),
443
- default: defaultImageToolbar
444
- });
180
+ const constant = value => {
181
+ return () => {
182
+ return value;
183
+ };
445
184
  };
446
- const getTextSelectionToolbarItems = option('quickbars_selection_toolbar');
447
- const getInsertToolbarItems = option('quickbars_insert_toolbar');
448
- const getImageToolbarItems = option('quickbars_image_toolbar');
185
+ const never = constant(false);
449
186
 
450
- const setupButtons = (editor) => {
451
- editor.ui.registry.addButton('quickimage', {
452
- icon: 'image',
453
- tooltip: 'Insert image',
454
- onAction: () => editor.execCommand('QuickbarInsertImage')
455
- });
456
- editor.ui.registry.addButton('quicktable', {
457
- icon: 'table',
458
- tooltip: 'Insert table',
459
- onAction: () => {
460
- insertTable(editor, 2, 2);
461
- }
462
- });
187
+ class Optional {
188
+ constructor(tag, value) {
189
+ this.tag = tag;
190
+ this.value = value;
191
+ }
192
+ static some(value) {
193
+ return new Optional(true, value);
194
+ }
195
+ static none() {
196
+ return Optional.singletonNone;
197
+ }
198
+ fold(onNone, onSome) {
199
+ if (this.tag) {
200
+ return onSome(this.value);
201
+ } else {
202
+ return onNone();
203
+ }
204
+ }
205
+ isSome() {
206
+ return this.tag;
207
+ }
208
+ isNone() {
209
+ return !this.tag;
210
+ }
211
+ map(mapper) {
212
+ if (this.tag) {
213
+ return Optional.some(mapper(this.value));
214
+ } else {
215
+ return Optional.none();
216
+ }
217
+ }
218
+ bind(binder) {
219
+ if (this.tag) {
220
+ return binder(this.value);
221
+ } else {
222
+ return Optional.none();
223
+ }
224
+ }
225
+ exists(predicate) {
226
+ return this.tag && predicate(this.value);
227
+ }
228
+ forall(predicate) {
229
+ return !this.tag || predicate(this.value);
230
+ }
231
+ filter(predicate) {
232
+ if (!this.tag || predicate(this.value)) {
233
+ return this;
234
+ } else {
235
+ return Optional.none();
236
+ }
237
+ }
238
+ getOr(replacement) {
239
+ return this.tag ? this.value : replacement;
240
+ }
241
+ or(replacement) {
242
+ return this.tag ? this : replacement;
243
+ }
244
+ getOrThunk(thunk) {
245
+ return this.tag ? this.value : thunk();
246
+ }
247
+ orThunk(thunk) {
248
+ return this.tag ? this : thunk();
249
+ }
250
+ getOrDie(message) {
251
+ if (!this.tag) {
252
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
253
+ } else {
254
+ return this.value;
255
+ }
256
+ }
257
+ static from(value) {
258
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
259
+ }
260
+ getOrNull() {
261
+ return this.tag ? this.value : null;
262
+ }
263
+ getOrUndefined() {
264
+ return this.value;
265
+ }
266
+ each(worker) {
267
+ if (this.tag) {
268
+ worker(this.value);
269
+ }
270
+ }
271
+ toArray() {
272
+ return this.tag ? [this.value] : [];
273
+ }
274
+ toString() {
275
+ return this.tag ? `some(${ this.value })` : 'none()';
276
+ }
277
+ }
278
+ Optional.singletonNone = new Optional(false);
279
+
280
+ typeof window !== 'undefined' ? window : Function('return this;')();
281
+
282
+ const ELEMENT = 1;
283
+
284
+ const name = element => {
285
+ const r = element.dom.nodeName;
286
+ return r.toLowerCase();
287
+ };
288
+
289
+ const has$1 = (element, key) => {
290
+ const dom = element.dom;
291
+ return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
292
+ };
293
+
294
+ var ClosestOrAncestor = (is, ancestor, scope, a, isRoot) => {
295
+ if (is(scope, a)) {
296
+ return Optional.some(scope);
297
+ } else if (isFunction(isRoot) && isRoot(scope)) {
298
+ return Optional.none();
299
+ } else {
300
+ return ancestor(scope, a, isRoot);
301
+ }
463
302
  };
464
303
 
465
304
  const fromHtml = (html, scope) => {
466
- const doc = scope || document;
467
- const div = doc.createElement('div');
468
- div.innerHTML = html;
469
- if (!div.hasChildNodes() || div.childNodes.length > 1) {
470
- const message = 'HTML does not have a single root node';
471
- // eslint-disable-next-line no-console
472
- console.error(message, html);
473
- throw new Error(message);
474
- }
475
- return fromDom(div.childNodes[0]);
305
+ const doc = scope || document;
306
+ const div = doc.createElement('div');
307
+ div.innerHTML = html;
308
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
309
+ const message = 'HTML does not have a single root node';
310
+ console.error(message, html);
311
+ throw new Error(message);
312
+ }
313
+ return fromDom(div.childNodes[0]);
476
314
  };
477
315
  const fromTag = (tag, scope) => {
478
- const doc = scope || document;
479
- const node = doc.createElement(tag);
480
- return fromDom(node);
316
+ const doc = scope || document;
317
+ const node = doc.createElement(tag);
318
+ return fromDom(node);
481
319
  };
482
320
  const fromText = (text, scope) => {
483
- const doc = scope || document;
484
- const node = doc.createTextNode(text);
485
- return fromDom(node);
321
+ const doc = scope || document;
322
+ const node = doc.createTextNode(text);
323
+ return fromDom(node);
486
324
  };
487
- const fromDom = (node) => {
488
- // TODO: Consider removing this check, but left atm for safety
489
- if (node === null || node === undefined) {
490
- throw new Error('Node cannot be null or undefined');
491
- }
492
- return {
493
- dom: node
494
- };
325
+ const fromDom = node => {
326
+ if (node === null || node === undefined) {
327
+ throw new Error('Node cannot be null or undefined');
328
+ }
329
+ return { dom: node };
495
330
  };
496
331
  const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
497
- // tslint:disable-next-line:variable-name
498
332
  const SugarElement = {
499
- fromHtml,
500
- fromTag,
501
- fromText,
502
- fromDom,
503
- fromPoint
333
+ fromHtml,
334
+ fromTag,
335
+ fromText,
336
+ fromDom,
337
+ fromPoint
504
338
  };
505
339
 
506
- const ELEMENT = 1;
507
-
508
340
  const is = (element, selector) => {
509
- const dom = element.dom;
510
- if (dom.nodeType !== ELEMENT) {
511
- return false;
512
- }
513
- else {
514
- const elem = dom;
515
- if (elem.matches !== undefined) {
516
- return elem.matches(selector);
517
- }
518
- else if (elem.msMatchesSelector !== undefined) {
519
- return elem.msMatchesSelector(selector);
520
- }
521
- else if (elem.webkitMatchesSelector !== undefined) {
522
- return elem.webkitMatchesSelector(selector);
523
- }
524
- else if (elem.mozMatchesSelector !== undefined) {
525
- // cast to any as mozMatchesSelector doesn't exist in TS DOM lib
526
- return elem.mozMatchesSelector(selector);
527
- }
528
- else {
529
- throw new Error('Browser lacks native selectors');
530
- } // unfortunately we can't throw this on startup :(
531
- }
341
+ const dom = element.dom;
342
+ if (dom.nodeType !== ELEMENT) {
343
+ return false;
344
+ } else {
345
+ const elem = dom;
346
+ if (elem.matches !== undefined) {
347
+ return elem.matches(selector);
348
+ } else if (elem.msMatchesSelector !== undefined) {
349
+ return elem.msMatchesSelector(selector);
350
+ } else if (elem.webkitMatchesSelector !== undefined) {
351
+ return elem.webkitMatchesSelector(selector);
352
+ } else if (elem.mozMatchesSelector !== undefined) {
353
+ return elem.mozMatchesSelector(selector);
354
+ } else {
355
+ throw new Error('Browser lacks native selectors');
356
+ }
357
+ }
532
358
  };
533
359
 
534
- const name = (element) => {
535
- const r = element.dom.nodeName;
536
- return r.toLowerCase();
360
+ const ancestor$1 = (scope, predicate, isRoot) => {
361
+ let element = scope.dom;
362
+ const stop = isFunction(isRoot) ? isRoot : never;
363
+ while (element.parentNode) {
364
+ element = element.parentNode;
365
+ const el = SugarElement.fromDom(element);
366
+ if (predicate(el)) {
367
+ return Optional.some(el);
368
+ } else if (stop(el)) {
369
+ break;
370
+ }
371
+ }
372
+ return Optional.none();
537
373
  };
538
-
539
- const has$1 = (element, key) => {
540
- const dom = element.dom;
541
- // return false for non-element nodes, no point in throwing an error
542
- return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
374
+ const closest$2 = (scope, predicate, isRoot) => {
375
+ const is = (s, test) => test(s);
376
+ return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);
543
377
  };
544
378
 
545
- var ClosestOrAncestor = (is, ancestor, scope, a, isRoot) => {
546
- if (is(scope, a)) {
547
- return Optional.some(scope);
548
- }
549
- else if (isFunction(isRoot) && isRoot(scope)) {
550
- return Optional.none();
551
- }
552
- else {
553
- return ancestor(scope, a, isRoot);
554
- }
555
- };
379
+ const closest$1 = (scope, predicate, isRoot) => closest$2(scope, predicate, isRoot).isSome();
556
380
 
557
- const ancestor$1 = (scope, predicate, isRoot) => {
558
- let element = scope.dom;
559
- const stop = isFunction(isRoot) ? isRoot : never;
560
- while (element.parentNode) {
561
- element = element.parentNode;
562
- const el = SugarElement.fromDom(element);
563
- if (predicate(el)) {
564
- return Optional.some(el);
565
- }
566
- else if (stop(el)) {
567
- break;
568
- }
569
- }
570
- return Optional.none();
571
- };
572
- const closest$2 = (scope, predicate, isRoot) => {
573
- // This is required to avoid ClosestOrAncestor passing the predicate to itself
574
- const is = (s, test) => test(s);
575
- return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);
381
+ const ancestor = (scope, selector, isRoot) => ancestor$1(scope, e => is(e, selector), isRoot);
382
+ const closest = (scope, selector, isRoot) => {
383
+ const is$1 = (element, selector) => is(element, selector);
384
+ return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);
576
385
  };
577
386
 
578
- const ancestor = (scope, selector, isRoot) => ancestor$1(scope, (e) => is(e, selector), isRoot);
579
- // Returns Some(closest ancestor element (sugared)) matching 'selector' up to isRoot, or None() otherwise
580
- const closest$1 = (scope, selector, isRoot) => {
581
- const is$1 = (element, selector) => is(element, selector);
582
- return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);
387
+ const addToEditor$1 = editor => {
388
+ const insertToolbarItems = getInsertToolbarItems(editor);
389
+ if (insertToolbarItems.length > 0) {
390
+ editor.ui.registry.addContextToolbar('quickblock', {
391
+ predicate: node => {
392
+ const sugarNode = SugarElement.fromDom(node);
393
+ const textBlockElementsMap = editor.schema.getTextBlockElements();
394
+ const isRoot = elem => elem.dom === editor.getBody();
395
+ return !has$1(sugarNode, 'data-mce-bogus') && closest(sugarNode, 'table,[data-mce-bogus="all"]', isRoot).fold(() => closest$1(sugarNode, elem => name(elem) in textBlockElementsMap && editor.dom.isEmpty(elem.dom), isRoot), never);
396
+ },
397
+ items: insertToolbarItems,
398
+ position: 'line',
399
+ scope: 'editor'
400
+ });
401
+ }
583
402
  };
584
403
 
585
- // IE11 Can return undefined for a classList on elements such as math, so we make sure it's not undefined before attempting to use it.
586
- const supports = (element) => element.dom.classList !== undefined;
404
+ const supports = element => element.dom.classList !== undefined;
587
405
 
588
406
  const has = (element, clazz) => supports(element) && element.dom.classList.contains(clazz);
589
407
 
590
- const closest = (scope, predicate, isRoot) => closest$2(scope, predicate, isRoot).isSome();
591
-
592
- const addToEditor$1 = (editor) => {
593
- const insertToolbarItems = getInsertToolbarItems(editor);
594
- if (insertToolbarItems.length > 0) {
595
- editor.ui.registry.addContextToolbar('quickblock', {
596
- predicate: (node) => {
597
- const sugarNode = SugarElement.fromDom(node);
598
- const textBlockElementsMap = editor.schema.getTextBlockElements();
599
- const isRoot = (elem) => elem.dom === editor.getBody();
600
- return !has$1(sugarNode, 'data-mce-bogus') && closest$1(sugarNode, 'table,[data-mce-bogus="all"]', isRoot).fold(() => closest(sugarNode, (elem) => name(elem) in textBlockElementsMap && editor.dom.isEmpty(elem.dom), isRoot), never);
601
- },
602
- items: insertToolbarItems,
603
- position: 'line',
604
- scope: 'editor'
605
- });
606
- }
607
- };
608
-
609
- const addToEditor = (editor) => {
610
- const isEditable = (node) => editor.dom.isEditable(node);
611
- const isInEditableContext = (el) => isEditable(el.parentElement);
612
- const isImage = (node) => {
613
- const isImageFigure = node.nodeName === 'FIGURE' && /image/i.test(node.className);
614
- const isImage = node.nodeName === 'IMG' || isImageFigure;
615
- const isPagebreak = has(SugarElement.fromDom(node), 'mce-pagebreak');
616
- return isImage && isInEditableContext(node) && !isPagebreak;
617
- };
618
- const imageToolbarItems = getImageToolbarItems(editor);
619
- if (imageToolbarItems.length > 0) {
620
- editor.ui.registry.addContextToolbar('imageselection', {
621
- predicate: isImage,
622
- items: imageToolbarItems,
623
- position: 'node'
624
- });
625
- }
626
- const textToolbarItems = getTextSelectionToolbarItems(editor);
627
- if (textToolbarItems.length > 0) {
628
- editor.ui.registry.addContextToolbar('textselection', {
629
- predicate: (node) => !isImage(node) && !editor.selection.isCollapsed() && isEditable(node),
630
- items: textToolbarItems,
631
- position: 'selection',
632
- scope: 'editor'
633
- });
634
- }
408
+ const addToEditor = editor => {
409
+ const isEditable = node => editor.dom.isEditable(node);
410
+ const isInEditableContext = el => isEditable(el.parentElement);
411
+ const isImage = node => {
412
+ const isImageFigure = node.nodeName === 'FIGURE' && /image/i.test(node.className);
413
+ const isImage = node.nodeName === 'IMG' || isImageFigure;
414
+ const isPagebreak = has(SugarElement.fromDom(node), 'mce-pagebreak');
415
+ return isImage && isInEditableContext(node) && !isPagebreak;
416
+ };
417
+ const imageToolbarItems = getImageToolbarItems(editor);
418
+ if (imageToolbarItems.length > 0) {
419
+ editor.ui.registry.addContextToolbar('imageselection', {
420
+ predicate: isImage,
421
+ items: imageToolbarItems,
422
+ position: 'node'
423
+ });
424
+ }
425
+ const textToolbarItems = getTextSelectionToolbarItems(editor);
426
+ if (textToolbarItems.length > 0) {
427
+ editor.ui.registry.addContextToolbar('textselection', {
428
+ predicate: node => !isImage(node) && !editor.selection.isCollapsed() && isEditable(node),
429
+ items: textToolbarItems,
430
+ position: 'selection',
431
+ scope: 'editor'
432
+ });
433
+ }
635
434
  };
636
435
 
637
436
  var Plugin = () => {
638
- global$1.add('quickbars', (editor) => {
639
- register(editor);
640
- register$1(editor);
641
- setupButtons(editor);
642
- addToEditor$1(editor);
643
- addToEditor(editor);
644
- });
437
+ global$1.add('quickbars', editor => {
438
+ register(editor);
439
+ setupButtons(editor);
440
+ addToEditor$1(editor);
441
+ addToEditor(editor);
442
+ });
645
443
  };
646
444
 
647
445
  Plugin();
648
- /** *****
649
- * DO NOT EXPORT ANYTHING
650
- *
651
- * IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
652
- *******/
653
446
 
654
447
  })();