- md5
- fb7f1731763b31c1c760d903752d353a
- sha1
- 45844d6b9c05300e1c455dc9adc1404a51640aab
- sha256
- 01f4f92e4fb1851125d3bb3a1811bda3c187241e8e013210ae2f814020d01683
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
/**
* 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);
editor.options.register('codemirror', {
processor: 'object',
default: {
codemirrorWidth: 800,
codemirrorHeight: 550,
fullscreen: false,
indentOnInit: true,
config: {
mode: 'htmlmixed',
theme: 'default',
lineNumbers: true,
lineWrapping: true,
indentUnit: 2,
tabSize: 2,
indentWithTabs: true,
matchBrackets: true,
saveCursorPosition: false,
styleActiveLine: true
}
}
});
const cmSettings = editor.options.get('codemirror');
// Insert caret marker
if (cmSettings.config.saveCursorPosition) {
editor.selection.setContent('<span style="display: none;" class="CmCaReT">�</span>');
}
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: cmSettings.width,
height: cmSettings.height,
resizable: true,
maximizable: true,
fullScreen: cmSettings.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 (cmSettings.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'
});
});
No other release has this exact content. See every version of this file.