mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Debug file added for TinyMce Issue http://www.tinymce.com/develop/bugtracker_view.php?id=7655
This commit is contained in:
184
e107_plugins/tinymce4/plugins/e107/debug.js
Normal file
184
e107_plugins/tinymce4/plugins/e107/debug.js
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/**
|
||||||
|
* plugin.js
|
||||||
|
*
|
||||||
|
* Copyright, Moxiecode Systems AB
|
||||||
|
* Released under LGPL License.
|
||||||
|
*
|
||||||
|
* License: http://www.tinymce.com/license
|
||||||
|
* Contributing: http://www.tinymce.com/contributing
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*global tinymce:true */
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
tinymce.create('tinymce.plugins.e107Plugin', {
|
||||||
|
|
||||||
|
init : function(ed,url) {
|
||||||
|
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
|
||||||
|
ed.on('beforeSetContent', function(e) {
|
||||||
|
|
||||||
|
e.content = t['_e107_bbcode2html'](e.content, url);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ed.on('postProcess', function(e) {
|
||||||
|
|
||||||
|
console.log(e);
|
||||||
|
alert(e.content); // remove comment to test Firefox issue: http://www.tinymce.com/develop/bugtracker_view.php?id=7655
|
||||||
|
|
||||||
|
if (e.set) {
|
||||||
|
e.content = t['_e107_bbcode2html'](e.content, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.get) {
|
||||||
|
e.content = t['_e107_html2bbcode'](e.content, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Emoticons
|
||||||
|
ed.addButton('e107-bbcode', {
|
||||||
|
text: 'bbcode',
|
||||||
|
icon: 'emoticons',
|
||||||
|
onclick: function() {
|
||||||
|
// Open window
|
||||||
|
|
||||||
|
ed.windowManager.open({
|
||||||
|
title: 'Example plugin',
|
||||||
|
body: [
|
||||||
|
{type: 'textbox', name: 'code', label: 'BbCode'},
|
||||||
|
{type: 'textbox', name: 'parm', label: 'Parameters'}
|
||||||
|
],
|
||||||
|
onsubmit: function(e) {
|
||||||
|
// Insert content when the window form is submitted
|
||||||
|
ed.insertContent('Title: ' + e.data.title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
// Media Manager Button
|
||||||
|
ed.addButton('e107-image', {
|
||||||
|
text: '',
|
||||||
|
title: 'Insert Media-Manager Image',
|
||||||
|
icon: 'image',
|
||||||
|
onclick: function() {
|
||||||
|
|
||||||
|
ed.windowManager.open({
|
||||||
|
title: 'Media Manager',
|
||||||
|
url: url + '/mediamanager.php?image',
|
||||||
|
width: 1050,
|
||||||
|
height: 650
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Media Manager Button
|
||||||
|
ed.addButton('e107-video', {
|
||||||
|
text: '',
|
||||||
|
title: 'Insert Media-Manager Video',
|
||||||
|
icon: 'media',
|
||||||
|
resizable : 'no',
|
||||||
|
inline : 'yes',
|
||||||
|
close_previous : 'no',
|
||||||
|
|
||||||
|
onclick: function() {
|
||||||
|
|
||||||
|
ed.windowManager.open({
|
||||||
|
title: 'Media Manager',
|
||||||
|
url: url + '/mediamanager.php?video',
|
||||||
|
width: 1050,
|
||||||
|
height: 650
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ed.addButton('e107-glyph', {
|
||||||
|
text: '',
|
||||||
|
title: 'Insert Media-Manager Glyph',
|
||||||
|
icon: 'charmap',
|
||||||
|
onclick: function() {
|
||||||
|
|
||||||
|
ed.windowManager.open({
|
||||||
|
title: 'Media Manager',
|
||||||
|
url: url + '/mediamanager.php?glyph',
|
||||||
|
width: 1050,
|
||||||
|
height: 650
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getInfo: function() {
|
||||||
|
return {
|
||||||
|
longname: 'e107 Parser Plugin',
|
||||||
|
author: 'e107 Inc',
|
||||||
|
authorurl: 'http://www.e107.org',
|
||||||
|
infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Private methods
|
||||||
|
|
||||||
|
// HTML -> e107 Bbcode Format
|
||||||
|
_e107_html2bbcode : function(s, url) {
|
||||||
|
s = tinymce.trim(s);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
|
||||||
|
var p = $.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url + "/parser.php",
|
||||||
|
data: { content: s, mode: 'tobbcode' },
|
||||||
|
async : false,
|
||||||
|
|
||||||
|
dataType: "html",
|
||||||
|
success: function(html) {
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}).responseText;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// e107 BBCode -> HTML
|
||||||
|
_e107_bbcode2html : function(s, url) {
|
||||||
|
s = tinymce.trim(s);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
|
||||||
|
var p = $.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url + "/parser.php",
|
||||||
|
data: { content: s, mode: 'tohtml' },
|
||||||
|
async : false,
|
||||||
|
|
||||||
|
dataType: "html",
|
||||||
|
success: function(html) {
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}).responseText;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register plugin
|
||||||
|
tinymce.PluginManager.add('e107', tinymce.plugins.e107Plugin);
|
||||||
|
})();
|
Reference in New Issue
Block a user