CoreFiles by mySites.guru
plugin.js91 lines, 2,240 bytes, from Joomla_4.1.1-rc1-Release_Candidate-Full_Package.zip
Raw History Compare with 4.1.0-rc4
md5
71b5613ae3e3d60075a3ae89b3fadc00
sha1
e618aec5f68c15de832145d895f559de2ddb7d95
sha256
cde30e6c49f31d2a54c3f1976dfa26d20bd4169c83f5d956667dcde977367d1d
/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 *
 * Version: 5.10.3 (2022-02-09)
 */
(function () {
    'use strict';

    var global = tinymce.util.Tools.resolve('tinymce.PluginManager');

    var setContent = function (editor, html) {
      editor.focus();
      editor.undoManager.transact(function () {
        editor.setContent(html);
      });
      editor.selection.setCursorLocation();
      editor.nodeChanged();
    };
    var getContent = function (editor) {
      return editor.getContent({ source_view: true });
    };

    var open = function (editor) {
      var editorContent = getContent(editor);
      editor.windowManager.open({
        title: 'Source Code',
        size: 'large',
        body: {
          type: 'panel',
          items: [{
              type: 'textarea',
              name: 'code'
            }]
        },
        buttons: [
          {
            type: 'cancel',
            name: 'cancel',
            text: 'Cancel'
          },
          {
            type: 'submit',
            name: 'save',
            text: 'Save',
            primary: true
          }
        ],
        initialData: { code: editorContent },
        onSubmit: function (api) {
          setContent(editor, api.getData().code);
          api.close();
        }
      });
    };

    var register$1 = function (editor) {
      editor.addCommand('mceCodeEditor', function () {
        open(editor);
      });
    };

    var register = function (editor) {
      var onAction = function () {
        return editor.execCommand('mceCodeEditor');
      };
      editor.ui.registry.addButton('code', {
        icon: 'sourcecode',
        tooltip: 'Source code',
        onAction: onAction
      });
      editor.ui.registry.addMenuItem('code', {
        icon: 'sourcecode',
        text: 'Source code',
        onAction: onAction
      });
    };

    function Plugin () {
      global.add('code', function (editor) {
        register$1(editor);
        register(editor);
        return {};
      });
    }

    Plugin();

}());

The same content is in 15 releases, Joomla 4.1.1-rc1 to 4.2.0-beta1. See them all, or every version of this file.