init
This commit is contained in:
1 parent
fac05a7b6c
commit
476ade10e7
1085 files changed
+259628
No files matched your search
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright 2013 Web Power, www.webpower.nl
|
||||
* @author Arjan Haverkamp
|
||||
*/
|
||||
|
||||
/*jshint unused:false */
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.requireLangPack('codemirror');
|
||||
|
||||
tinymce.PluginManager.add('codemirror', function(editor, url) {
|
||||
|
||||
function showSourceEditor() {
|
||||
// Insert caret marker
|
||||
editor.focus();
|
||||
editor.selection.collapse(true);
|
||||
editor.selection.setContent('<span class="CmCaReT" style="display:none">�</span>');
|
||||
|
||||
// Open editor window
|
||||
var win = editor.windowManager.open({
|
||||
title: 'HTML source code',
|
||||
url: url + '/source.html',
|
||||
width: 800,
|
||||
height: 550,
|
||||
resizable : true,
|
||||
maximizable : true,
|
||||
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' }
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
// Add a button to the button bar
|
||||
editor.addButton('code', {
|
||||
title: 'Source code',
|
||||
image: url + '/img/file-html.png',
|
||||
onclick: showSourceEditor
|
||||
});
|
||||
|
||||
// Add a menu item to the tools menu
|
||||
editor.addMenuItem('code', {
|
||||
icon: 'code',
|
||||
text: 'Source code',
|
||||
context: 'tools',
|
||||
onclick: showSourceEditor
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user