[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/tinymce/plugins/legacyoutput/ -> plugin.js (source)

   1  /**
   2   * Copyright (c) Tiny Technologies, Inc. All rights reserved.
   3   * Licensed under the LGPL or a commercial license.
   4   * For LGPL see License.txt in the project root for license information.
   5   * For commercial licenses see https://www.tiny.cloud/
   6   *
   7   * Version: 5.10.5 (2022-05-25)
   8   */
   9  (function () {
  10      'use strict';
  11  
  12      var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
  13  
  14      var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
  15  
  16      var getFontSizeFormats = function (editor) {
  17        return editor.getParam('fontsize_formats');
  18      };
  19      var setFontSizeFormats = function (editor, fontsize_formats) {
  20        editor.settings.fontsize_formats = fontsize_formats;
  21      };
  22      var getFontFormats = function (editor) {
  23        return editor.getParam('font_formats');
  24      };
  25      var setFontFormats = function (editor, font_formats) {
  26        editor.settings.font_formats = font_formats;
  27      };
  28      var getFontSizeStyleValues = function (editor) {
  29        return editor.getParam('font_size_style_values', 'xx-small,x-small,small,medium,large,x-large,xx-large');
  30      };
  31      var setInlineStyles = function (editor, inline_styles) {
  32        editor.settings.inline_styles = inline_styles;
  33      };
  34  
  35      var overrideFormats = function (editor) {
  36        var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table', fontSizes = global.explode(getFontSizeStyleValues(editor)), schema = editor.schema;
  37        editor.formatter.register({
  38          alignleft: {
  39            selector: alignElements,
  40            attributes: { align: 'left' }
  41          },
  42          aligncenter: {
  43            selector: alignElements,
  44            attributes: { align: 'center' }
  45          },
  46          alignright: {
  47            selector: alignElements,
  48            attributes: { align: 'right' }
  49          },
  50          alignjustify: {
  51            selector: alignElements,
  52            attributes: { align: 'justify' }
  53          },
  54          bold: [
  55            {
  56              inline: 'b',
  57              remove: 'all',
  58              preserve_attributes: [
  59                'class',
  60                'style'
  61              ]
  62            },
  63            {
  64              inline: 'strong',
  65              remove: 'all',
  66              preserve_attributes: [
  67                'class',
  68                'style'
  69              ]
  70            },
  71            {
  72              inline: 'span',
  73              styles: { fontWeight: 'bold' }
  74            }
  75          ],
  76          italic: [
  77            {
  78              inline: 'i',
  79              remove: 'all',
  80              preserve_attributes: [
  81                'class',
  82                'style'
  83              ]
  84            },
  85            {
  86              inline: 'em',
  87              remove: 'all',
  88              preserve_attributes: [
  89                'class',
  90                'style'
  91              ]
  92            },
  93            {
  94              inline: 'span',
  95              styles: { fontStyle: 'italic' }
  96            }
  97          ],
  98          underline: [
  99            {
 100              inline: 'u',
 101              remove: 'all',
 102              preserve_attributes: [
 103                'class',
 104                'style'
 105              ]
 106            },
 107            {
 108              inline: 'span',
 109              styles: { textDecoration: 'underline' },
 110              exact: true
 111            }
 112          ],
 113          strikethrough: [
 114            {
 115              inline: 'strike',
 116              remove: 'all',
 117              preserve_attributes: [
 118                'class',
 119                'style'
 120              ]
 121            },
 122            {
 123              inline: 'span',
 124              styles: { textDecoration: 'line-through' },
 125              exact: true
 126            }
 127          ],
 128          fontname: {
 129            inline: 'font',
 130            toggle: false,
 131            attributes: { face: '%value' }
 132          },
 133          fontsize: {
 134            inline: 'font',
 135            toggle: false,
 136            attributes: {
 137              size: function (vars) {
 138                return String(global.inArray(fontSizes, vars.value) + 1);
 139              }
 140            }
 141          },
 142          forecolor: {
 143            inline: 'font',
 144            attributes: { color: '%value' },
 145            links: true,
 146            remove_similar: true,
 147            clear_child_styles: true
 148          },
 149          hilitecolor: {
 150            inline: 'font',
 151            styles: { backgroundColor: '%value' },
 152            links: true,
 153            remove_similar: true,
 154            clear_child_styles: true
 155          }
 156        });
 157        global.each('b,i,u,strike'.split(','), function (name) {
 158          schema.addValidElements(name + '[*]');
 159        });
 160        if (!schema.getElementRule('font')) {
 161          schema.addValidElements('font[face|size|color|style]');
 162        }
 163        global.each(alignElements.split(','), function (name) {
 164          var rule = schema.getElementRule(name);
 165          if (rule) {
 166            if (!rule.attributes.align) {
 167              rule.attributes.align = {};
 168              rule.attributesOrder.push('align');
 169            }
 170          }
 171        });
 172      };
 173      var overrideSettings = function (editor) {
 174        var defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
 175        var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
 176        setInlineStyles(editor, false);
 177        if (!getFontSizeFormats(editor)) {
 178          setFontSizeFormats(editor, defaultFontsizeFormats);
 179        }
 180        if (!getFontFormats(editor)) {
 181          setFontFormats(editor, defaultFontsFormats);
 182        }
 183      };
 184      var setup = function (editor) {
 185        overrideSettings(editor);
 186        editor.on('PreInit', function () {
 187          return overrideFormats(editor);
 188        });
 189      };
 190  
 191      function Plugin () {
 192        global$1.add('legacyoutput', function (editor) {
 193          setup(editor);
 194        });
 195      }
 196  
 197      Plugin();
 198  
 199  }());


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer