1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-13 17:09:46 +01:00

TinyMce fixes

This commit is contained in:
CaMer0n 2012-07-11 09:56:55 +00:00
parent ab11d260ee
commit c59b733023
3 changed files with 223 additions and 7 deletions

View File

@ -12,17 +12,20 @@
require_once("../../../../class2.php");
if($_POST['mode'] == 'tohtml')
{
$content = $tp->toDB($_POST['content']);
e107::getBB()->setClass($_SESSION['media_category']);
echo $tp->toHtml($_POST['content'],true);
echo $tp->toHtml($content,true);
e107::getBB()->clearClass();
}
if($_POST['mode'] == 'tobbcode')
{
// echo $_POST['content'];
echo e107::getBB()->htmltoBBcode($_POST['content']);
$content = stripslashes($_POST['content']);
echo e107::getBB()->htmltoBBcode($content);
}

View File

@ -0,0 +1,213 @@
/**
* @filename : editor_plugin.js
* @description : jQuery UI Inline Popups plugin to replace the default inlinepopups
* @developer : badsyntax (Richard Willis)
* @contact : http://badsyntax.co
* @moreinfo : http://is.gd/j1FuI
*/
(function() {
var DOM = tinymce.DOM,
Event = tinymce.dom.Event,
each = tinymce.each;
// Create the editor plugin
tinymce.create('tinymce.plugins.jQueryInlinePopups', {
init : function(ed, url) {
// Replace window manager
ed.onBeforeRenderUI.add(function() {
ed.windowManager = new tinymce.InlineWindowManager(ed);
});
},
getInfo : function() {
return {
longname : 'jQuery UI Inline Popups',
author : 'Richard Willis',
authorurl : 'http://badsyntax.co',
infourl : 'http://is.gd/j1FuI',
version : '0.1b'
};
}
});
// Create the window manager
tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
InlineWindowManager : function(ed) {
this.parent(ed);
this.windows = {};
},
open : function(f, p) {
f = f || {};
p = p || {};
// Run native windows
if (!f.inline) {
return t.parent(f, p);
}
var
t = this,
id = DOM.uniqueId(),
// Dialog config
config = {
title: f.title || '',
width: 'auto',
height: 'auto',
modal: true,
resizable: false,
draggable: true,
dialogClass: 'ui-dialog-tinymce',
// match the tinymce inlinepopups starting z-index (fixes #3)
zIndex: 300000
},
// Dialog element
dialog = $('<div />')
.attr('id', 'dialog-' + id)
.hide()
.appendTo('body'),
// Window info
w = {
id : id,
features : f,
element: dialog
};
// Only store selection if the type is a normal window.
// This is required at least for IE to remeber the position
// before the focus from editor is lost.
if (!f.type) {
this.bookmark = this.editor.selection.getBookmark(1);
}
// Inline content
if (f.content){
if (f.type == 'confirm'){
config.buttons = [{
'text': 'Ok',
'click': function(e){
f.button_func(true);
}
}, {
'text': 'Cancel',
'click': function(e){
f.button_func(false);
}
}];
}
else if (f.type == 'alert'){
config.buttons = [{
'text': 'Ok',
'click': function(e){
f.button_func(true);
}
}];
}
dialog.html($('<div />', {
'class': 'ui-dialog-tinymce-content',
'html': f.content
}));
}
// iFramed document
else
{
var iframe = $('<iframe />', {
id: id + '_ifr',
frameborder: 0
})
.css({
width: f.width,
height: f.height + 5
})
.attr('scrollbars', 'no')
.appendTo(dialog);
}
p.mce_inline = true;
p.mce_window_id = id;
p.mce_auto_focus = f.auto_focus;
this.features = f;
this.params = p;
this.onOpen.dispatch(this, f, p);
dialog
.dialog(config)
.dialog('option', 'width', dialog.innerWidth())
.dialog('option', 'position', dialog.dialog('option', 'position'));
// Load in iframe src
if (!f.content) {
iframe.attr( 'src', f.url || f.file );
}
// Add window
t.windows[id] = w;
return w;
},
resizeBy : function(dw, dh, id) { return; },
focus : function(id) { return; },
close : function(win, id) {
var t = this, w, id = id || win.frameElement.id.replace(/_ifr$/, '');
// Probably not inline
if (!t.windows[id]) {
t.parent(win);
return;
}
if (w = t.windows[id]) {
w.element.dialog('destroy').remove();
delete t.windows[id];
}
},
setTitle : function(w, ti) {
var id = w.frameElement.id.replace(/_ifr$/, '');
$('#ui-dialog-title-dialog-' + id).html(ti);
},
alert : function(txt, cb, s) {
this._messagePopup('alert', 'Alert', txt, cb, s);
},
confirm : function(txt, cb, s) {
this._messagePopup('confirm', 'Confirm', txt, cb, s);
},
_messagePopup : function(type, title, txt, cb, s) {
var t = this, w;
w = t.open({
title : title,
type : type,
button_func : function(s) {
(cb) && cb.call(s || t, s);
t.close(null, w.id);
},
content : DOM.encode(t.editor.getLang(txt, txt)),
inline : 1,
width : 400,
height : 130
});
}
});
// Register plugin
tinymce.PluginManager.add('jqueryinlinepopups', tinymce.plugins.jQueryInlinePopups);
})();

View File

@ -31,11 +31,11 @@ class tinymce_setup
$query = "INSERT INTO #tinymce (
`tinymce_id`, `tinymce_name`, `tinymce_userclass`, `tinymce_plugins`, `tinymce_buttons1`, `tinymce_buttons2`, `tinymce_buttons3`, `tinymce_buttons4`, `tinymce_custom`, `tinymce_prefs`) VALUES
(1, 'Simple Users', '252', 'e107bbcode,emoticons', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
(2, 'Members', '253', 'e107bbcode,emoticons,table', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
(3, 'Administrators', '254', 'e107bbcode,contextmenu,emoticons,ibrowser,iespell,paste,table,xhtmlxtras', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''),
(4, 'Main Admin', '250', 'e107bbcode,advhr,advlink,autoresize,contextmenu,directionality,emoticons,ibrowser,paste,table,visualchars,wordcount,xhtmlxtras,zoom', 'bold, italic, underline, undo, redo, link, unlink, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''
);";
(1, 'Simple Users', '252', 'e107bbcode,emoticons,jqueryinlinepopups,', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
(2, 'Members', '253', 'e107bbcode,emoticons,table,jqueryinlinepopups', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
(3, 'Administrators', '254', 'contextmenu,e107bbcode,jqueryinlinepopups,emoticons,ibrowser,iespell,paste,table,xhtmlxtras', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''),
(4, 'Main Admin', '250', 'advhr,advlink,autoresize,contextmenu,directionality,e107bbcode,emoticons,ibrowser,jqueryinlinepopups,media,paste,table,visualchars,wordcount,xhtmlxtras,youtube,zoom', 'link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons,media,youtube', '', '', '', '', '');
";
if($sql->db_Select_gen($query))
{