/* * NOTICE OF LICENSE * * This product is licensed for one customer to use on one installation (test stores and multishop included). * Site developer has the right to modify this module to suit their needs, but can not redistribute the module in * whole or in part. Any other use of this module constitutes a violation of the user agreement. * * DISCLAIMER * * NO WARRANTIES OF DATA SAFETY OR MODULE SECURITY * ARE EXPRESSED OR IMPLIED. USE THIS MODULE IN ACCORDANCE * WITH YOUR MERCHANT AGREEMENT, KNOWING THAT VIOLATIONS OF * PCI COMPLIANCY OR A DATA BREACH CAN COST THOUSANDS OF DOLLARS * IN FINES AND DAMAGE A STORES REPUTATION. USE AT YOUR OWN RISK. * * @author idnovate.com * @copyright 2022 idnovate.com * @license See above */ /*jshint unused:false */ /*global tinymce:true */ tinymce.PluginManager.requireLangPack('codemirror'); tinymce.PluginManager.add('codemirror', function (editor, url) { function showSourceEditor() { editor.focus(); editor.selection.collapse(true); // Insert caret marker if (editor.settings.codemirror.saveCursorPosition) { editor.selection.setContent(''); } codemirrorWidth = 800; if (editor.settings.codemirror.width) { codemirrorWidth = editor.settings.codemirror.width; } codemirrorHeight = 550; if (editor.settings.codemirror.width) { codemirrorHeight = editor.settings.codemirror.height; } var config = { title: 'HTML source code', url: url + '/source.html', width: codemirrorWidth, height: codemirrorHeight, resizable: true, maximizable: true, fullScreen: editor.settings.codemirror.fullscreen, saveCursorPosition: false, search: false, buttons: [ { text: 'Ok', subtype: 'primary', onclick: function () { var doc = document.querySelectorAll('.mce-container-body>iframe')[0]; doc.contentWindow.submit(); win.close(); } }, {text: 'Cancel', onclick: 'close'} ] }; var win = editor.windowManager.open(config); if (editor.settings.codemirror.fullscreen) { win.fullscreen(true); } }; // Add a button to the button bar editor.addButton('code', { title: 'Source code', icon: 'code', onclick: showSourceEditor }); // Add a menu item to the tools menu editor.addMenuItem('code', { icon: 'code', text: 'Source code', context: 'tools', onclick: showSourceEditor }); });