From 54402fe2b24f99ae28beac3ee5bed849028af1fc Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 29 Sep 2015 12:11:15 -0700 Subject: [PATCH] TinyMce upgraded to v4.2 and no-save issue corrected. Old files removed. --- e107_plugins/tinymce4/e_footer.php | 54 +-- e107_plugins/tinymce4/plugins/e107/debug.js | 184 ---------- .../tinymce4/plugins/e107/editor_plugin.js | 323 ------------------ e107_plugins/tinymce4/plugins/e107/plugin.js | 2 +- 4 files changed, 4 insertions(+), 559 deletions(-) delete mode 100644 e107_plugins/tinymce4/plugins/e107/debug.js delete mode 100644 e107_plugins/tinymce4/plugins/e107/editor_plugin.js diff --git a/e107_plugins/tinymce4/e_footer.php b/e107_plugins/tinymce4/e_footer.php index 023ad961d..10fd5ce90 100644 --- a/e107_plugins/tinymce4/e_footer.php +++ b/e107_plugins/tinymce4/e_footer.php @@ -17,10 +17,7 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL { if(e_PAGE != 'image.php') { - //e107::js('tinymce','tiny_mce.js','jquery'); - //e107::js('tinymce','wysiwyg.php','jquery',5); - // e107::js('footer', "https://tinymce.cachefly.net/4.2/tinymce.min.js"); - e107::js('footer', "https://tinymce.cachefly.net/4.0/tinymce.min.js"); // 4.1 and 4.2 have issues with saving under Firefox. http://www.tinymce.com/develop/bugtracker_view.php?id=7655 + e107::js('footer', "https://tinymce.cachefly.net/4.2/tinymce.min.js"); e107::js('footer',e_PLUGIN.'tinymce4/wysiwyg.php','jquery',5); // Add to e107_config.php to view hidden content when TinyMce not saving correctly @@ -48,8 +45,8 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL if(ADMIN) { $insert = "$('#'+id).after('
"; - $insert .= "Switch to bbcode<\/a>"; - + + if(e_PAGE == 'mailout.php') { $insert .= "  ".LAN_MAILOUT_16."<\/a>"; @@ -83,9 +80,7 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL $('.e-wysiwyg').each(function() { var id = $(this).attr('id'); // 'e-wysiwyg'; - console.log(id); ".SWITCH_TO_BB." - // alert(id); $('#bbcode-panel-'+id+'--preview').hide(); }); @@ -98,27 +93,6 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL }); - - /* - $('img.tinyInsertEmote').live('click',function() { - - var src = $(this).attr('src'); - // alert(src); - // var html = '\'emote\''; - tinyMCE.execCommand('mceInsertRawHTML',false, 'hi there'); - ; - $('.mceContentBody', window.top.document).tinymce().execCommand('mceInsertContent',false,src); - - // tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src); - - $('#uiModal').modal('hide'); - return true; - }); - */ - - - - // When new tab is added - convert textarea to TinyMce. $('.e-tabs-add').on('click',function(){ @@ -133,28 +107,6 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL }); - $('a.e-wysiwyg-toggle').toggle(function(){ - - var id = $(this).attr('id'); // eg. news-body - - $('#bbcode-panel-'+id+'--preview').show(); - $(this).text('Switch to wysiwyg'); - - 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.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(); diff --git a/e107_plugins/tinymce4/plugins/e107/debug.js b/e107_plugins/tinymce4/plugins/e107/debug.js deleted file mode 100644 index a8dd69318..000000000 --- a/e107_plugins/tinymce4/plugins/e107/debug.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * 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('postProcess executed'); // 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); -})(); \ No newline at end of file diff --git a/e107_plugins/tinymce4/plugins/e107/editor_plugin.js b/e107_plugins/tinymce4/plugins/e107/editor_plugin.js deleted file mode 100644 index ff24d4f35..000000000 --- a/e107_plugins/tinymce4/plugins/e107/editor_plugin.js +++ /dev/null @@ -1,323 +0,0 @@ -/** - * $Id$ - * - * @author Moxiecode - * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. - */ - -(function() { - tinymce.create('tinymce.plugins.e107BBCodePlugin', { - init : function(ed, url) { - - // Bootstrap - ed.addCommand('mceBoot', function() { - ed.windowManager.open({ - file : url + '/dialog.php', - width : 900 , // + parseInt(ed.getLang('e107bbcode.delta_width', 0)), - height : 450, // + parseInt(ed.getLang('e107bbcode.delta_height', 0)), - inline : 1 - }, { - plugin_url : url, // Plugin absolute URL - some_custom_arg : 'custom arg' // Custom argument - }); - }); - - // Register button - ed.addButton('bootstrap', { - title : 'Insert Bootstrap Elements', - cmd : 'mceBoot', - image : url + '/img/bootstrap.png' - }); - - // e107 Bbcode - ed.addCommand('mcee107', function() { - ed.windowManager.open({ - file : url + '/dialog.php?bbcode', - width : 900 , // + parseInt(ed.getLang('e107bbcode.delta_width', 0)), - height : 450, // + parseInt(ed.getLang('e107bbcode.delta_height', 0)), - inline : 1 - }, { - plugin_url : url, // Plugin absolute URL - some_custom_arg : 'custom arg' // Custom argument - }); - }); - - // Register button - ed.addButton('e107bbcode', { - title : 'Insert e107 Bbcode', - cmd : 'mcee107', - image : url + '/img/bbcode.png' - }); - - - - // Add a node change handler, selects the button in the UI when a image is selected - // ed.onNodeChange.add(function(ed, cm, n) { - // cm.setActive('example', n.nodeName == 'IMG'); - // }); - - - // ------------ - - - var t = this, dialect = ed.getParam('bbcode_dialect', 'e107').toLowerCase(); - - ed.onBeforeSetContent.add(function(ed, o) { - - o.content = t['_' + dialect + '_bbcode2html'](o.content,url); - }); - - ed.onPostProcess.add(function(ed, o) { - if (o.set) - o.content = t['_' + dialect + '_bbcode2html'](o.content,url); - - if (o.get) - o.content = t['_' + dialect + '_html2bbcode'](o.content,url); - }); - }, - - getInfo : function() { - return { - longname : 'e107 BBCode Plugin', - author : 'Moxiecode Systems AB - Modified by e107 Inc', - authorurl : 'http://e107.org', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', - version : tinymce.majorVersion + "." + tinymce.minorVersion - }; - }, - - // Private methods - - // HTML -> BBCode in PunBB dialect - _e107_html2bbcode : function(s,url) { - s = tinymce.trim(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; - - - - - function rep(re, str) { - s = s.replace(re, str); - } - - // return s; - - rep(//gim, "[table]"); - rep(/<\/table>/gim, "[/table]"); - rep(//gim, "[td]"); - rep(/<\/td>/gim, "[/td]"); - rep(//gim, "[tr]"); - rep(/<\/tr>/gim, "[/tr]"); - rep(//gim, "[tbody]"); - rep(/<\/tbody>/gim, "[/tbody]"); - - - rep(/
([\s\S]*)<\/div>/gi,"[center]$1[/center]"); // verified - - rep(/
  • /gi, "[*]"); // verified - rep(/<\/li>/gi, ""); // verified - rep(/