1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-30 09:39:55 +02:00

TinyMce4 fixes. Video and Glyph plugins working again. Editor toggle button working. And embedded video thumbnail workaround added.

This commit is contained in:
Cameron
2015-04-02 02:49:19 -07:00
parent 21f3f2ed19
commit f253d00560
26 changed files with 2505 additions and 82 deletions

View File

@@ -19,7 +19,7 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
//e107::js('tinymce','tiny_mce.js','jquery');
//e107::js('tinymce','wysiwyg.php','jquery',5);
e107::js('footer', "http://tinymce.cachefly.net/4.0/tinymce.min.js");
e107::js('footer', "http://tinymce.cachefly.net/4.1/tinymce.min.js");
e107::js('footer',e_PLUGIN.'tinymce4/wysiwyg.php','jquery',5);
// e107::js('inline', "
// tinymce.init({selector:'.e-wysiwyg'});
@@ -29,13 +29,14 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
}
else
{
e107::js('tinymce4','plugins/compat3x/tiny_mce_popup.js');
// e107::js('tinymce','tiny_mce_popup.js','jquery');
}
if(ADMIN)
{
$insert = "$('#'+id).after('<div>";
// $insert .= "<a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle btn btn-inverse btn-mini\">Switch to bbcode<\/a>";
$insert .= "<a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle btn btn-inverse btn-mini\">Switch to bbcode<\/a>";
if(e_PAGE == 'mailout.php')
{
@@ -59,86 +60,97 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
// <div><a href='#' class='e-wysiwyg-switch' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'".$tinyMceID."');expandit('".$toggleID."');\">Toggle WYSIWYG</a></div>
e107::js('footer-inline',"
<!---- TinyMCE Footer Inline Code -->
$(function() {
$('.e-wysiwyg').each(function() {
var id = $(this).attr('id'); // 'e-wysiwyg';
console.log(id);
".SWITCH_TO_BB."
// alert(id);
$('#bbcode-panel-'+id+'--preview').hide();
});
$('.tinyInsert').click(function() {
var val = $(this).attr('data-value');
var val = $(this).attr('data-value');
top.tinymce.activeEditor.execCommand('mceInsertContent',0,val);
return false;
return false;
});
/*
$('img.tinyInsertEmote').live('click',function() {
var src = $(this).attr('src');
// alert(src);
var src = $(this).attr('src');
// alert(src);
// var html = '<img src=\''+src +'\' alt=\'emote\' />';
tinyMCE.execCommand('mceInsertRawHTML',false, 'hi there');
;
$('.mceContentBody', window.top.document).tinymce().execCommand('mceInsertContent',false,src);
// tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src);
// tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src);
$('#uiModal').modal('hide');
return true;
return true;
});*/
// When new tab is added - convert textarea to TinyMce.
// When new tab is added - convert textarea to TinyMce.
$('.e-tabs-add').on('click',function(){
alert('New Page Added'); // added for delay - quick and dirty work-around. XXX fixme
var idt = $(this).attr('data-target'); // eg. news-body
var idt = $(this).attr('data-target'); // eg. news-body
var ct = parseInt($('#e-tab-count').val());
var id = idt + '-' + ct;
$('#bbcode-panel-'+id+'--preview').hide();
".SWITCH_TO_BB."
top.tinymce.activeEditor.execCommand('mceAddControl', false, id);
});
$('a.e-wysiwyg-toggle').toggle(function(){
var id = $(this).attr('id'); // eg. news-body
var id = $(this).attr('id'); // eg. news-body
$('#bbcode-panel-'+id+'--preview').show();
$(this).text('Switch to wysiwyg');
tinymce.activeEditor.execCommand('mceRemoveControl', false, id);
tinymce.EditorManager.execCommand('mceRemoveEditor',true, id); //v4.x
// tinymce.remove('#'+id);
// tinymce.activeEditor.execCommand('mceRemoveControl', false, id);
// $('#'+id).tinymce().remove();
}, function () {
var id = $(this).attr('id');
$('#bbcode-panel-'+id+'--preview').hide();
$(this).text('Switch to bbcode');
tinymce.activeEditor.execCommand('mceAddControl', false, id);
});
$('.e-dialog-save').on('click', function(){
// var html = $('#html_holder').val();
var s = $('#bbcode_holder').val();
tinymce.EditorManager.execCommand('mceAddEditor',true, id); //v4.x
// tinymce.remove('#'+id);
// tinymce.activeEditor.execCommand('mceAddControl', false, id);
});
$(document).on('click','.e-dialog-save', function(){
// var html = $('#html_holder').val();
var s = $('#bbcode_holder').val();
// alert(s);
var p = $.ajax({
type: 'POST',
url: '".e_PLUGIN_ABS. "tinymce4/plugins/e107/parser.php', // parse bbcode value
url: '".e_PLUGIN_ABS. "tinymce4/plugins/e107/parser.php', // parse bbcode value
data: { content: s, mode: 'tohtml' },
async : false,
@@ -146,40 +158,42 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
success: function(html) {
return html;
}
}).responseText;
html = p;
// alert(html);
// alert(s);
if(html === undefined)
{
return;
}
// tinyMCE.execCommand('mceInsertContent',false,html);
top.tinymce.activeEditor.execCommand('mceInsertRawHTML',false,html);
top.tinymce.activeEditor.windowManager.close();
});
// $('.e-dialog-close').click(function(){
// top.tinymce.activeEditor.windowManager.close();
// });
$('.e-dialog-close').click(function(){
// top.tinymce.activeEditor.windowManager.close();
});
});
","jquery", 1);
}
?>