fx-platform-ui 0.0.13-alpha15 → 0.0.13-alpha17
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/lib/fx-platform-ui.mjs +65333 -32078
- package/lib/fx-platform-ui.umd.js +113 -69
- package/lib/packages/components/area/src/index.vue.d.ts +2 -2
- package/lib/packages/components/confirm/index.d.ts +2 -0
- package/lib/packages/components/confirm/src/confirm.vue.d.ts +2 -0
- package/lib/packages/components/confirm/src/index.d.ts +2 -0
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/.DS_Store +0 -0
- package/packages/component.ts +3 -2
- package/packages/components/confirm/index.ts +9 -0
- package/packages/components/confirm/src/confirm.vue +75 -0
- package/packages/components/confirm/src/index.module.less +61 -0
- package/packages/components/confirm/src/index.tsx +91 -0
- package/packages/components/confirm/src/plat-confirm-props.ts +40 -0
- package/packages/components/editor/src/index.vue +22 -21
- package/packages/components/table/src/hook/useTableMethods.tsx +1 -1
- package/packages/components/table/src/plat-table-emits.ts +1 -1
- package/CHANGELOG.md +0 -46
- package/lib/tinymce/CHANGELOG.md +0 -2957
- package/lib/tinymce/README.md +0 -71
- package/lib/tinymce/bower.json +0 -27
- package/lib/tinymce/composer.json +0 -52
- package/lib/tinymce/icons/default/icons.js +0 -182
- package/lib/tinymce/icons/default/icons.min.js +0 -1
- package/lib/tinymce/icons/default/index.js +0 -7
- package/lib/tinymce/license.txt +0 -21
- package/lib/tinymce/models/dom/index.js +0 -7
- package/lib/tinymce/models/dom/model.js +0 -7975
- package/lib/tinymce/models/dom/model.min.js +0 -4
- package/lib/tinymce/package.json +0 -32
- package/lib/tinymce/plugins/advlist/index.js +0 -7
- package/lib/tinymce/plugins/advlist/plugin.js +0 -246
- package/lib/tinymce/plugins/advlist/plugin.min.js +0 -4
- package/lib/tinymce/plugins/anchor/index.js +0 -7
- package/lib/tinymce/plugins/anchor/plugin.js +0 -195
- package/lib/tinymce/plugins/anchor/plugin.min.js +0 -4
- package/lib/tinymce/plugins/autolink/index.js +0 -7
- package/lib/tinymce/plugins/autolink/plugin.js +0 -232
- package/lib/tinymce/plugins/autolink/plugin.min.js +0 -4
- package/lib/tinymce/plugins/autoresize/index.js +0 -7
- package/lib/tinymce/plugins/autoresize/plugin.js +0 -156
- package/lib/tinymce/plugins/autoresize/plugin.min.js +0 -4
- package/lib/tinymce/plugins/autosave/index.js +0 -7
- package/lib/tinymce/plugins/autosave/plugin.js +0 -232
- package/lib/tinymce/plugins/autosave/plugin.min.js +0 -4
- package/lib/tinymce/plugins/charmap/index.js +0 -7
- package/lib/tinymce/plugins/charmap/plugin.js +0 -1636
- package/lib/tinymce/plugins/charmap/plugin.min.js +0 -4
- package/lib/tinymce/plugins/code/index.js +0 -7
- package/lib/tinymce/plugins/code/plugin.js +0 -85
- package/lib/tinymce/plugins/code/plugin.min.js +0 -4
- package/lib/tinymce/plugins/codesample/index.js +0 -7
- package/lib/tinymce/plugins/codesample/plugin.js +0 -2451
- package/lib/tinymce/plugins/codesample/plugin.min.js +0 -4
- package/lib/tinymce/plugins/directionality/index.js +0 -7
- package/lib/tinymce/plugins/directionality/plugin.js +0 -384
- package/lib/tinymce/plugins/directionality/plugin.min.js +0 -4
- package/lib/tinymce/plugins/emoticons/index.js +0 -7
- package/lib/tinymce/plugins/emoticons/js/emojiimages.js +0 -1
- package/lib/tinymce/plugins/emoticons/js/emojiimages.min.js +0 -3
- package/lib/tinymce/plugins/emoticons/js/emojis.js +0 -1
- package/lib/tinymce/plugins/emoticons/js/emojis.min.js +0 -2
- package/lib/tinymce/plugins/emoticons/plugin.js +0 -577
- package/lib/tinymce/plugins/emoticons/plugin.min.js +0 -4
- package/lib/tinymce/plugins/fullscreen/index.js +0 -7
- package/lib/tinymce/plugins/fullscreen/plugin.js +0 -1190
- package/lib/tinymce/plugins/fullscreen/plugin.min.js +0 -4
- package/lib/tinymce/plugins/help/index.js +0 -7
- package/lib/tinymce/plugins/help/plugin.js +0 -848
- package/lib/tinymce/plugins/help/plugin.min.js +0 -4
- package/lib/tinymce/plugins/image/index.js +0 -7
- package/lib/tinymce/plugins/image/plugin.js +0 -1475
- package/lib/tinymce/plugins/image/plugin.min.js +0 -4
- package/lib/tinymce/plugins/importcss/index.js +0 -7
- package/lib/tinymce/plugins/importcss/plugin.js +0 -342
- package/lib/tinymce/plugins/importcss/plugin.min.js +0 -4
- package/lib/tinymce/plugins/insertdatetime/index.js +0 -7
- package/lib/tinymce/plugins/insertdatetime/plugin.js +0 -176
- package/lib/tinymce/plugins/insertdatetime/plugin.min.js +0 -4
- package/lib/tinymce/plugins/link/index.js +0 -7
- package/lib/tinymce/plugins/link/plugin.js +0 -1190
- package/lib/tinymce/plugins/link/plugin.min.js +0 -4
- package/lib/tinymce/plugins/lists/index.js +0 -7
- package/lib/tinymce/plugins/lists/plugin.js +0 -1820
- package/lib/tinymce/plugins/lists/plugin.min.js +0 -4
- package/lib/tinymce/plugins/media/index.js +0 -7
- package/lib/tinymce/plugins/media/plugin.js +0 -1157
- package/lib/tinymce/plugins/media/plugin.min.js +0 -4
- package/lib/tinymce/plugins/nonbreaking/index.js +0 -7
- package/lib/tinymce/plugins/nonbreaking/plugin.js +0 -111
- package/lib/tinymce/plugins/nonbreaking/plugin.min.js +0 -4
- package/lib/tinymce/plugins/pagebreak/index.js +0 -7
- package/lib/tinymce/plugins/pagebreak/plugin.js +0 -105
- package/lib/tinymce/plugins/pagebreak/plugin.min.js +0 -4
- package/lib/tinymce/plugins/preview/index.js +0 -7
- package/lib/tinymce/plugins/preview/plugin.js +0 -97
- package/lib/tinymce/plugins/preview/plugin.min.js +0 -4
- package/lib/tinymce/plugins/quickbars/index.js +0 -7
- package/lib/tinymce/plugins/quickbars/plugin.js +0 -421
- package/lib/tinymce/plugins/quickbars/plugin.min.js +0 -4
- package/lib/tinymce/plugins/save/index.js +0 -7
- package/lib/tinymce/plugins/save/plugin.js +0 -118
- package/lib/tinymce/plugins/save/plugin.min.js +0 -4
- package/lib/tinymce/plugins/searchreplace/index.js +0 -7
- package/lib/tinymce/plugins/searchreplace/plugin.js +0 -1079
- package/lib/tinymce/plugins/searchreplace/plugin.min.js +0 -4
- package/lib/tinymce/plugins/table/index.js +0 -7
- package/lib/tinymce/plugins/table/plugin.js +0 -3393
- package/lib/tinymce/plugins/table/plugin.min.js +0 -4
- package/lib/tinymce/plugins/template/index.js +0 -7
- package/lib/tinymce/plugins/template/plugin.js +0 -548
- package/lib/tinymce/plugins/template/plugin.min.js +0 -4
- package/lib/tinymce/plugins/visualblocks/index.js +0 -7
- package/lib/tinymce/plugins/visualblocks/plugin.js +0 -98
- package/lib/tinymce/plugins/visualblocks/plugin.min.js +0 -4
- package/lib/tinymce/plugins/visualchars/index.js +0 -7
- package/lib/tinymce/plugins/visualchars/plugin.js +0 -506
- package/lib/tinymce/plugins/visualchars/plugin.min.js +0 -4
- package/lib/tinymce/plugins/wordcount/index.js +0 -7
- package/lib/tinymce/plugins/wordcount/plugin.js +0 -404
- package/lib/tinymce/plugins/wordcount/plugin.min.js +0 -4
- package/lib/tinymce/themes/silver/index.js +0 -7
- package/lib/tinymce/themes/silver/theme.js +0 -26184
- package/lib/tinymce/themes/silver/theme.min.js +0 -4
- package/lib/tinymce/tinymce.d.ts +0 -2895
- package/lib/tinymce/tinymce.js +0 -29400
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TinyMCE version 6.1.2 (2022-07-29)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
(function () {
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
|
-
|
|
10
|
-
const eq = t => a => t === a;
|
|
11
|
-
const isNull = eq(null);
|
|
12
|
-
const isNullable = a => a === null || a === undefined;
|
|
13
|
-
const isNonNullable = a => !isNullable(a);
|
|
14
|
-
|
|
15
|
-
const noop = () => {
|
|
16
|
-
};
|
|
17
|
-
const constant = value => {
|
|
18
|
-
return () => {
|
|
19
|
-
return value;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
const never = constant(false);
|
|
23
|
-
|
|
24
|
-
class Optional {
|
|
25
|
-
constructor(tag, value) {
|
|
26
|
-
this.tag = tag;
|
|
27
|
-
this.value = value;
|
|
28
|
-
}
|
|
29
|
-
static some(value) {
|
|
30
|
-
return new Optional(true, value);
|
|
31
|
-
}
|
|
32
|
-
static none() {
|
|
33
|
-
return Optional.singletonNone;
|
|
34
|
-
}
|
|
35
|
-
fold(onNone, onSome) {
|
|
36
|
-
if (this.tag) {
|
|
37
|
-
return onSome(this.value);
|
|
38
|
-
} else {
|
|
39
|
-
return onNone();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
isSome() {
|
|
43
|
-
return this.tag;
|
|
44
|
-
}
|
|
45
|
-
isNone() {
|
|
46
|
-
return !this.tag;
|
|
47
|
-
}
|
|
48
|
-
map(mapper) {
|
|
49
|
-
if (this.tag) {
|
|
50
|
-
return Optional.some(mapper(this.value));
|
|
51
|
-
} else {
|
|
52
|
-
return Optional.none();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
bind(binder) {
|
|
56
|
-
if (this.tag) {
|
|
57
|
-
return binder(this.value);
|
|
58
|
-
} else {
|
|
59
|
-
return Optional.none();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exists(predicate) {
|
|
63
|
-
return this.tag && predicate(this.value);
|
|
64
|
-
}
|
|
65
|
-
forall(predicate) {
|
|
66
|
-
return !this.tag || predicate(this.value);
|
|
67
|
-
}
|
|
68
|
-
filter(predicate) {
|
|
69
|
-
if (!this.tag || predicate(this.value)) {
|
|
70
|
-
return this;
|
|
71
|
-
} else {
|
|
72
|
-
return Optional.none();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
getOr(replacement) {
|
|
76
|
-
return this.tag ? this.value : replacement;
|
|
77
|
-
}
|
|
78
|
-
or(replacement) {
|
|
79
|
-
return this.tag ? this : replacement;
|
|
80
|
-
}
|
|
81
|
-
getOrThunk(thunk) {
|
|
82
|
-
return this.tag ? this.value : thunk();
|
|
83
|
-
}
|
|
84
|
-
orThunk(thunk) {
|
|
85
|
-
return this.tag ? this : thunk();
|
|
86
|
-
}
|
|
87
|
-
getOrDie(message) {
|
|
88
|
-
if (!this.tag) {
|
|
89
|
-
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
90
|
-
} else {
|
|
91
|
-
return this.value;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
static from(value) {
|
|
95
|
-
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
96
|
-
}
|
|
97
|
-
getOrNull() {
|
|
98
|
-
return this.tag ? this.value : null;
|
|
99
|
-
}
|
|
100
|
-
getOrUndefined() {
|
|
101
|
-
return this.value;
|
|
102
|
-
}
|
|
103
|
-
each(worker) {
|
|
104
|
-
if (this.tag) {
|
|
105
|
-
worker(this.value);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
toArray() {
|
|
109
|
-
return this.tag ? [this.value] : [];
|
|
110
|
-
}
|
|
111
|
-
toString() {
|
|
112
|
-
return this.tag ? `some(${ this.value })` : 'none()';
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
Optional.singletonNone = new Optional(false);
|
|
116
|
-
|
|
117
|
-
const exists = (xs, pred) => {
|
|
118
|
-
for (let i = 0, len = xs.length; i < len; i++) {
|
|
119
|
-
const x = xs[i];
|
|
120
|
-
if (pred(x, i)) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
const map$1 = (xs, f) => {
|
|
127
|
-
const len = xs.length;
|
|
128
|
-
const r = new Array(len);
|
|
129
|
-
for (let i = 0; i < len; i++) {
|
|
130
|
-
const x = xs[i];
|
|
131
|
-
r[i] = f(x, i);
|
|
132
|
-
}
|
|
133
|
-
return r;
|
|
134
|
-
};
|
|
135
|
-
const each$1 = (xs, f) => {
|
|
136
|
-
for (let i = 0, len = xs.length; i < len; i++) {
|
|
137
|
-
const x = xs[i];
|
|
138
|
-
f(x, i);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const Cell = initial => {
|
|
143
|
-
let value = initial;
|
|
144
|
-
const get = () => {
|
|
145
|
-
return value;
|
|
146
|
-
};
|
|
147
|
-
const set = v => {
|
|
148
|
-
value = v;
|
|
149
|
-
};
|
|
150
|
-
return {
|
|
151
|
-
get,
|
|
152
|
-
set
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const last = (fn, rate) => {
|
|
157
|
-
let timer = null;
|
|
158
|
-
const cancel = () => {
|
|
159
|
-
if (!isNull(timer)) {
|
|
160
|
-
clearTimeout(timer);
|
|
161
|
-
timer = null;
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const throttle = (...args) => {
|
|
165
|
-
cancel();
|
|
166
|
-
timer = setTimeout(() => {
|
|
167
|
-
timer = null;
|
|
168
|
-
fn.apply(null, args);
|
|
169
|
-
}, rate);
|
|
170
|
-
};
|
|
171
|
-
return {
|
|
172
|
-
cancel,
|
|
173
|
-
throttle
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const insertEmoticon = (editor, ch) => {
|
|
178
|
-
editor.insertContent(ch);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const keys = Object.keys;
|
|
182
|
-
const hasOwnProperty = Object.hasOwnProperty;
|
|
183
|
-
const each = (obj, f) => {
|
|
184
|
-
const props = keys(obj);
|
|
185
|
-
for (let k = 0, len = props.length; k < len; k++) {
|
|
186
|
-
const i = props[k];
|
|
187
|
-
const x = obj[i];
|
|
188
|
-
f(x, i);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const map = (obj, f) => {
|
|
192
|
-
return tupleMap(obj, (x, i) => ({
|
|
193
|
-
k: i,
|
|
194
|
-
v: f(x, i)
|
|
195
|
-
}));
|
|
196
|
-
};
|
|
197
|
-
const tupleMap = (obj, f) => {
|
|
198
|
-
const r = {};
|
|
199
|
-
each(obj, (x, i) => {
|
|
200
|
-
const tuple = f(x, i);
|
|
201
|
-
r[tuple.k] = tuple.v;
|
|
202
|
-
});
|
|
203
|
-
return r;
|
|
204
|
-
};
|
|
205
|
-
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
206
|
-
|
|
207
|
-
const shallow = (old, nu) => {
|
|
208
|
-
return nu;
|
|
209
|
-
};
|
|
210
|
-
const baseMerge = merger => {
|
|
211
|
-
return (...objects) => {
|
|
212
|
-
if (objects.length === 0) {
|
|
213
|
-
throw new Error(`Can't merge zero objects`);
|
|
214
|
-
}
|
|
215
|
-
const ret = {};
|
|
216
|
-
for (let j = 0; j < objects.length; j++) {
|
|
217
|
-
const curObject = objects[j];
|
|
218
|
-
for (const key in curObject) {
|
|
219
|
-
if (has(curObject, key)) {
|
|
220
|
-
ret[key] = merger(ret[key], curObject[key]);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return ret;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
const merge = baseMerge(shallow);
|
|
228
|
-
|
|
229
|
-
const singleton = doRevoke => {
|
|
230
|
-
const subject = Cell(Optional.none());
|
|
231
|
-
const revoke = () => subject.get().each(doRevoke);
|
|
232
|
-
const clear = () => {
|
|
233
|
-
revoke();
|
|
234
|
-
subject.set(Optional.none());
|
|
235
|
-
};
|
|
236
|
-
const isSet = () => subject.get().isSome();
|
|
237
|
-
const get = () => subject.get();
|
|
238
|
-
const set = s => {
|
|
239
|
-
revoke();
|
|
240
|
-
subject.set(Optional.some(s));
|
|
241
|
-
};
|
|
242
|
-
return {
|
|
243
|
-
clear,
|
|
244
|
-
isSet,
|
|
245
|
-
get,
|
|
246
|
-
set
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
|
-
const value = () => {
|
|
250
|
-
const subject = singleton(noop);
|
|
251
|
-
const on = f => subject.get().each(f);
|
|
252
|
-
return {
|
|
253
|
-
...subject,
|
|
254
|
-
on
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
|
259
|
-
const contains = (str, substr) => {
|
|
260
|
-
return str.indexOf(substr) !== -1;
|
|
261
|
-
};
|
|
262
|
-
const startsWith = (str, prefix) => {
|
|
263
|
-
return checkRange(str, prefix, 0);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
var global = tinymce.util.Tools.resolve('tinymce.Resource');
|
|
267
|
-
|
|
268
|
-
const DEFAULT_ID = 'tinymce.plugins.emoticons';
|
|
269
|
-
const option = name => editor => editor.options.get(name);
|
|
270
|
-
const register$2 = (editor, pluginUrl) => {
|
|
271
|
-
const registerOption = editor.options.register;
|
|
272
|
-
registerOption('emoticons_database', {
|
|
273
|
-
processor: 'string',
|
|
274
|
-
default: 'emojis'
|
|
275
|
-
});
|
|
276
|
-
registerOption('emoticons_database_url', {
|
|
277
|
-
processor: 'string',
|
|
278
|
-
default: `${ pluginUrl }/js/${ getEmojiDatabase(editor) }${ editor.suffix }.js`
|
|
279
|
-
});
|
|
280
|
-
registerOption('emoticons_database_id', {
|
|
281
|
-
processor: 'string',
|
|
282
|
-
default: DEFAULT_ID
|
|
283
|
-
});
|
|
284
|
-
registerOption('emoticons_append', {
|
|
285
|
-
processor: 'object',
|
|
286
|
-
default: {}
|
|
287
|
-
});
|
|
288
|
-
registerOption('emoticons_images_url', {
|
|
289
|
-
processor: 'string',
|
|
290
|
-
default: 'https://twemoji.maxcdn.com/v/13.0.1/72x72/'
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
const getEmojiDatabase = option('emoticons_database');
|
|
294
|
-
const getEmojiDatabaseUrl = option('emoticons_database_url');
|
|
295
|
-
const getEmojiDatabaseId = option('emoticons_database_id');
|
|
296
|
-
const getAppendedEmoji = option('emoticons_append');
|
|
297
|
-
const getEmojiImageUrl = option('emoticons_images_url');
|
|
298
|
-
|
|
299
|
-
const ALL_CATEGORY = 'All';
|
|
300
|
-
const categoryNameMap = {
|
|
301
|
-
symbols: 'Symbols',
|
|
302
|
-
people: 'People',
|
|
303
|
-
animals_and_nature: 'Animals and Nature',
|
|
304
|
-
food_and_drink: 'Food and Drink',
|
|
305
|
-
activity: 'Activity',
|
|
306
|
-
travel_and_places: 'Travel and Places',
|
|
307
|
-
objects: 'Objects',
|
|
308
|
-
flags: 'Flags',
|
|
309
|
-
user: 'User Defined'
|
|
310
|
-
};
|
|
311
|
-
const translateCategory = (categories, name) => has(categories, name) ? categories[name] : name;
|
|
312
|
-
const getUserDefinedEmoji = editor => {
|
|
313
|
-
const userDefinedEmoticons = getAppendedEmoji(editor);
|
|
314
|
-
return map(userDefinedEmoticons, value => ({
|
|
315
|
-
keywords: [],
|
|
316
|
-
category: 'user',
|
|
317
|
-
...value
|
|
318
|
-
}));
|
|
319
|
-
};
|
|
320
|
-
const initDatabase = (editor, databaseUrl, databaseId) => {
|
|
321
|
-
const categories = value();
|
|
322
|
-
const all = value();
|
|
323
|
-
const emojiImagesUrl = getEmojiImageUrl(editor);
|
|
324
|
-
const getEmoji = lib => {
|
|
325
|
-
if (startsWith(lib.char, '<img')) {
|
|
326
|
-
return lib.char.replace(/src="([^"]+)"/, (match, url) => `src="${ emojiImagesUrl }${ url }"`);
|
|
327
|
-
} else {
|
|
328
|
-
return lib.char;
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const processEmojis = emojis => {
|
|
332
|
-
const cats = {};
|
|
333
|
-
const everything = [];
|
|
334
|
-
each(emojis, (lib, title) => {
|
|
335
|
-
const entry = {
|
|
336
|
-
title,
|
|
337
|
-
keywords: lib.keywords,
|
|
338
|
-
char: getEmoji(lib),
|
|
339
|
-
category: translateCategory(categoryNameMap, lib.category)
|
|
340
|
-
};
|
|
341
|
-
const current = cats[entry.category] !== undefined ? cats[entry.category] : [];
|
|
342
|
-
cats[entry.category] = current.concat([entry]);
|
|
343
|
-
everything.push(entry);
|
|
344
|
-
});
|
|
345
|
-
categories.set(cats);
|
|
346
|
-
all.set(everything);
|
|
347
|
-
};
|
|
348
|
-
editor.on('init', () => {
|
|
349
|
-
global.load(databaseId, databaseUrl).then(emojis => {
|
|
350
|
-
const userEmojis = getUserDefinedEmoji(editor);
|
|
351
|
-
processEmojis(merge(emojis, userEmojis));
|
|
352
|
-
}, err => {
|
|
353
|
-
console.log(`Failed to load emojis: ${ err }`);
|
|
354
|
-
categories.set({});
|
|
355
|
-
all.set([]);
|
|
356
|
-
});
|
|
357
|
-
});
|
|
358
|
-
const listCategory = category => {
|
|
359
|
-
if (category === ALL_CATEGORY) {
|
|
360
|
-
return listAll();
|
|
361
|
-
}
|
|
362
|
-
return categories.get().bind(cats => Optional.from(cats[category])).getOr([]);
|
|
363
|
-
};
|
|
364
|
-
const listAll = () => all.get().getOr([]);
|
|
365
|
-
const listCategories = () => [ALL_CATEGORY].concat(keys(categories.get().getOr({})));
|
|
366
|
-
const waitForLoad = () => {
|
|
367
|
-
if (hasLoaded()) {
|
|
368
|
-
return Promise.resolve(true);
|
|
369
|
-
} else {
|
|
370
|
-
return new Promise((resolve, reject) => {
|
|
371
|
-
let numRetries = 15;
|
|
372
|
-
const interval = setInterval(() => {
|
|
373
|
-
if (hasLoaded()) {
|
|
374
|
-
clearInterval(interval);
|
|
375
|
-
resolve(true);
|
|
376
|
-
} else {
|
|
377
|
-
numRetries--;
|
|
378
|
-
if (numRetries < 0) {
|
|
379
|
-
console.log('Could not load emojis from url: ' + databaseUrl);
|
|
380
|
-
clearInterval(interval);
|
|
381
|
-
reject(false);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}, 100);
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
const hasLoaded = () => categories.isSet() && all.isSet();
|
|
389
|
-
return {
|
|
390
|
-
listCategories,
|
|
391
|
-
hasLoaded,
|
|
392
|
-
waitForLoad,
|
|
393
|
-
listAll,
|
|
394
|
-
listCategory
|
|
395
|
-
};
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
const emojiMatches = (emoji, lowerCasePattern) => contains(emoji.title.toLowerCase(), lowerCasePattern) || exists(emoji.keywords, k => contains(k.toLowerCase(), lowerCasePattern));
|
|
399
|
-
const emojisFrom = (list, pattern, maxResults) => {
|
|
400
|
-
const matches = [];
|
|
401
|
-
const lowerCasePattern = pattern.toLowerCase();
|
|
402
|
-
const reachedLimit = maxResults.fold(() => never, max => size => size >= max);
|
|
403
|
-
for (let i = 0; i < list.length; i++) {
|
|
404
|
-
if (pattern.length === 0 || emojiMatches(list[i], lowerCasePattern)) {
|
|
405
|
-
matches.push({
|
|
406
|
-
value: list[i].char,
|
|
407
|
-
text: list[i].title,
|
|
408
|
-
icon: list[i].char
|
|
409
|
-
});
|
|
410
|
-
if (reachedLimit(matches.length)) {
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
return matches;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
const patternName = 'pattern';
|
|
419
|
-
const open = (editor, database) => {
|
|
420
|
-
const initialState = {
|
|
421
|
-
pattern: '',
|
|
422
|
-
results: emojisFrom(database.listAll(), '', Optional.some(300))
|
|
423
|
-
};
|
|
424
|
-
const currentTab = Cell(ALL_CATEGORY);
|
|
425
|
-
const scan = dialogApi => {
|
|
426
|
-
const dialogData = dialogApi.getData();
|
|
427
|
-
const category = currentTab.get();
|
|
428
|
-
const candidates = database.listCategory(category);
|
|
429
|
-
const results = emojisFrom(candidates, dialogData[patternName], category === ALL_CATEGORY ? Optional.some(300) : Optional.none());
|
|
430
|
-
dialogApi.setData({ results });
|
|
431
|
-
};
|
|
432
|
-
const updateFilter = last(dialogApi => {
|
|
433
|
-
scan(dialogApi);
|
|
434
|
-
}, 200);
|
|
435
|
-
const searchField = {
|
|
436
|
-
label: 'Search',
|
|
437
|
-
type: 'input',
|
|
438
|
-
name: patternName
|
|
439
|
-
};
|
|
440
|
-
const resultsField = {
|
|
441
|
-
type: 'collection',
|
|
442
|
-
name: 'results'
|
|
443
|
-
};
|
|
444
|
-
const getInitialState = () => {
|
|
445
|
-
const body = {
|
|
446
|
-
type: 'tabpanel',
|
|
447
|
-
tabs: map$1(database.listCategories(), cat => ({
|
|
448
|
-
title: cat,
|
|
449
|
-
name: cat,
|
|
450
|
-
items: [
|
|
451
|
-
searchField,
|
|
452
|
-
resultsField
|
|
453
|
-
]
|
|
454
|
-
}))
|
|
455
|
-
};
|
|
456
|
-
return {
|
|
457
|
-
title: 'Emojis',
|
|
458
|
-
size: 'normal',
|
|
459
|
-
body,
|
|
460
|
-
initialData: initialState,
|
|
461
|
-
onTabChange: (dialogApi, details) => {
|
|
462
|
-
currentTab.set(details.newTabName);
|
|
463
|
-
updateFilter.throttle(dialogApi);
|
|
464
|
-
},
|
|
465
|
-
onChange: updateFilter.throttle,
|
|
466
|
-
onAction: (dialogApi, actionData) => {
|
|
467
|
-
if (actionData.name === 'results') {
|
|
468
|
-
insertEmoticon(editor, actionData.value);
|
|
469
|
-
dialogApi.close();
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
buttons: [{
|
|
473
|
-
type: 'cancel',
|
|
474
|
-
text: 'Close',
|
|
475
|
-
primary: true
|
|
476
|
-
}]
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
const dialogApi = editor.windowManager.open(getInitialState());
|
|
480
|
-
dialogApi.focus(patternName);
|
|
481
|
-
if (!database.hasLoaded()) {
|
|
482
|
-
dialogApi.block('Loading emojis...');
|
|
483
|
-
database.waitForLoad().then(() => {
|
|
484
|
-
dialogApi.redial(getInitialState());
|
|
485
|
-
updateFilter.throttle(dialogApi);
|
|
486
|
-
dialogApi.focus(patternName);
|
|
487
|
-
dialogApi.unblock();
|
|
488
|
-
}).catch(_err => {
|
|
489
|
-
dialogApi.redial({
|
|
490
|
-
title: 'Emojis',
|
|
491
|
-
body: {
|
|
492
|
-
type: 'panel',
|
|
493
|
-
items: [{
|
|
494
|
-
type: 'alertbanner',
|
|
495
|
-
level: 'error',
|
|
496
|
-
icon: 'warning',
|
|
497
|
-
text: 'Could not load emojis'
|
|
498
|
-
}]
|
|
499
|
-
},
|
|
500
|
-
buttons: [{
|
|
501
|
-
type: 'cancel',
|
|
502
|
-
text: 'Close',
|
|
503
|
-
primary: true
|
|
504
|
-
}],
|
|
505
|
-
initialData: {
|
|
506
|
-
pattern: '',
|
|
507
|
-
results: []
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
dialogApi.focus(patternName);
|
|
511
|
-
dialogApi.unblock();
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
const register$1 = (editor, database) => {
|
|
517
|
-
editor.addCommand('mceEmoticons', () => open(editor, database));
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
const setup = editor => {
|
|
521
|
-
editor.on('PreInit', () => {
|
|
522
|
-
editor.parser.addAttributeFilter('data-emoticon', nodes => {
|
|
523
|
-
each$1(nodes, node => {
|
|
524
|
-
node.attr('data-mce-resize', 'false');
|
|
525
|
-
node.attr('data-mce-placeholder', '1');
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
const init = (editor, database) => {
|
|
532
|
-
editor.ui.registry.addAutocompleter('emoticons', {
|
|
533
|
-
ch: ':',
|
|
534
|
-
columns: 'auto',
|
|
535
|
-
minChars: 2,
|
|
536
|
-
fetch: (pattern, maxResults) => database.waitForLoad().then(() => {
|
|
537
|
-
const candidates = database.listAll();
|
|
538
|
-
return emojisFrom(candidates, pattern, Optional.some(maxResults));
|
|
539
|
-
}),
|
|
540
|
-
onAction: (autocompleteApi, rng, value) => {
|
|
541
|
-
editor.selection.setRng(rng);
|
|
542
|
-
editor.insertContent(value);
|
|
543
|
-
autocompleteApi.hide();
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
const register = editor => {
|
|
549
|
-
const onAction = () => editor.execCommand('mceEmoticons');
|
|
550
|
-
editor.ui.registry.addButton('emoticons', {
|
|
551
|
-
tooltip: 'Emojis',
|
|
552
|
-
icon: 'emoji',
|
|
553
|
-
onAction
|
|
554
|
-
});
|
|
555
|
-
editor.ui.registry.addMenuItem('emoticons', {
|
|
556
|
-
text: 'Emojis...',
|
|
557
|
-
icon: 'emoji',
|
|
558
|
-
onAction
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
var Plugin = () => {
|
|
563
|
-
global$1.add('emoticons', (editor, pluginUrl) => {
|
|
564
|
-
register$2(editor, pluginUrl);
|
|
565
|
-
const databaseUrl = getEmojiDatabaseUrl(editor);
|
|
566
|
-
const databaseId = getEmojiDatabaseId(editor);
|
|
567
|
-
const database = initDatabase(editor, databaseUrl, databaseId);
|
|
568
|
-
register$1(editor, database);
|
|
569
|
-
register(editor);
|
|
570
|
-
init(editor, database);
|
|
571
|
-
setup(editor);
|
|
572
|
-
});
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
Plugin();
|
|
576
|
-
|
|
577
|
-
})();
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TinyMCE version 6.1.2 (2022-07-29)
|
|
3
|
-
*/
|
|
4
|
-
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(null,t=>null===t);const o=()=>{},n=()=>!1;class s{constructor(t,e){this.tag=t,this.value=e}static some(t){return new s(!0,t)}static none(){return s.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?s.some(t(this.value)):s.none()}bind(t){return this.tag?t(this.value):s.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:s.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return null==t?s.none():s.some(t)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}s.singletonNone=new s(!1);const r=(t,e)=>{const o=t.length,n=new Array(o);for(let s=0;s<o;s++){const o=t[s];n[s]=e(o,s)}return n},a=t=>{let e=t;return{get:()=>e,set:t=>{e=t}}},i=Object.keys,l=Object.hasOwnProperty,c=(t,e)=>{const o=i(t);for(let n=0,s=o.length;n<s;n++){const s=o[n];e(t[s],s)}},u=(t,e)=>l.call(t,e),g=(m=(t,e)=>e,(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const e={};for(let o=0;o<t.length;o++){const n=t[o];for(const t in n)u(n,t)&&(e[t]=m(e[t],n[t]))}return e});var m;const h=()=>{const t=(t=>{const e=a(s.none()),o=()=>e.get().each(t);return{clear:()=>{o(),e.set(s.none())},isSet:()=>e.get().isSome(),get:()=>e.get(),set:t=>{o(),e.set(s.some(t))}}})(o);return{...t,on:e=>t.get().each(e)}},d=(t,e)=>-1!==t.indexOf(e);var p=tinymce.util.Tools.resolve("tinymce.Resource");const y=t=>e=>e.options.get(t),v=y("emoticons_database"),f=y("emoticons_database_url"),b=y("emoticons_database_id"),w=y("emoticons_append"),_=y("emoticons_images_url"),j="All",C={symbols:"Symbols",people:"People",animals_and_nature:"Animals and Nature",food_and_drink:"Food and Drink",activity:"Activity",travel_and_places:"Travel and Places",objects:"Objects",flags:"Flags",user:"User Defined"},k=(t,e)=>u(t,e)?t[e]:e,A=t=>{const e=w(t);return o=t=>({keywords:[],category:"user",...t}),((t,e)=>{const o={};return c(t,((t,n)=>{const s=e(t,n);o[s.k]=s.v})),o})(e,((t,e)=>({k:e,v:o(t)})));var o},O=(t,e)=>d(t.title.toLowerCase(),e)||((t,o)=>{for(let o=0,s=t.length;o<s;o++)if(n=t[o],d(n.toLowerCase(),e))return!0;var n;return!1})(t.keywords),x=(t,e,o)=>{const s=[],r=e.toLowerCase(),a=o.fold((()=>n),(t=>e=>e>=t));for(let o=0;o<t.length&&(0!==e.length&&!O(t[o],r)||(s.push({value:t[o].char,text:t[o].title,icon:t[o].char}),!a(s.length)));o++);return s},L="pattern",T=(t,o)=>{const n={pattern:"",results:x(o.listAll(),"",s.some(300))},i=a(j),l=((t,o)=>{let n=null;const s=()=>{e(n)||(clearTimeout(n),n=null)};return{cancel:s,throttle:(...e)=>{s(),n=setTimeout((()=>{n=null,t.apply(null,e)}),200)}}})((t=>{(t=>{const e=t.getData(),n=i.get(),r=o.listCategory(n),a=x(r,e.pattern,n===j?s.some(300):s.none());t.setData({results:a})})(t)})),c={label:"Search",type:"input",name:L},u={type:"collection",name:"results"},g=()=>({title:"Emojis",size:"normal",body:{type:"tabpanel",tabs:r(o.listCategories(),(t=>({title:t,name:t,items:[c,u]})))},initialData:n,onTabChange:(t,e)=>{i.set(e.newTabName),l.throttle(t)},onChange:l.throttle,onAction:(e,o)=>{"results"===o.name&&(((t,e)=>{t.insertContent(e)})(t,o.value),e.close())},buttons:[{type:"cancel",text:"Close",primary:!0}]}),m=t.windowManager.open(g());m.focus(L),o.hasLoaded()||(m.block("Loading emojis..."),o.waitForLoad().then((()=>{m.redial(g()),l.throttle(m),m.focus(L),m.unblock()})).catch((t=>{m.redial({title:"Emojis",body:{type:"panel",items:[{type:"alertbanner",level:"error",icon:"warning",text:"Could not load emojis"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{pattern:"",results:[]}}),m.focus(L),m.unblock()})))};t.add("emoticons",((t,e)=>{((t,e)=>{const o=t.options.register;o("emoticons_database",{processor:"string",default:"emojis"}),o("emoticons_database_url",{processor:"string",default:`${e}/js/${v(t)}${t.suffix}.js`}),o("emoticons_database_id",{processor:"string",default:"tinymce.plugins.emoticons"}),o("emoticons_append",{processor:"object",default:{}}),o("emoticons_images_url",{processor:"string",default:"https://twemoji.maxcdn.com/v/13.0.1/72x72/"})})(t,e);const o=((t,e,o)=>{const n=h(),r=h(),a=_(t),l=t=>{return o="<img",(e=t.char).length>=o.length&&e.substr(0,0+o.length)===o?t.char.replace(/src="([^"]+)"/,((t,e)=>`src="${a}${e}"`)):t.char;var e,o};t.on("init",(()=>{p.load(o,e).then((e=>{const o=A(t);(t=>{const e={},o=[];c(t,((t,n)=>{const s={title:n,keywords:t.keywords,char:l(t),category:k(C,t.category)},r=void 0!==e[s.category]?e[s.category]:[];e[s.category]=r.concat([s]),o.push(s)})),n.set(e),r.set(o)})(g(e,o))}),(t=>{console.log(`Failed to load emojis: ${t}`),n.set({}),r.set([])}))}));const u=()=>r.get().getOr([]),m=()=>n.isSet()&&r.isSet();return{listCategories:()=>[j].concat(i(n.get().getOr({}))),hasLoaded:m,waitForLoad:()=>m()?Promise.resolve(!0):new Promise(((t,o)=>{let n=15;const s=setInterval((()=>{m()?(clearInterval(s),t(!0)):(n--,n<0&&(console.log("Could not load emojis from url: "+e),clearInterval(s),o(!1)))}),100)})),listAll:u,listCategory:t=>t===j?u():n.get().bind((e=>s.from(e[t]))).getOr([])}})(t,f(t),b(t));((t,e)=>{t.addCommand("mceEmoticons",(()=>T(t,e)))})(t,o),(t=>{const e=()=>t.execCommand("mceEmoticons");t.ui.registry.addButton("emoticons",{tooltip:"Emojis",icon:"emoji",onAction:e}),t.ui.registry.addMenuItem("emoticons",{text:"Emojis...",icon:"emoji",onAction:e})})(t),((t,e)=>{t.ui.registry.addAutocompleter("emoticons",{ch:":",columns:"auto",minChars:2,fetch:(t,o)=>e.waitForLoad().then((()=>{const n=e.listAll();return x(n,t,s.some(o))})),onAction:(e,o,n)=>{t.selection.setRng(o),t.insertContent(n),e.hide()}})})(t,o),(t=>{t.on("PreInit",(()=>{t.parser.addAttributeFilter("data-emoticon",(t=>{((t,e)=>{for(let e=0,n=t.length;e<n;e++)(o=t[e]).attr("data-mce-resize","false"),o.attr("data-mce-placeholder","1");var o})(t)}))}))})(t)}))}();
|