Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/**
1441 ariadna 2
 * TinyMCE version 7.7.1 (2025-03-05)
1 efrain 3
 */
4
 
5
(function () {
6
    'use strict';
7
 
8
    const Cell = initial => {
9
      let value = initial;
10
      const get = () => {
11
        return value;
12
      };
13
      const set = v => {
14
        value = v;
15
      };
16
      return {
17
        get,
18
        set
19
      };
20
    };
21
 
22
    var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
23
 
1441 ariadna 24
    const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
25
 
1 efrain 26
    let unique = 0;
27
    const generate = prefix => {
28
      const date = new Date();
29
      const time = date.getTime();
1441 ariadna 30
      const random$1 = Math.floor(random() * 1000000000);
1 efrain 31
      unique++;
1441 ariadna 32
      return prefix + '_' + random$1 + unique + String(time);
1 efrain 33
    };
34
 
35
    const get$1 = customTabs => {
36
      const addTab = spec => {
37
        var _a;
38
        const name = (_a = spec.name) !== null && _a !== void 0 ? _a : generate('tab-name');
39
        const currentCustomTabs = customTabs.get();
40
        currentCustomTabs[name] = spec;
41
        customTabs.set(currentCustomTabs);
42
      };
43
      return { addTab };
44
    };
45
 
46
    const register$2 = (editor, dialogOpener) => {
47
      editor.addCommand('mceHelp', dialogOpener);
48
    };
49
 
50
    const option = name => editor => editor.options.get(name);
51
    const register$1 = editor => {
52
      const registerOption = editor.options.register;
53
      registerOption('help_tabs', { processor: 'array' });
54
    };
55
    const getHelpTabs = option('help_tabs');
56
    const getForcedPlugins = option('forced_plugins');
57
 
58
    const register = (editor, dialogOpener) => {
59
      editor.ui.registry.addButton('help', {
60
        icon: 'help',
61
        tooltip: 'Help',
1441 ariadna 62
        onAction: dialogOpener,
63
        context: 'any'
1 efrain 64
      });
65
      editor.ui.registry.addMenuItem('help', {
66
        text: 'Help',
67
        icon: 'help',
68
        shortcut: 'Alt+0',
1441 ariadna 69
        onAction: dialogOpener,
70
        context: 'any'
1 efrain 71
      });
72
    };
73
 
74
    const hasProto = (v, constructor, predicate) => {
75
      var _a;
76
      if (predicate(v, constructor.prototype)) {
77
        return true;
78
      } else {
79
        return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
80
      }
81
    };
82
    const typeOf = x => {
83
      const t = typeof x;
84
      if (x === null) {
85
        return 'null';
86
      } else if (t === 'object' && Array.isArray(x)) {
87
        return 'array';
88
      } else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
89
        return 'string';
90
      } else {
91
        return t;
92
      }
93
    };
94
    const isType = type => value => typeOf(value) === type;
95
    const isSimpleType = type => value => typeof value === type;
96
    const eq = t => a => t === a;
97
    const isString = isType('string');
98
    const isUndefined = eq(undefined);
99
    const isNullable = a => a === null || a === undefined;
100
    const isNonNullable = a => !isNullable(a);
101
    const isFunction = isSimpleType('function');
102
 
103
    const constant = value => {
104
      return () => {
105
        return value;
106
      };
107
    };
108
    const never = constant(false);
109
 
110
    class Optional {
111
      constructor(tag, value) {
112
        this.tag = tag;
113
        this.value = value;
114
      }
115
      static some(value) {
116
        return new Optional(true, value);
117
      }
118
      static none() {
119
        return Optional.singletonNone;
120
      }
121
      fold(onNone, onSome) {
122
        if (this.tag) {
123
          return onSome(this.value);
124
        } else {
125
          return onNone();
126
        }
127
      }
128
      isSome() {
129
        return this.tag;
130
      }
131
      isNone() {
132
        return !this.tag;
133
      }
134
      map(mapper) {
135
        if (this.tag) {
136
          return Optional.some(mapper(this.value));
137
        } else {
138
          return Optional.none();
139
        }
140
      }
141
      bind(binder) {
142
        if (this.tag) {
143
          return binder(this.value);
144
        } else {
145
          return Optional.none();
146
        }
147
      }
148
      exists(predicate) {
149
        return this.tag && predicate(this.value);
150
      }
151
      forall(predicate) {
152
        return !this.tag || predicate(this.value);
153
      }
154
      filter(predicate) {
155
        if (!this.tag || predicate(this.value)) {
156
          return this;
157
        } else {
158
          return Optional.none();
159
        }
160
      }
161
      getOr(replacement) {
162
        return this.tag ? this.value : replacement;
163
      }
164
      or(replacement) {
165
        return this.tag ? this : replacement;
166
      }
167
      getOrThunk(thunk) {
168
        return this.tag ? this.value : thunk();
169
      }
170
      orThunk(thunk) {
171
        return this.tag ? this : thunk();
172
      }
173
      getOrDie(message) {
174
        if (!this.tag) {
175
          throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
176
        } else {
177
          return this.value;
178
        }
179
      }
180
      static from(value) {
181
        return isNonNullable(value) ? Optional.some(value) : Optional.none();
182
      }
183
      getOrNull() {
184
        return this.tag ? this.value : null;
185
      }
186
      getOrUndefined() {
187
        return this.value;
188
      }
189
      each(worker) {
190
        if (this.tag) {
191
          worker(this.value);
192
        }
193
      }
194
      toArray() {
195
        return this.tag ? [this.value] : [];
196
      }
197
      toString() {
198
        return this.tag ? `some(${ this.value })` : 'none()';
199
      }
200
    }
201
    Optional.singletonNone = new Optional(false);
202
 
203
    const nativeSlice = Array.prototype.slice;
204
    const nativeIndexOf = Array.prototype.indexOf;
205
    const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
206
    const contains = (xs, x) => rawIndexOf(xs, x) > -1;
207
    const map = (xs, f) => {
208
      const len = xs.length;
209
      const r = new Array(len);
210
      for (let i = 0; i < len; i++) {
211
        const x = xs[i];
212
        r[i] = f(x, i);
213
      }
214
      return r;
215
    };
216
    const filter = (xs, pred) => {
217
      const r = [];
218
      for (let i = 0, len = xs.length; i < len; i++) {
219
        const x = xs[i];
220
        if (pred(x, i)) {
221
          r.push(x);
222
        }
223
      }
224
      return r;
225
    };
226
    const findUntil = (xs, pred, until) => {
227
      for (let i = 0, len = xs.length; i < len; i++) {
228
        const x = xs[i];
229
        if (pred(x, i)) {
230
          return Optional.some(x);
231
        } else if (until(x, i)) {
232
          break;
233
        }
234
      }
235
      return Optional.none();
236
    };
237
    const find = (xs, pred) => {
238
      return findUntil(xs, pred, never);
239
    };
240
    const sort = (xs, comparator) => {
241
      const copy = nativeSlice.call(xs, 0);
242
      copy.sort(comparator);
243
      return copy;
244
    };
245
 
246
    const keys = Object.keys;
247
    const hasOwnProperty = Object.hasOwnProperty;
248
    const get = (obj, key) => {
249
      return has(obj, key) ? Optional.from(obj[key]) : Optional.none();
250
    };
251
    const has = (obj, key) => hasOwnProperty.call(obj, key);
252
 
253
    const cat = arr => {
254
      const r = [];
255
      const push = x => {
256
        r.push(x);
257
      };
258
      for (let i = 0; i < arr.length; i++) {
259
        arr[i].each(push);
260
      }
261
      return r;
262
    };
263
 
264
    var global$3 = tinymce.util.Tools.resolve('tinymce.Resource');
265
 
266
    var global$2 = tinymce.util.Tools.resolve('tinymce.util.I18n');
267
 
268
    const pLoadHtmlByLangCode = (baseUrl, langCode) => global$3.load(`tinymce.html-i18n.help-keynav.${ langCode }`, `${ baseUrl }/js/i18n/keynav/${ langCode }.js`);
269
    const pLoadI18nHtml = baseUrl => pLoadHtmlByLangCode(baseUrl, global$2.getCode()).catch(() => pLoadHtmlByLangCode(baseUrl, 'en'));
270
    const initI18nLoad = (editor, baseUrl) => {
271
      editor.on('init', () => {
272
        pLoadI18nHtml(baseUrl);
273
      });
274
    };
275
 
276
    const pTab = async pluginUrl => {
277
      const body = {
278
        type: 'htmlpanel',
279
        presets: 'document',
280
        html: await pLoadI18nHtml(pluginUrl)
281
      };
282
      return {
283
        name: 'keyboardnav',
284
        title: 'Keyboard Navigation',
285
        items: [body]
286
      };
287
    };
288
 
289
    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
290
 
291
    const convertText = source => {
292
      const isMac = global$1.os.isMacOS() || global$1.os.isiOS();
293
      const mac = {
294
        alt: '&#x2325;',
295
        ctrl: '&#x2303;',
296
        shift: '&#x21E7;',
297
        meta: '&#x2318;',
298
        access: '&#x2303;&#x2325;'
299
      };
300
      const other = {
301
        meta: 'Ctrl ',
302
        access: 'Shift + Alt '
303
      };
304
      const replace = isMac ? mac : other;
305
      const shortcut = source.split('+');
306
      const updated = map(shortcut, segment => {
307
        const search = segment.toLowerCase().trim();
308
        return has(replace, search) ? replace[search] : segment;
309
      });
310
      return isMac ? updated.join('').replace(/\s/, '') : updated.join('+');
311
    };
312
 
313
    const shortcuts = [
314
      {
315
        shortcuts: ['Meta + B'],
316
        action: 'Bold'
317
      },
318
      {
319
        shortcuts: ['Meta + I'],
320
        action: 'Italic'
321
      },
322
      {
323
        shortcuts: ['Meta + U'],
324
        action: 'Underline'
325
      },
326
      {
327
        shortcuts: ['Meta + A'],
328
        action: 'Select all'
329
      },
330
      {
331
        shortcuts: [
332
          'Meta + Y',
333
          'Meta + Shift + Z'
334
        ],
335
        action: 'Redo'
336
      },
337
      {
338
        shortcuts: ['Meta + Z'],
339
        action: 'Undo'
340
      },
341
      {
342
        shortcuts: ['Access + 1'],
343
        action: 'Heading 1'
344
      },
345
      {
346
        shortcuts: ['Access + 2'],
347
        action: 'Heading 2'
348
      },
349
      {
350
        shortcuts: ['Access + 3'],
351
        action: 'Heading 3'
352
      },
353
      {
354
        shortcuts: ['Access + 4'],
355
        action: 'Heading 4'
356
      },
357
      {
358
        shortcuts: ['Access + 5'],
359
        action: 'Heading 5'
360
      },
361
      {
362
        shortcuts: ['Access + 6'],
363
        action: 'Heading 6'
364
      },
365
      {
366
        shortcuts: ['Access + 7'],
367
        action: 'Paragraph'
368
      },
369
      {
370
        shortcuts: ['Access + 8'],
371
        action: 'Div'
372
      },
373
      {
374
        shortcuts: ['Access + 9'],
375
        action: 'Address'
376
      },
377
      {
378
        shortcuts: ['Alt + 0'],
379
        action: 'Open help dialog'
380
      },
381
      {
382
        shortcuts: ['Alt + F9'],
383
        action: 'Focus to menubar'
384
      },
385
      {
386
        shortcuts: ['Alt + F10'],
387
        action: 'Focus to toolbar'
388
      },
389
      {
390
        shortcuts: ['Alt + F11'],
391
        action: 'Focus to element path'
392
      },
393
      {
1441 ariadna 394
        shortcuts: ['Alt + F12'],
395
        action: 'Focus to notification'
396
      },
397
      {
1 efrain 398
        shortcuts: ['Ctrl + F9'],
399
        action: 'Focus to contextual toolbar'
400
      },
401
      {
402
        shortcuts: ['Shift + Enter'],
403
        action: 'Open popup menu for split buttons'
404
      },
405
      {
406
        shortcuts: ['Meta + K'],
407
        action: 'Insert link (if link plugin activated)'
408
      },
409
      {
410
        shortcuts: ['Meta + S'],
411
        action: 'Save (if save plugin activated)'
412
      },
413
      {
414
        shortcuts: ['Meta + F'],
415
        action: 'Find (if searchreplace plugin activated)'
416
      },
417
      {
418
        shortcuts: ['Meta + Shift + F'],
419
        action: 'Switch to or from fullscreen mode'
420
      }
421
    ];
422
 
423
    const tab$2 = () => {
424
      const shortcutList = map(shortcuts, shortcut => {
425
        const shortcutText = map(shortcut.shortcuts, convertText).join(' or ');
426
        return [
427
          shortcut.action,
428
          shortcutText
429
        ];
430
      });
431
      const tablePanel = {
432
        type: 'table',
433
        header: [
434
          'Action',
435
          'Shortcut'
436
        ],
437
        cells: shortcutList
438
      };
439
      return {
440
        name: 'shortcuts',
441
        title: 'Handy Shortcuts',
442
        items: [tablePanel]
443
      };
444
    };
445
 
446
    const urls = map([
447
      {
448
        key: 'accordion',
449
        name: 'Accordion'
450
      },
451
      {
452
        key: 'anchor',
453
        name: 'Anchor'
454
      },
455
      {
456
        key: 'autolink',
457
        name: 'Autolink'
458
      },
459
      {
460
        key: 'autoresize',
461
        name: 'Autoresize'
462
      },
463
      {
464
        key: 'autosave',
465
        name: 'Autosave'
466
      },
467
      {
468
        key: 'charmap',
469
        name: 'Character Map'
470
      },
471
      {
472
        key: 'code',
473
        name: 'Code'
474
      },
475
      {
476
        key: 'codesample',
477
        name: 'Code Sample'
478
      },
479
      {
480
        key: 'colorpicker',
481
        name: 'Color Picker'
482
      },
483
      {
484
        key: 'directionality',
485
        name: 'Directionality'
486
      },
487
      {
488
        key: 'emoticons',
489
        name: 'Emoticons'
490
      },
491
      {
492
        key: 'fullscreen',
493
        name: 'Full Screen'
494
      },
495
      {
496
        key: 'help',
497
        name: 'Help'
498
      },
499
      {
500
        key: 'image',
501
        name: 'Image'
502
      },
503
      {
504
        key: 'importcss',
505
        name: 'Import CSS'
506
      },
507
      {
508
        key: 'insertdatetime',
509
        name: 'Insert Date/Time'
510
      },
511
      {
512
        key: 'link',
513
        name: 'Link'
514
      },
515
      {
516
        key: 'lists',
517
        name: 'Lists'
518
      },
519
      {
1441 ariadna 520
        key: 'advlist',
521
        name: 'List Styles'
522
      },
523
      {
1 efrain 524
        key: 'media',
525
        name: 'Media'
526
      },
527
      {
528
        key: 'nonbreaking',
529
        name: 'Nonbreaking'
530
      },
531
      {
532
        key: 'pagebreak',
533
        name: 'Page Break'
534
      },
535
      {
536
        key: 'preview',
537
        name: 'Preview'
538
      },
539
      {
540
        key: 'quickbars',
541
        name: 'Quick Toolbars'
542
      },
543
      {
544
        key: 'save',
545
        name: 'Save'
546
      },
547
      {
548
        key: 'searchreplace',
549
        name: 'Search and Replace'
550
      },
551
      {
552
        key: 'table',
553
        name: 'Table'
554
      },
555
      {
556
        key: 'textcolor',
557
        name: 'Text Color'
558
      },
559
      {
560
        key: 'visualblocks',
561
        name: 'Visual Blocks'
562
      },
563
      {
564
        key: 'visualchars',
565
        name: 'Visual Characters'
566
      },
567
      {
568
        key: 'wordcount',
569
        name: 'Word Count'
570
      },
571
      {
572
        key: 'a11ychecker',
573
        name: 'Accessibility Checker',
574
        type: 'premium'
575
      },
576
      {
1441 ariadna 577
        key: 'typography',
578
        name: 'Advanced Typography',
1 efrain 579
        type: 'premium',
1441 ariadna 580
        slug: 'advanced-typography'
1 efrain 581
      },
582
      {
583
        key: 'ai',
584
        name: 'AI Assistant',
585
        type: 'premium'
586
      },
587
      {
588
        key: 'casechange',
589
        name: 'Case Change',
590
        type: 'premium'
591
      },
592
      {
593
        key: 'checklist',
594
        name: 'Checklist',
595
        type: 'premium'
596
      },
597
      {
1441 ariadna 598
        key: 'advcode',
599
        name: 'Enhanced Code Editor',
1 efrain 600
        type: 'premium'
601
      },
602
      {
1441 ariadna 603
        key: 'mediaembed',
604
        name: 'Enhanced Media Embed',
605
        type: 'premium',
606
        slug: 'introduction-to-mediaembed'
607
      },
608
      {
609
        key: 'advtable',
610
        name: 'Enhanced Tables',
1 efrain 611
        type: 'premium'
612
      },
613
      {
1441 ariadna 614
        key: 'exportpdf',
615
        name: 'Export to PDF',
616
        type: 'premium'
1 efrain 617
      },
618
      {
1441 ariadna 619
        key: 'exportword',
620
        name: 'Export to Word',
621
        type: 'premium'
1 efrain 622
      },
623
      {
1441 ariadna 624
        key: 'footnotes',
625
        name: 'Footnotes',
1 efrain 626
        type: 'premium'
627
      },
628
      {
629
        key: 'formatpainter',
630
        name: 'Format Painter',
631
        type: 'premium'
632
      },
633
      {
1441 ariadna 634
        key: 'editimage',
635
        name: 'Image Editing',
636
        type: 'premium'
637
      },
638
      {
639
        key: 'uploadcare',
640
        name: 'Image Optimizer Powered by Uploadcare',
641
        type: 'premium'
642
      },
643
      {
644
        key: 'importword',
645
        name: 'Import from Word',
646
        type: 'premium'
647
      },
648
      {
1 efrain 649
        key: 'inlinecss',
650
        name: 'Inline CSS',
651
        type: 'premium',
652
        slug: 'inline-css'
653
      },
654
      {
655
        key: 'linkchecker',
656
        name: 'Link Checker',
657
        type: 'premium'
658
      },
659
      {
1441 ariadna 660
        key: 'math',
661
        name: 'Math',
662
        type: 'premium'
663
      },
664
      {
665
        key: 'markdown',
666
        name: 'Markdown',
667
        type: 'premium'
668
      },
669
      {
1 efrain 670
        key: 'mentions',
671
        name: 'Mentions',
672
        type: 'premium'
673
      },
674
      {
675
        key: 'mergetags',
676
        name: 'Merge Tags',
677
        type: 'premium'
678
      },
679
      {
680
        key: 'pageembed',
681
        name: 'Page Embed',
682
        type: 'premium'
683
      },
684
      {
685
        key: 'permanentpen',
686
        name: 'Permanent Pen',
687
        type: 'premium'
688
      },
689
      {
690
        key: 'powerpaste',
691
        name: 'PowerPaste',
692
        type: 'premium',
693
        slug: 'introduction-to-powerpaste'
694
      },
695
      {
1441 ariadna 696
        key: 'revisionhistory',
697
        name: 'Revision History',
698
        type: 'premium'
1 efrain 699
      },
700
      {
701
        key: 'tinymcespellchecker',
1441 ariadna 702
        name: 'Spell Checker',
1 efrain 703
        type: 'premium',
704
        slug: 'introduction-to-tiny-spellchecker'
705
      },
706
      {
707
        key: 'autocorrect',
708
        name: 'Spelling Autocorrect',
709
        type: 'premium'
710
      },
711
      {
712
        key: 'tableofcontents',
713
        name: 'Table of Contents',
714
        type: 'premium'
715
      },
716
      {
1441 ariadna 717
        key: 'advtemplate',
718
        name: 'Templates',
719
        type: 'premium',
720
        slug: 'advanced-templates'
721
      },
722
      {
1 efrain 723
        key: 'tinycomments',
724
        name: 'Tiny Comments',
725
        type: 'premium',
726
        slug: 'introduction-to-tiny-comments'
727
      },
728
      {
729
        key: 'tinydrive',
730
        name: 'Tiny Drive',
731
        type: 'premium',
732
        slug: 'tinydrive-introduction'
733
      }
734
    ], item => ({
735
      ...item,
736
      type: item.type || 'opensource',
737
      slug: item.slug || item.key
738
    }));
739
 
740
    const tab$1 = editor => {
741
      const availablePlugins = () => {
742
        const premiumPlugins = filter(urls, ({type}) => {
743
          return type === 'premium';
744
        });
745
        const sortedPremiumPlugins = sort(map(premiumPlugins, p => p.name), (s1, s2) => s1.localeCompare(s2));
746
        const premiumPluginList = map(sortedPremiumPlugins, pluginName => `<li>${ pluginName }</li>`).join('');
747
        return '<div>' + '<p><b>' + global$2.translate('Premium plugins:') + '</b></p>' + '<ul>' + premiumPluginList + '<li class="tox-help__more-link" ">' + '<a href="https://www.tiny.cloud/pricing/?utm_campaign=help_dialog_plugin_tab&utm_source=tiny&utm_medium=referral&utm_term=read_more&utm_content=premium_plugin_heading" rel="noopener" target="_blank"' + ' data-alloy-tabstop="true" tabindex="-1">' + global$2.translate('Learn more...') + '</a></li>' + '</ul>' + '</div>';
748
      };
749
      const makeLink = p => `<a data-alloy-tabstop="true" tabindex="-1" href="${ p.url }" target="_blank" rel="noopener">${ p.name }</a>`;
750
      const identifyUnknownPlugin = (editor, key) => {
751
        const getMetadata = editor.plugins[key].getMetadata;
752
        if (isFunction(getMetadata)) {
753
          const metadata = getMetadata();
754
          return {
755
            name: metadata.name,
756
            html: makeLink(metadata)
757
          };
758
        } else {
759
          return {
760
            name: key,
761
            html: key
762
          };
763
        }
764
      };
765
      const getPluginData = (editor, key) => find(urls, x => {
766
        return x.key === key;
767
      }).fold(() => {
768
        return identifyUnknownPlugin(editor, key);
769
      }, x => {
770
        const name = x.type === 'premium' ? `${ x.name }*` : x.name;
771
        const html = makeLink({
772
          name,
1441 ariadna 773
          url: `https://www.tiny.cloud/docs/tinymce/7/${ x.slug }/`
1 efrain 774
        });
775
        return {
776
          name,
777
          html
778
        };
779
      });
780
      const getPluginKeys = editor => {
781
        const keys$1 = keys(editor.plugins);
782
        const forcedPlugins = getForcedPlugins(editor);
783
        return isUndefined(forcedPlugins) ? keys$1 : filter(keys$1, k => !contains(forcedPlugins, k));
784
      };
785
      const pluginLister = editor => {
786
        const pluginKeys = getPluginKeys(editor);
787
        const sortedPluginData = sort(map(pluginKeys, k => getPluginData(editor, k)), (pd1, pd2) => pd1.name.localeCompare(pd2.name));
788
        const pluginLis = map(sortedPluginData, key => {
789
          return '<li>' + key.html + '</li>';
790
        });
791
        const count = pluginLis.length;
792
        const pluginsString = pluginLis.join('');
793
        const html = '<p><b>' + global$2.translate([
794
          'Plugins installed ({0}):',
795
          count
796
        ]) + '</b></p>' + '<ul>' + pluginsString + '</ul>';
797
        return html;
798
      };
799
      const installedPlugins = editor => {
800
        if (editor == null) {
801
          return '';
802
        }
803
        return '<div>' + pluginLister(editor) + '</div>';
804
      };
805
      const htmlPanel = {
806
        type: 'htmlpanel',
807
        presets: 'document',
808
        html: [
809
          installedPlugins(editor),
810
          availablePlugins()
811
        ].join('')
812
      };
813
      return {
814
        name: 'plugins',
815
        title: 'Plugins',
816
        items: [htmlPanel]
817
      };
818
    };
819
 
820
    var global = tinymce.util.Tools.resolve('tinymce.EditorManager');
821
 
822
    const tab = () => {
823
      const getVersion = (major, minor) => major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor;
824
      const version = getVersion(global.majorVersion, global.minorVersion);
1441 ariadna 825
      const changeLogLink = '<a data-alloy-tabstop="true" tabindex="-1" href="https://www.tiny.cloud/docs/tinymce/7/changelog/?utm_campaign=help_dialog_version_tab&utm_source=tiny&utm_medium=referral" rel="noopener" target="_blank">TinyMCE ' + version + '</a>';
1 efrain 826
      const htmlPanel = {
827
        type: 'htmlpanel',
828
        html: '<p>' + global$2.translate([
829
          'You are using {0}',
830
          changeLogLink
831
        ]) + '</p>',
832
        presets: 'document'
833
      };
834
      return {
835
        name: 'versions',
836
        title: 'Version',
837
        items: [htmlPanel]
838
      };
839
    };
840
 
841
    const parseHelpTabsSetting = (tabsFromSettings, tabs) => {
842
      const newTabs = {};
843
      const names = map(tabsFromSettings, t => {
844
        var _a;
845
        if (isString(t)) {
846
          if (has(tabs, t)) {
847
            newTabs[t] = tabs[t];
848
          }
849
          return t;
850
        } else {
851
          const name = (_a = t.name) !== null && _a !== void 0 ? _a : generate('tab-name');
852
          newTabs[name] = t;
853
          return name;
854
        }
855
      });
856
      return {
857
        tabs: newTabs,
858
        names
859
      };
860
    };
861
    const getNamesFromTabs = tabs => {
862
      const names = keys(tabs);
863
      const idx = names.indexOf('versions');
864
      if (idx !== -1) {
865
        names.splice(idx, 1);
866
        names.push('versions');
867
      }
868
      return {
869
        tabs,
870
        names
871
      };
872
    };
873
    const pParseCustomTabs = async (editor, customTabs, pluginUrl) => {
874
      const shortcuts = tab$2();
875
      const nav = await pTab(pluginUrl);
876
      const plugins = tab$1(editor);
877
      const versions = tab();
878
      const tabs = {
879
        [shortcuts.name]: shortcuts,
880
        [nav.name]: nav,
881
        [plugins.name]: plugins,
882
        [versions.name]: versions,
883
        ...customTabs.get()
884
      };
885
      return Optional.from(getHelpTabs(editor)).fold(() => getNamesFromTabs(tabs), tabsFromSettings => parseHelpTabsSetting(tabsFromSettings, tabs));
886
    };
887
    const init = (editor, customTabs, pluginUrl) => () => {
888
      pParseCustomTabs(editor, customTabs, pluginUrl).then(({tabs, names}) => {
889
        const foundTabs = map(names, name => get(tabs, name));
890
        const dialogTabs = cat(foundTabs);
891
        const body = {
892
          type: 'tabpanel',
893
          tabs: dialogTabs
894
        };
895
        editor.windowManager.open({
896
          title: 'Help',
897
          size: 'medium',
898
          body,
899
          buttons: [{
900
              type: 'cancel',
901
              name: 'close',
902
              text: 'Close',
903
              primary: true
904
            }],
905
          initialData: {}
906
        });
907
      });
908
    };
909
 
910
    var Plugin = () => {
911
      global$4.add('help', (editor, pluginUrl) => {
912
        const customTabs = Cell({});
913
        const api = get$1(customTabs);
914
        register$1(editor);
915
        const dialogOpener = init(editor, customTabs, pluginUrl);
916
        register(editor, dialogOpener);
917
        register$2(editor, dialogOpener);
918
        editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp');
919
        initI18nLoad(editor, pluginUrl);
920
        return api;
921
      });
922
    };
923
 
924
    Plugin();
925
 
926
})();