| Server IP : 172.67.191.97 / Your IP : 104.23.197.208 Web Server : Apache/2.4.63 (Ubuntu) System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.4.5 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/sig/sig2/media/plg_editors_tinymce/js/plugins/highlighter/ |
Upload File : |
/**
* plugin.js
*
* Original code by Arjan Haverkamp
* Copyright 2013-2015 Arjan Haverkamp ([email protected])
*/
window.tinymce.PluginManager.add('highlightPlus', (editor, url) => {
const showSourceEditor = () => {
editor.focus();
editor.selection.collapse(true);
if (!editor.settings.codemirror) editor.settings.codemirror = {}; // Insert caret marker
if (editor.settings.codemirror && editor.settings.codemirror.saveCursorPosition) {
editor.selection.setContent('<span style="display: none;" class="CmCaReT">�</span>');
}
let codemirrorWidth = 800;
if (editor.settings.codemirror.width) {
codemirrorWidth = editor.settings.codemirror.width;
}
let codemirrorHeight = 550;
if (editor.settings.codemirror.height) {
codemirrorHeight = editor.settings.codemirror.height;
}
const buttonsConfig = [{
type: 'custom',
text: 'Ok',
name: 'codemirrorOk',
primary: true
}, {
type: 'cancel',
text: 'Cancel',
name: 'codemirrorCancel'
}];
const config = {
title: 'Source code',
url: `${url}/source.html`,
width: codemirrorWidth,
height: codemirrorHeight,
resizable: true,
maximizable: true,
fullScreen: editor.settings.codemirror.fullscreen,
saveCursorPosition: false,
buttons: buttonsConfig
};
config.onAction = (dialogApi, actionData) => {
if (actionData.name === 'codemirrorOk') {
const doc = document.querySelectorAll('.tox-dialog__body-iframe iframe')[0];
doc.contentWindow.tinymceHighlighterSubmit();
editor.undoManager.add(); // eslint-disable-next-line no-use-before-define
win.close();
}
};
const win = editor.windowManager.openUrl(config);
if (editor.settings.codemirror.fullscreen) {
win.fullscreen(true);
}
};
editor.ui.registry.addButton('code', {
icon: 'sourcecode',
title: 'Source code+',
tooltip: 'Source code+',
onAction: showSourceEditor
});
editor.ui.registry.addMenuItem('code', {
icon: 'sourcecode',
text: 'Source code+',
onAction: showSourceEditor,
context: 'tools'
});
});