From c59b733023852c55268fd1771aea438a7987a522 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Wed, 11 Jul 2012 09:56:55 +0000 Subject: [PATCH] TinyMce fixes --- .../tinymce/plugins/e107bbcode/parser.php | 7 +- .../jqueryinlinepopups/editor_plugin.js | 213 ++++++++++++++++++ e107_plugins/tinymce/tinymce_setup.php | 10 +- 3 files changed, 223 insertions(+), 7 deletions(-) create mode 100644 e107_plugins/tinymce/plugins/jqueryinlinepopups/editor_plugin.js diff --git a/e107_plugins/tinymce/plugins/e107bbcode/parser.php b/e107_plugins/tinymce/plugins/e107bbcode/parser.php index 283506c15..1aecf9315 100644 --- a/e107_plugins/tinymce/plugins/e107bbcode/parser.php +++ b/e107_plugins/tinymce/plugins/e107bbcode/parser.php @@ -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); } diff --git a/e107_plugins/tinymce/plugins/jqueryinlinepopups/editor_plugin.js b/e107_plugins/tinymce/plugins/jqueryinlinepopups/editor_plugin.js new file mode 100644 index 000000000..168cec2c1 --- /dev/null +++ b/e107_plugins/tinymce/plugins/jqueryinlinepopups/editor_plugin.js @@ -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 = $('
') + .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($('
', { + 'class': 'ui-dialog-tinymce-content', + 'html': f.content + })); + } + // iFramed document + else + { + var iframe = $('