Updates the codemirror plugin for tinymce so that it uses it's own alias: codemirror, so the code and codemirror plugins can be enabled individually.

This commit is contained in:
Shannon
2014-11-18 14:06:43 +11:00
parent b3c291206a
commit 2d9bd394ae
3 changed files with 255 additions and 221 deletions

View File

@@ -1 +1,7 @@
tinymce.PluginManager.add("code",function(e){function o(){e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:e.getParam("code_dialog_width",600),minHeight:e.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),value:e.getContent({source_view:!0}),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(o){e.focus(),e.undoManager.transact(function(){e.setContent(o.data.code)}),e.selection.setCursorLocation(),e.nodeChanged()}})}e.addCommand("mceCodeEditor",o),e.addButton("code",{icon:"code",tooltip:"Source code",onclick:o}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:o})});
tinymce.PluginManager.add("code", function(e) {
function o() {
e.windowManager.open({ title: "Source code", body: { type: "textbox", name: "code", multiline: !0, minWidth: e.getParam("code_dialog_width", 600), minHeight: e.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)), value: e.getContent({ source_view: !0 }), spellcheck: !1, style: "direction: ltr; text-align: left" }, onSubmit: function(o) { e.focus(), e.undoManager.transact(function() { e.setContent(o.data.code) }), e.selection.setCursorLocation(), e.nodeChanged() } })
}
e.addCommand("mceCodeEditor", o), e.addButton("code", { icon: "code", tooltip: "Source code", onclick: o }), e.addMenuItem("code", { icon: "code", text: "Source code", context: "tools", onclick: o })
});

View File

@@ -1,3 +1,24 @@
tinymce.PluginManager.requireLangPack("codemirror");
tinymce.PluginManager.add("codemirror",function(a,c){function b(){a.focus();a.selection.collapse(!0);a.selection.setContent('<span class="CmCaReT" style="display:none">&#0;</span>');var b=a.windowManager.open({title:"Source code",url:c+"/source.html",width: a.getParam("code_dialog_width", 600),height: a.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),resizable:!0,maximizable:!0,buttons:[{text:"Ok",subtype:"primary",onclick:function(){document.querySelectorAll(".mce-container-body>iframe")[0].contentWindow.submit();b.close()}},{text:"Cancel",onclick:"close"}]})}a.addButton("code",
{title:"Source code",icon:"code",onclick:b});a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})});
tinymce.PluginManager.add("codemirror", function(a, c) {
function b() {
a.focus();
a.selection.collapse(!0);
a.selection.setContent('<span class="CmCaReT" style="display:none">&#0;</span>');
var b = a.windowManager.open({
title: "Source code", url: c + "/source.html", width: a.getParam("code_dialog_width", 600), height: a.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)), resizable: !0, maximizable: !0,
buttons: [
{
text: "Ok", subtype: "primary",
onclick: function() {
document.querySelectorAll(".mce-container-body>iframe")[0].contentWindow.submit();
b.close()
}
}, { text: "Cancel", onclick: "close" }
]
})
}
a.addButton("codemirror",
{ title: "Source code", icon: "code", onclick: b });
a.addMenuItem("codemirror", { icon: "code", text: "Source code", context: "tools", onclick: b })
});