[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/plg_editors_tinymce/js/plugins/highlighter/ -> plugin-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * plugin.js
   6     *
   7     * Original code by Arjan Haverkamp
   8     * Copyright 2013-2015 Arjan Haverkamp ([email protected])
   9     */
  10    window.tinymce.PluginManager.add('highlightPlus', function (editor, url) {
  11      var showSourceEditor = function showSourceEditor() {
  12        editor.focus();
  13        editor.selection.collapse(true);
  14        if (!editor.settings.codemirror) editor.settings.codemirror = {}; // Insert caret marker
  15  
  16        if (editor.settings.codemirror && editor.settings.codemirror.saveCursorPosition) {
  17          editor.selection.setContent('<span style="display: none;" class="CmCaReT">&#x0;</span>');
  18        }
  19  
  20        var codemirrorWidth = 800;
  21  
  22        if (editor.settings.codemirror.width) {
  23          codemirrorWidth = editor.settings.codemirror.width;
  24        }
  25  
  26        var codemirrorHeight = 550;
  27  
  28        if (editor.settings.codemirror.height) {
  29          codemirrorHeight = editor.settings.codemirror.height;
  30        }
  31  
  32        var buttonsConfig = [{
  33          type: 'custom',
  34          text: 'Ok',
  35          name: 'codemirrorOk',
  36          primary: true
  37        }, {
  38          type: 'cancel',
  39          text: 'Cancel',
  40          name: 'codemirrorCancel'
  41        }];
  42        var config = {
  43          title: 'Source code',
  44          url: url + "/source.html",
  45          width: codemirrorWidth,
  46          height: codemirrorHeight,
  47          resizable: true,
  48          maximizable: true,
  49          fullScreen: editor.settings.codemirror.fullscreen,
  50          saveCursorPosition: false,
  51          buttons: buttonsConfig
  52        };
  53  
  54        config.onAction = function (dialogApi, actionData) {
  55          if (actionData.name === 'codemirrorOk') {
  56            var doc = document.querySelectorAll('.tox-dialog__body-iframe iframe')[0];
  57            doc.contentWindow.tinymceHighlighterSubmit();
  58            editor.undoManager.add(); // eslint-disable-next-line no-use-before-define
  59  
  60            win.close();
  61          }
  62        };
  63  
  64        var win = editor.windowManager.openUrl(config);
  65  
  66        if (editor.settings.codemirror.fullscreen) {
  67          win.fullscreen(true);
  68        }
  69      };
  70  
  71      editor.ui.registry.addButton('code', {
  72        icon: 'sourcecode',
  73        title: 'Source code+',
  74        tooltip: 'Source code+',
  75        onAction: showSourceEditor
  76      });
  77      editor.ui.registry.addMenuItem('code', {
  78        icon: 'sourcecode',
  79        text: 'Source code+',
  80        onAction: showSourceEditor,
  81        context: 'tools'
  82      });
  83    });
  84  
  85  })();


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