diff --git a/wp-includes/js/dbx.js b/wp-includes/js/dbx.js index 8c355a45ff..8e89c5afe8 100644 --- a/wp-includes/js/dbx.js +++ b/wp-includes/js/dbx.js @@ -1,6 +1,6 @@ -// DBX2.02 :: Docking Boxes (dbx) +// DBX2.05 :: Docking Boxes (dbx) // ***************************************************** // DOM scripting by brothercake -- http://www.brothercake.com/ // GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html //****************************************************** -var dbx;function dbxManager(sid){dbx = this;if(!/^[-_a-z0-9]+$/i.test(sid)) { alert('Error from dbxManager:\n"' + sid + '" is an invalid session ID'); return; }this.supported = !(document.getElementsByTagName('*').length == 0 || (navigator.vendor == 'KDE' && typeof window.sidebar == 'undefined'));if(!this.supported) { return; }this.etype = typeof document.addEventListener != 'undefined' ? 'addEventListener' : typeof document.attachEvent != 'undefined' ? 'attachEvent' : 'none';this.eprefix = (this.etype == 'attachEvent' ? 'on' : '');if(typeof window.opera != 'undefined' && parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(' ')[0], 10) < 7.5){this.etype = 'none';}if(this.etype == 'none') { this.supported = false; return; }this.running = 0;this.sid = sid;this.savedata = {};this.cookiestate = this.getCookieState();};dbxManager.prototype.setCookieState = function(){var now = new Date();now.setTime(now.getTime() + (365*24*60*60*1000));var str = '';for(j in this.savedata){if(typeof this.savedata[j]!='function'){str += j + '=' + this.savedata[j] + '&'}}this.state = str.replace(/^(.+)&$/, '$1');if(typeof this.onstatechange == 'undefined' || this.onstatechange()){document.cookie = 'dbx-' + this.sid + '='+ this.state+ '; expires=' + now.toGMTString()+ '; path=/';}};dbxManager.prototype.getCookieState = function(){this.cookiestate = null;if(document.cookie){if(document.cookie.indexOf('dbx-' + this.sid)!=-1){this.cookie = document.cookie.split('dbx-' + this.sid + '=')[1].split('&');for(var i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookie[i] = this.cookie[i].split('=');this.cookie[i][1] = this.cookie[i][1].split(',');}}this.cookiestate = {};for(i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookiestate[this.cookie[i][0]] = this.cookie[i][1];}}}}return this.cookiestate;};dbxManager.prototype.addDataMember = function(gid, order){this.savedata[gid] = order;};dbxManager.prototype.createElement = function(tag){return typeof document.createElementNS != 'undefined' ? document.createElementNS('http://www.w3.org/1999/xhtml', tag) : document.createElement(tag);};dbxManager.prototype.getTarget = function(e, pattern, node){if(typeof node != 'undefined'){var target = node;}else{target = typeof e.target != 'undefined' ? e.target : e.srcElement;}var regex = new RegExp(pattern, '');while(!regex.test(target.className)){target = target.parentNode;}return target;};function dbxGroup(gid, dir, thresh, fix, ani, togs, def, open, close, move, toggle, kmove, ktoggle, syntax){if(!/^[-_a-z0-9]+$/i.test(gid)) { alert('Error from dbxGroup:\n"' + gid + '" is an invalid container ID'); return; }this.container = document.getElementById(gid);if(this.container == null || !dbx.supported) { return; }var self = this;this.gid = gid;this.dragok = false;this.box = null;this.vertical = dir == 'vertical';this.threshold = parseInt(thresh, 10);this.restrict = fix == 'yes';this.resolution = parseInt(ani, 10);this.toggles = togs == 'yes';this.defopen = def != 'closed';this.vocab = {'open' : open,'close' : close,'move' : move,'toggle' : toggle,'kmove' : kmove,'ktoggle' : ktoggle,'syntax' : syntax};this.container.style.position = 'relative';this.container.style.display = 'block';if(typeof window.opera != 'undefined'){this.container.style.display = 'run-in';}this.boxes = [];this.buttons = [];this.order = [];this.eles = this.container.getElementsByTagName('*');for(var i=0; i 0)){var sibling = this.boxes[positions[i + (positive ? 1 : -1)][0]];if(this.resolution > 0){var visipos = { 'x' : parent.offsetLeft, 'y' : parent.offsetTop };var siblingpos = { 'x' : sibling.offsetLeft, 'y' : sibling.offsetTop };}var obj = { 'insert' : (positive ? sibling : parent), 'before' : (positive ? parent : sibling) };this.container.insertBefore(obj.insert, obj.before);if(this.resolution > 0){var animators ={'sibling' : new dbxAnimator(this, sibling, siblingpos, this.resolution, true, anchor),'parent' : new dbxAnimator(this, parent, visipos, this.resolution, true, anchor)};}else{anchor.focus();}break;}}}this.getBoxOrder();}};dbxGroup.prototype.compare = function(a, b){return a[1] - b[1];};dbxGroup.prototype.createTooltip = function(isopen, anchor){if(this.keydown){this.tooltip = this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility = 'hidden';this.tooltip.className = 'dbx-tooltip';if(isopen != null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove + this.vocab.ktoggle.replace('%toggle%', isopen ? this.vocab.close : this.vocab.open)));}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove));}var parent = dbx.getTarget(null, 'dbx\-box', anchor);this.tooltip.style.left = parent.offsetLeft + 'px';this.tooltip.style.top = parent.offsetTop + 'px';var tooltip = this.tooltip;window.setTimeout(function(){if(tooltip != null) { tooltip.style.visibility = 'visible'; }}, 500);}};dbxGroup.prototype.removeTooltip = function(){if(this.tooltip != null){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip = null;}};dbxGroup.prototype.mousedown = function(e, box){var node = typeof e.target != 'undefined' ? e.target : e.srcElement;if(node.nodeName == '#text') { node = node.parentNode; }if(!/dbx\-(toggle|box|group)/i.test(node.className)){while(!/dbx\-(handle|box|group)/i.test(node.className)){node = node.parentNode;}}if(/dbx\-handle/i.test(node.className)){this.removeTooltip();this.released = false;this.initial = { 'x' : e.clientX, 'y' : e.clientY };this.current = { 'x' : 0, 'y' : 0 };this.createCloneBox(box);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return false; }}}};dbxGroup.prototype.mousemove = function(e){if(this.dragok && this.box != null){this.positive = this.vertical ? (e.clientY > this.current.y ? true : false) : (e.clientX > this.current.x ? true : false);this.current = { 'x' : e.clientX, 'y' : e.clientY };var overall = { 'x' : this.current.x - this.initial.x, 'y' : this.current.y - this.initial.y };if(((overall.x >= 0 && overall.x <= this.threshold) || (overall.x <= 0 && overall.x >= 0 - this.threshold))&&((overall.y >= 0 && overall.y <= this.threshold) || (overall.y <= 0 && overall.y >= 0 - this.threshold))){this.current.x -= overall.x;this.current.y -= overall.y;}if(this.released || overall.x > this.threshold || overall.x < (0 - this.threshold) || overall.y > this.threshold || overall.y < (0 - this.threshold)){dbx.group = this.container;dbx.box = this.box;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){this.released = true;if(!this.restrict || !this.vertical) { this.boxclone.style.left = (this.current.x - this.difference.x) + 'px'; }if(!this.restrict || this.vertical) { this.boxclone.style.top = (this.current.y - this.difference.y) + 'px'; }this.moveOriginalToPosition(this.current.x, this.current.y);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }}}}return true;};dbxGroup.prototype.mouseup = function(e){if(this.box != null){this.moveOriginalToPosition(e.clientX, e.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return true; }}}this.dragok = false;};dbxGroup.prototype.keypress = function(e, anchor){if(/^(3[7-9])|(40)$/.test(e.keyCode)){this.removeTooltip();if((this.vertical && /^(38|40)$/.test(e.keyCode)) || (!this.vertical && /^(37|39)$/.test(e.keyCode))){this.shiftBoxPosition(e, anchor, /^[3][78]$/.test(e.keyCode) ? false : true);if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }typeof e.stopPropagation != 'undefined' ? e.stopPropagation() : e.cancelBubble = true;this.keydown = false;}}return true;};dbxGroup.prototype.getBoxOrder = function(){this.order = [];var len = this.eles.length;for(var j=0; j boxprops.xy && cloneprops.xy < boxprops.xy)||(!this.positive && cloneprops.xy < boxprops.xy && cloneprops.xy + cloneprops.wh > boxprops.xy)){if(this.boxes[i] == this.box) { return; }var sibling = this.box.nextSibling;while(sibling.className == null || !/dbx\-box/.test(sibling.className)){sibling = sibling.nextSibling;}if(this.boxes[i] == sibling) { return; }if(this.resolution > 0){if(this.box[this.vertical ? 'offsetTop' : 'offsetLeft'] < boxprops.xy){var visibox = this.boxes[i].previousSibling;while(visibox.className == null || !/dbx\-box/.test(visibox.className)){visibox = visibox.previousSibling;}}else{visibox = this.boxes[i];}var visipos = { 'x' : visibox.offsetLeft, 'y' : visibox.offsetTop };}var prepos = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.container.insertBefore(this.box, this.boxes[i]);this.initial.x += (this.box.offsetLeft - prepos.x);this.initial.y += (this.box.offsetTop - prepos.y);if(this.resolution > 0 && visibox != this.box){var animator = new dbxAnimator(this, visibox, visipos, this.resolution, false, null);}else{}break;}}};function dbxAnimator(caller, box, pos, res, kbd, anchor){this.caller = caller;this.box = box;this.timer = null;var before = pos[this.caller.vertical ? 'y' : 'x'];var after = this.box[this.caller.vertical ? 'offsetTop' : 'offsetLeft'];if(before != after){if(dbx.running > this.caller.boxes.length - 1) { return; }var clone = this.caller.createClone(this.box, 29999, arguments[2]);clone.style.visibility = 'visible';this.box.style.visibility = 'hidden';this.animateClone(clone,before,after > before ? after - before : 0 - (before - after),this.caller.vertical ? 'top' : 'left',res,kbd,anchor);}};dbxAnimator.prototype.animateClone = function(clone, current, change, dir, res, kbd, anchor){var self = this;var count = 0;dbx.running ++;this.timer = window.setInterval(function(){count ++;current += change / res;clone.style[dir] = current + 'px';if(count == res){window.clearTimeout(self.timer);self.timer = null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility = 'visible';if(kbd){if(anchor != null && anchor.parentNode.style.visibility != 'hidden'){anchor.focus();}else if(self.caller.toggles){var button = self.caller.buttons[parseInt(self.box.className.split('dbxid')[1],10)];if(button != null && typeof button.isactive != 'undefined'){button.focus();}}}}}, 20);};if(typeof window.attachEvent != 'undefined'){window.attachEvent('onunload', function(){var ev = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'click', 'keydown', 'keyup', 'focus', 'blur', 'selectstart', 'statechange', 'boxdrag', 'boxopen', 'boxclose'];var el = ev.length;var dl = document.all.length;for(var i=0; i 0)){var sibling = this.boxes[positions[i + (positive ? 1 : -1)][0]];if(this.resolution > 0){var visipos = { 'x' : parent.offsetLeft, 'y' : parent.offsetTop };var siblingpos = { 'x' : sibling.offsetLeft, 'y' : sibling.offsetTop };}var obj = { 'insert' : (positive ? sibling : parent), 'before' : (positive ? parent : sibling) };this.container.insertBefore(obj.insert, obj.before);if(this.resolution > 0){var animators ={'sibling' : new dbxAnimator(this, sibling, siblingpos, this.resolution, true, anchor),'parent' : new dbxAnimator(this, parent, visipos, this.resolution, true, anchor)};}else{anchor.focus();}break;}}}this.getBoxOrder();}};dbxGroup.prototype.compare = function(a, b){return a[1] - b[1];};dbxGroup.prototype.createTooltip = function(isopen, anchor){if(this.keydown){this.tooltip = this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility = 'hidden';this.tooltip.className = 'dbx-tooltip';if(isopen != null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove + this.vocab.ktoggle.replace('%toggle%', isopen ? this.vocab.close : this.vocab.open)));}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove));}var parent = dbx.getTarget(null, 'dbx\-box', anchor);this.tooltip.style.left = parent.offsetLeft + 'px';this.tooltip.style.top = parent.offsetTop + 'px';var tooltip = this.tooltip;window.setTimeout(function(){if(tooltip != null) { tooltip.style.visibility = 'visible'; }}, 500);}};dbxGroup.prototype.removeTooltip = function(){if(this.tooltip != null){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip = null;}};dbxGroup.prototype.mousedown = function(e, box){var node = typeof e.target != 'undefined' ? e.target : e.srcElement;if(node.nodeName == '#text') { node = node.parentNode; }if(!/dbx\-(toggle|box|group)/i.test(node.className)){while(!/dbx\-(handle|box|group)/i.test(node.className)){node = node.parentNode;}}if(/dbx\-handle/i.test(node.className)){this.removeTooltip();this.released = false;this.initial = { 'x' : e.clientX, 'y' : e.clientY };this.current = { 'x' : 0, 'y' : 0 };this.createCloneBox(box);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return false; }}}};dbxGroup.prototype.mousemove = function(e){if(this.dragok && this.box != null){this.positive = this.vertical ? (e.clientY > this.current.y ? true : false) : (e.clientX > this.current.x ? true : false);this.current = { 'x' : e.clientX, 'y' : e.clientY };var overall = { 'x' : this.current.x - this.initial.x, 'y' : this.current.y - this.initial.y };if(((overall.x >= 0 && overall.x <= this.threshold) || (overall.x <= 0 && overall.x >= 0 - this.threshold))&&((overall.y >= 0 && overall.y <= this.threshold) || (overall.y <= 0 && overall.y >= 0 - this.threshold))){this.current.x -= overall.x;this.current.y -= overall.y;}if(this.released || overall.x > this.threshold || overall.x < (0 - this.threshold) || overall.y > this.threshold || overall.y < (0 - this.threshold)){dbx.group = this.container;dbx.box = this.box;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){this.released = true;if(!this.restrict || !this.vertical) { this.boxclone.style.left = (this.current.x - this.difference.x) + 'px'; }if(!this.restrict || this.vertical) { this.boxclone.style.top = (this.current.y - this.difference.y) + 'px'; }this.moveOriginalToPosition(this.current.x, this.current.y);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }}}}return true;};dbxGroup.prototype.mouseup = function(e){if(this.box != null){this.moveOriginalToPosition(e.clientX, e.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return true; }}}this.dragok = false;};dbxGroup.prototype.keypress = function(e, anchor){if(/^(3[7-9])|(40)$/.test(e.keyCode)){this.removeTooltip();if((this.vertical && /^(38|40)$/.test(e.keyCode)) || (!this.vertical && /^(37|39)$/.test(e.keyCode))){this.shiftBoxPosition(e, anchor, /^[3][78]$/.test(e.keyCode) ? false : true);if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }typeof e.stopPropagation != 'undefined' ? e.stopPropagation() : e.cancelBubble = true;this.keydown = false;}}return true;};dbxGroup.prototype.getBoxOrder = function(){this.order = [];var len = this.eles.length;for(var j=0; j boxprops.xy && cloneprops.xy < boxprops.xy)||(!this.positive && cloneprops.xy < boxprops.xy && cloneprops.xy + cloneprops.wh > boxprops.xy)){if(this.boxes[i] == this.box) { return; }var sibling = this.box.nextSibling;while(sibling.className == null || !/dbx\-box/.test(sibling.className)){sibling = sibling.nextSibling;}if(this.boxes[i] == sibling) { return; }if(this.resolution > 0){if(this.box[this.vertical ? 'offsetTop' : 'offsetLeft'] < boxprops.xy){var visibox = this.boxes[i].previousSibling;while(visibox.className == null || !/dbx\-box/.test(visibox.className)){visibox = visibox.previousSibling;}}else{visibox = this.boxes[i];}var visipos = { 'x' : visibox.offsetLeft, 'y' : visibox.offsetTop };}var prepos = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.container.insertBefore(this.box, this.boxes[i]);this.initial.x += (this.box.offsetLeft - prepos.x);this.initial.y += (this.box.offsetTop - prepos.y);if(this.resolution > 0 && visibox != this.box){var animator = new dbxAnimator(this, visibox, visipos, this.resolution, false, null);}else{}break;}}};function dbxAnimator(caller, box, pos, res, kbd, anchor){this.caller = caller;this.box = box;this.timer = null;var before = pos[this.caller.vertical ? 'y' : 'x'];var after = this.box[this.caller.vertical ? 'offsetTop' : 'offsetLeft'];if(before != after){if(dbx.running > this.caller.boxes.length - 1) { return; }var clone = this.caller.createClone(this.box, 29999, arguments[2]);clone.style.visibility = 'visible';this.box.style.visibility = 'hidden';this.animateClone(clone,before,after > before ? after - before : 0 - (before - after),this.caller.vertical ? 'top' : 'left',res,kbd,anchor);}};dbxAnimator.prototype.animateClone = function(clone, current, change, dir, res, kbd, anchor){var self = this;var count = 0;dbx.running ++;this.timer = window.setInterval(function(){count ++;current += change / res;clone.style[dir] = current + 'px';if(count == res){window.clearTimeout(self.timer);self.timer = null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility = 'visible';if(kbd){if(anchor != null && anchor.parentNode.style.visibility != 'hidden'){anchor.focus();}else if(self.caller.toggles){var button = self.caller.buttons[parseInt(self.box.className.split('dbxid')[1],10)];if(button != null && typeof button.isactive != 'undefined'){button.focus();}}}}}, 20);};if(typeof window.attachEvent != 'undefined'){window.attachEvent('onunload', function(){var ev = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'click', 'keydown', 'keyup', 'focus', 'blur', 'selectstart', 'statechange', 'boxdrag', 'boxopen', 'boxclose'];var el = ev.length;var dl = document.all.length;for(var i=0; i' - + '
'; - - case "rtl": - var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\');return false;'; - return '' - + '
'; - } - - return ""; -} - -function TinyMCE_directionality_execCommand(editor_id, element, command, user_interface, value) { - // Handle commands - switch (command) { - case "mceDirectionLTR": - var inst = tinyMCE.getInstanceById(editor_id); - var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); - - if (elm) - elm.setAttribute("dir", "ltr"); - - tinyMCE.triggerNodeChange(false); - return true; - - case "mceDirectionRTL": - var inst = tinyMCE.getInstanceById(editor_id); - var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); - - if (elm) - elm.setAttribute("dir", "rtl"); - - tinyMCE.triggerNodeChange(false); - return true; - } - - // Pass to next handler in chain - return false; -} - -function TinyMCE_directionality_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { - function getAttrib(elm, name) { - return elm.getAttribute(name) ? elm.getAttribute(name) : ""; - } - - tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonNormal', false); - tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonNormal', false); - - if (node == null) - return; - - var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); - if (!elm) { - tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonDisabled', true); - tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonDisabled', true); - return; - } - - var dir = getAttrib(elm, "dir"); - if (dir == "ltr" || dir == "") - tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonSelected', false); - else - tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonSelected', false); - - return true; -} +tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin); diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index 916e29fdc2..42f95b9013 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -1,388 +1 @@ -/** - * $RCSfile: editor_plugin_src.js,v $ - * $Revision: 1.36 $ - * $Date: 2006/03/20 12:03:44 $ - * - * @author Moxiecode - * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. - */ - -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('paste', 'en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br'); - -var TinyMCE_PastePlugin = { - getInfo : function() { - return { - longname : 'Paste text/word', - author : 'Moxiecode Systems', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, - - initInstance : function(inst) { - if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false)) - tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); - }, - - getControlHTML : function(cn) { - switch (cn) { - case "pastetext": - return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true); - - case "pasteword": - return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true); - - case "selectall": - return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true); - } - - return ''; - }, - - execCommand : function(editor_id, element, command, user_interface, value) { - switch (command) { - case "mcePasteText": - if (user_interface) { - if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) - TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true); - else { - var template = new Array(); - template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme - template['width'] = 450; - template['height'] = 400; - var plain_text = ""; - tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'}); - } - } else - TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']); - - return true; - - case "mcePasteWord": - if (user_interface) { - if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) { - var html = TinyMCE_PastePlugin._clipboardHTML(); - - if (html && html.length > 0) - TinyMCE_PastePlugin._insertWordContent(html); - } else { - var template = new Array(); - template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme - template['width'] = 450; - template['height'] = 400; - var plain_text = ""; - tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'}); - } - } else - TinyMCE_PastePlugin._insertWordContent(value); - - return true; - - case "mceSelectAll": - tinyMCE.execInstanceCommand(editor_id, 'selectall'); - return true; - - } - - // Pass to next handler in chain - return false; - }, - - // Private plugin internal methods - - _handlePasteEvent : function(e) { - switch (e.type) { - case "paste": - var html = TinyMCE_PastePlugin._clipboardHTML(); - var r, inst = tinyMCE.selectedInstance; - - // Removes italic, strong etc, the if was needed due to bug #1437114 - if (inst && (r = inst.getRng()) && r.text.length > 0) - tinyMCE.execCommand('delete'); - - if (html && html.length > 0) - tinyMCE.execCommand('mcePasteWord', false, html); - - tinyMCE.cancelEvent(e); - return false; - } - - return true; - }, - - _insertText : function(content, bLinebreaks) { - if (content && content.length > 0) { - if (bLinebreaks) { - // Special paragraph treatment - if (tinyMCE.getParam("paste_create_paragraphs", true)) { - var rl = tinyMCE.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); - for (var i=0; i

", "gi"); - content = tinyMCE.regexpReplace(content, "\r\r", "

", "gi"); - content = tinyMCE.regexpReplace(content, "\n\n", "

", "gi"); - - // Has paragraphs - if ((pos = content.indexOf('

')) != -1) { - tinyMCE.execCommand("Delete"); - - var node = tinyMCE.selectedInstance.getFocusElement(); - - // Get list of elements to break - var breakElms = new Array(); - - do { - if (node.nodeType == 1) { - // Don't break tables and break at body - if (node.nodeName == "TD" || node.nodeName == "BODY") - break; - - breakElms[breakElms.length] = node; - } - } while(node = node.parentNode); - - var before = "", after = "

"; - before += content.substring(0, pos); - - for (var i=0; i"; - after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; - } - - before += "

"; - content = before + content.substring(pos+7) + after; - } - } - - if (tinyMCE.getParam("paste_create_linebreaks", true)) { - content = tinyMCE.regexpReplace(content, "\r\n", "
", "gi"); - content = tinyMCE.regexpReplace(content, "\r", "
", "gi"); - content = tinyMCE.regexpReplace(content, "\n", "
", "gi"); - } - } - - tinyMCE.execCommand("mceInsertRawHTML", false, content); - } - }, - - _insertWordContent : function(content) { - if (content && content.length > 0) { - // Cleanup Word content - var bull = String.fromCharCode(8226); - var middot = String.fromCharCode(183); - var cb; - - if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") - content = eval(cb + "('before', content)"); - - var rl = tinyMCE.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); - for (var i=0; i(.*?)<\/p>', 'gi'), '

$1

'); - } - - content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); - content = content.replace(new RegExp(bull + "(.*?)
", "gi"), "

" + middot + "$1

"); - content = content.replace(new RegExp('', 'gi'), "" + bull); // Covert to bull list - content = content.replace(/<\/o:p>/gi, ""); - content = content.replace(new RegExp('
]*>/gi, ""); - - if (tinyMCE.getParam("paste_remove_styles", true)) - content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); - - content = content.replace(/<\/?font[^>]*>/gi, ""); - - // Strips class attributes. - switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) { - case "all": - content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); - break; - - case "mso": - content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); - break; - } - - content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']); - content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); - content = content.replace(/<\\?\?xml[^>]*>/gi, ""); - content = content.replace(/<\/?\w+:[^>]*>/gi, ""); - content = content.replace(/-- page break --\s*

 <\/p>/gi, ""); // Remove pagebreaks - content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks - - // content = content.replace(/\/? */gi, "");   - // content = content.replace(/

 <\/p>/gi, ''); - - if (!tinyMCE.settings['force_p_newlines']) { - content = content.replace('', '' ,'gi'); - content = content.replace('

', '

' ,'gi'); - } - - if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) { - content = content.replace(/<\/?p[^>]*>/gi, ""); - } - - content = content.replace(/<\/?div[^>]*>/gi, ""); - - // Convert all middlot lists to UL lists - if (tinyMCE.getParam("paste_convert_middot_lists", true)) { - var div = document.createElement("div"); - div.innerHTML = content; - - // Convert all middot paragraphs to li elements - var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList"); - - while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull - while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot - while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull - - content = div.innerHTML; - } - - // Replace all headers with strong and fix some other issues - if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) { - content = content.replace(/ <\/h[1-6]>/gi, '

  

'); - content = content.replace(//gi, '

'); - content = content.replace(/<\/h[1-6]>/gi, '

'); - content = content.replace(/ <\/b>/gi, '  '); - content = content.replace(/^( )*/gi, ''); - } - - content = content.replace(/--list--/gi, ""); // Remove --list-- - - if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") - content = eval(cb + "('after', content)"); - - // Insert cleaned content - tinyMCE.execCommand("mceInsertContent", false, content); - window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread - } - }, - - _reEscape : function(s) { - var l = "?.\\*[](){}+^$:"; - var o = ""; - - for (var i=0; i0)TinyMCE_PastePlugin._insertWordContent(html);}else{var template=new Array();template['file']='../../plugins/paste/pasteword.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",inline:"yes",mceDo:'insert'});}}else TinyMCE_PastePlugin._insertWordContent(value);return true;case"mceSelectAll":tinyMCE.execInstanceCommand(editor_id,'selectall');return true;}return false;},_handlePasteEvent:function(e){switch(e.type){case"paste":var html=TinyMCE_PastePlugin._clipboardHTML();var r,inst=tinyMCE.selectedInstance;if(inst&&(r=inst.getRng())&&r.text.length>0)tinyMCE.execCommand('delete');if(html&&html.length>0)tinyMCE.execCommand('mcePasteWord',false,html);tinyMCE.cancelEvent(e);return false;}return true;},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(tinyMCE.getParam("paste_create_paragraphs",true)){var rl=tinyMCE.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

","gi");content=tinyMCE.regexpReplace(content,"\r\r","

","gi");content=tinyMCE.regexpReplace(content,"\n\n","

","gi");if((pos=content.indexOf('

'))!=-1){tinyMCE.execCommand("Delete");var node=tinyMCE.selectedInstance.getFocusElement();var breakElms=new Array();do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

";content=before+content.substring(pos+7)+after;}}if(tinyMCE.getParam("paste_create_linebreaks",true)){content=tinyMCE.regexpReplace(content,"\r\n","
","gi");content=tinyMCE.regexpReplace(content,"\r","
","gi");content=tinyMCE.regexpReplace(content,"\n","
","gi");}}tinyMCE.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);var cb;if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('before', content)");var rl=tinyMCE.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

$1

');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
","gi"),"

"+middot+"$1

");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
]*>/gi,"");if(tinyMCE.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(tinyMCE.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+TinyMCE_PastePlugin._reEscape(""+document.location)+'','gi'),'href="'+tinyMCE.settings['document_base_url']);content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

 <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!tinyMCE.settings['force_p_newlines']){content=content.replace('','','gi');content=content.replace('

','

','gi');}if(!tinyMCE.isMSIE&&!tinyMCE.settings['force_p_newlines']){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(tinyMCE.getParam("paste_convert_middot_lists",true)){var div=document.createElement("div");div.innerHTML=content;var className=tinyMCE.getParam("paste_unindented_list_class","unIndentedList");while(TinyMCE_PastePlugin._convertMiddots(div,"--list--"));while(TinyMCE_PastePlugin._convertMiddots(div,middot,className));while(TinyMCE_PastePlugin._convertMiddots(div,bull));content=div.innerHTML;}if(tinyMCE.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

  

');content=content.replace(//gi,'

');content=content.replace(/<\/h[1-6]>/gi,'

');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('after', content)");tinyMCE.execCommand("mceInsertContent",false,content);window.setTimeout('tinyMCE.execCommand("mceCleanup");',1);}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i tags and replace them with images - while ((startPos = content.indexOf('', startPos)) != -1) { + while ((startPos = content.indexOf('', startPos) + 3; // Insert image - var contentAfter = content.substring(startPos + 11); + var moreText = content.substring(startPos + 8, endPos - 3); + var contentAfter = content.substring(endPos); content = content.substring(0, startPos); content += ''; content += contentAfter; @@ -200,7 +202,8 @@ var TinyMCE_wordpressPlugin = { if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "mce_plugin_wordpress_more") { endPos += 2; - var embedHTML = ''; + var moreText = attribs['moretext'] ? attribs['moretext'] : ''; + var embedHTML = ''; // Insert embed/object chunk chunkBefore = content.substring(0, startPos); @@ -342,7 +345,7 @@ var TinyMCE_wordpressPlugin = { if (pos != -1) attributeName = attributeName.substring(pos+1); - attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase(); + attributes[attributeName.toLowerCase()] = attributeValue.substring(1); attributeName = ""; attributeValue = ""; @@ -379,22 +382,3 @@ tinyMCE.execCommand = function (command, user_interface, value) { } return re; }; - -tinyMCE.orgFixGeckoBaseHREFBug = tinyMCE.fixGeckoBaseHREFBug; -tinyMCE.fixGeckoBaseHREFBug = function(m, e, h) { - if ( tinyMCE.isGecko && m == 1 ) - h = h.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=', 'gi'), '<$1 x$4='); - else - h = tinyMCE.orgFixGeckoBaseHREFBug(m, e, h); - - return h; -}; - -tinyMCE.orgStoreAwayURLs = tinyMCE.storeAwayURLs; -tinyMCE.storeAwayURLs = function(s) { - // Remove all mce_src, mce_href and replace them with new ones - s = s.replace(new RegExp('mce_(href|src)\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - s = s.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=\\s*"([^"]*)"', 'gi'), '<$1 $4="$5" mce_$4="$5"'); - - return s; -}; diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js index 5a3e09c7e7..052914ea4f 100644 --- a/wp-includes/js/tinymce/themes/advanced/editor_template.js +++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js @@ -1,7 +1,7 @@ /** * $RCSfile: editor_template_src.js,v $ - * $Revision: 1.93 $ - * $Date: 2006/03/14 17:33:50 $ + * $Revision: 1.96 $ + * $Date: 2006/04/18 13:32:52 $ * * @author Moxiecode * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. @@ -81,7 +81,13 @@ var TinyMCE_AdvancedTheme = { ['h3', '{$lang_theme_h3}'], ['h4', '{$lang_theme_h4}'], ['h5', '{$lang_theme_h5}'], - ['h6', '{$lang_theme_h6}'] + ['h6', '{$lang_theme_h6}'], + ['div', '{$lang_theme_div}'], + ['blockquote', '{$lang_theme_blockquote}'], + ['code', '{$lang_theme_code}'], + ['dt', '{$lang_theme_dt}'], + ['dd', '{$lang_theme_dd}'], + ['samp', '{$lang_theme_samp}'] ]; html += ''; @@ -90,7 +96,7 @@ var TinyMCE_AdvancedTheme = { for (var i=0; i">' + lookup[x][1] + ''; + html += ''; } } @@ -117,16 +123,16 @@ var TinyMCE_AdvancedTheme = { return fontHTML; case "fontsizeselect": - return ''; + return ''; case "|": case "separator": @@ -458,7 +464,7 @@ var TinyMCE_AdvancedTheme = { var deltaHeight = 0; var resizing = tinyMCE.getParam("theme_advanced_resizing", false); var path = tinyMCE.getParam("theme_advanced_path", true); - var statusbarHTML = '
 

'; + var statusbarHTML = '
 

'; var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout"); // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY! @@ -583,11 +589,7 @@ var TinyMCE_AdvancedTheme = { for (var i = 0; i < containers.length; i++) { if (containers[i] == "mceEditor") //Exceptions for mceEditor and ... - { - template['html'] += '\ - \ - '; - } + template['html'] += ''; else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath: { var pathClass = "mceStatusbar"; @@ -814,7 +816,7 @@ var TinyMCE_AdvancedTheme = { } } - pathElm.innerHTML = '' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' '; + pathElm.innerHTML = '' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' '; } // Reset old states diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js index 9fbf19f152..643aab481d 100644 --- a/wp-includes/js/tinymce/tiny_mce.js +++ b/wp-includes/js/tinymce/tiny_mce.js @@ -3,13 +3,15 @@ function TinyMCE_Engine() { this.majorVersion = "2"; - this.minorVersion = "0.5.1"; - this.releaseDate = "2006-03-22"; + this.minorVersion = "0.6.1"; + this.releaseDate = "2006-05-04"; this.instances = new Array(); this.switchClassCache = new Array(); this.windowArgs = new Array(); this.loadedFiles = new Array(); + this.pendingFiles = new Array(); + this.loadingIndex = 0; this.configs = new Array(); this.currentConfig = 0; this.eventHandlers = new Array(); @@ -127,7 +129,7 @@ TinyMCE_Engine.prototype = { this._def("inline_styles", false); this._def("convert_newlines_to_brs", false); this._def("auto_reset_designmode", true); - this._def("entities", "160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro", true); + this._def("entities", "39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro", true); this._def("entity_encoding", "named"); this._def("cleanup_callback", ""); this._def("add_unload_trigger", true); @@ -159,6 +161,13 @@ TinyMCE_Engine.prototype = { this._def("content_css", ''); this._def("fix_list_elements", false); this._def("fix_table_elements", false); + this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml'); + this._def("hidden_tab_class", ''); + this._def("display_tab_class", ''); + + // Force strict loading mode to false on non Gecko browsers + if (this.isMSIE && !this.isOpera) + this.settings.strict_loading_mode = false; // Browser check IE if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1) @@ -198,9 +207,9 @@ TinyMCE_Engine.prototype = { this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; theme = this.settings['theme']; - this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dir|fieldset|form|noscript|noframes|menu|isindex)$", "i"); + this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$", "i"); this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); - this.uniqueURL = 'http://tinymce.moxiecode.cp/mce_temp_url'; // Make unique URL non real URL + this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL this.uniqueTag = ''; this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup'); @@ -287,6 +296,9 @@ TinyMCE_Engine.prototype = { // Save away this config settings['index'] = this.configs.length; this.configs[this.configs.length] = settings; + + // Start loading first one in chain + this.loadNextScript(); }, _addUnloadEvents : function() { @@ -319,6 +331,8 @@ TinyMCE_Engine.prototype = { // Use the previous plugin object base URL used when loading external plugins p.baseURL = op ? op.baseURL : tinyMCE.baseURL + "/plugins/" + n; this.plugins[n] = p; + + this.loadNextScript(); }, setPluginBaseURL : function(n, u) { @@ -343,6 +357,8 @@ TinyMCE_Engine.prototype = { addTheme : function(n, t) { this.themes[n] = t; + + this.loadNextScript(); }, addMenu : function(n, m) { @@ -354,21 +370,43 @@ TinyMCE_Engine.prototype = { }, loadScript : function(url) { - for (var i=0; i'); + if (tinyMCE.settings.strict_loading_mode) + this.pendingFiles[this.pendingFiles.length] = url; + else + document.write(''); this.loadedFiles[this.loadedFiles.length] = url; }, + loadNextScript : function() { + var d = document, se; + + if (!tinyMCE.settings.strict_loading_mode) + return; + + if (this.loadingIndex < this.pendingFiles.length) { + se = d.createElementNS('http://www.w3.org/1999/xhtml', 'script'); + se.setAttribute('language', 'javascript'); + se.setAttribute('type', 'text/javascript'); + se.setAttribute('src', this.pendingFiles[this.loadingIndex++]); + + d.getElementsByTagName("head")[0].appendChild(se); + } else + this.loadingIndex = -1; // Done with loading + }, + loadCSS : function(url) { var ar = url.replace(/\s+/, '').split(','); var lflen = 0, csslen = 0; var skip = false; - var x = 0, i = 0; + var x = 0, i = 0, nl, le; for (x = 0,csslen = ar.length; x'); + if (tinyMCE.settings.strict_loading_mode) { + nl = document.getElementsByTagName("head"); + + le = document.createElement('link'); + le.setAttribute('href', ar[x]); + le.setAttribute('rel', 'stylesheet'); + le.setAttribute('type', 'text/css'); + + nl[0].appendChild(le); + } else + document.write(''); + this.loadedFiles[this.loadedFiles.length] = ar[x]; } } @@ -658,7 +707,7 @@ TinyMCE_Engine.prototype = { } iframe.setAttribute("id", id); - iframe.setAttribute("className", "mceEditorIframe"); + iframe.setAttribute("class", "mceEditorIframe"); iframe.setAttribute("border", "0"); iframe.setAttribute("frameBorder", "0"); iframe.setAttribute("marginWidth", "0"); @@ -668,6 +717,7 @@ TinyMCE_Engine.prototype = { iframe.setAttribute("width", aw); iframe.setAttribute("height", ah); iframe.setAttribute("allowtransparency", "true"); + iframe.className = 'mceEditorIframe'; if (tinyMCE.settings["auto_resize"]) iframe.setAttribute("scrolling", "no"); @@ -679,6 +729,10 @@ TinyMCE_Engine.prototype = { iframe.style.width = aw; iframe.style.height = ah; + // Ugly hack for Gecko problem in strict mode + if (tinyMCE.settings.strict_loading_mode) + iframe.style.marginBottom = '-5px'; + // MSIE 5.0 issue if (tinyMCE.isMSIE && !tinyMCE.isOpera) replace_element.outerHTML = iframe.outerHTML; @@ -697,6 +751,14 @@ TinyMCE_Engine.prototype = { var head = doc.getElementsByTagName('head').item(0); var content = inst.startContent; + // HTML values get XML encoded in strict mode + if (tinyMCE.settings.strict_loading_mode) { + content = content.replace(/</g, '<'); + content = content.replace(/>/g, '>'); + content = content.replace(/"/g, '"'); + content = content.replace(/&/g, '&'); + } + inst.switchSettings(); // Not loaded correctly hit it again, Mozilla bug #997860 @@ -851,6 +913,22 @@ TinyMCE_Engine.prototype = { inst.startContent = tinyMCE.trim(inst.getBody().innerHTML); inst.undoRedo.add({ content : inst.startContent }); + // Cleanup any mess left from storyAwayURLs + if (tinyMCE.isGecko) { + // Remove mce_src from textnodes and comments + tinyMCE.selectNodes(inst.getBody(), function(n) { + if (n.nodeType == 3 || n.nodeType == 8) { + n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); + n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); + } + + return false; + }); + } + + // Cleanup any mess left from storyAwayURLs + tinyMCE._removeInternal(inst.getBody()); + tinyMCE.selectedInstance = inst; tinyMCE.triggerNodeChange(false, true); }, @@ -868,6 +946,20 @@ TinyMCE_Engine.prototype = { return s; }, + _removeInternal : function(n) { + if (tinyMCE.isGecko) { + // Remove mce_src from textnodes and comments + tinyMCE.selectNodes(n, function(n) { + if (n.nodeType == 3 || n.nodeType == 8) { + n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); + n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); + } + + return false; + }); + } + }, + removeTinyMCEFormElements : function(form_obj) { // Check if form is valid if (typeof(form_obj) == "undefined" || form_obj == null) @@ -922,7 +1014,23 @@ TinyMCE_Engine.prototype = { if (tinyMCE.selectedInstance) tinyMCE.selectedInstance.setBaseHREF(null); - window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);", 1); + // Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks + // This logic forces the width/height to be in pixels while the user is drag/dropping + if (tinyMCE.isMSIE && !tinyMCE.isOpera) { + var ife = tinyMCE.selectedInstance.iframeElement; + + /*if (ife.style.width.indexOf('%') != -1) { + ife._oldWidth = ife.width.height; + ife.style.width = ife.clientWidth; + }*/ + + if (ife.style.height.indexOf('%') != -1) { + ife._oldHeight = ife.style.height; + ife.style.height = ife.clientHeight; + } + } + + window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();", 1); return; case "submit": @@ -1241,6 +1349,12 @@ TinyMCE_Engine.prototype = { }, onLoad : function() { + // Wait for everything to be loaded first + if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) { + window.setTimeout('tinyMCE.onLoad();', 1); + return; + } + if (tinyMCE.isMSIE && !tinyMCE.isOpera && window.event.type == "readystatechange" && document.readyState != "complete") return true; @@ -1425,6 +1539,8 @@ TinyMCE_Engine.prototype = { tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key]; } + this.loadNextScript(); + // for (var key in ar) // tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|"; }, @@ -1671,10 +1787,13 @@ TinyMCE_Engine.prototype = { return className; }, - handleVisualAid : function(el, deep, state, inst) { + handleVisualAid : function(el, deep, state, inst, skip_dispatch) { if (!el) return; + if (!skip_dispatch) + tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst); + var tableElement = null; switch (el.nodeName) { @@ -1713,7 +1832,7 @@ TinyMCE_Engine.prototype = { if (deep && el.hasChildNodes()) { for (var i=0; i' && tinyMCE.isGecko) - value = 'div'; + if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value)) + value = value.replace(/[^a-z]/gi, ''); - this.getDoc().execCommand("FormatBlock", false, value); + if (tinyMCE.isMSIE && new RegExp('blockquote|code|samp', 'gi').test(value)) { + var b = this.selection.getBookmark(); + this.getDoc().execCommand("FormatBlock", false, '

'); + tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value); + this.selection.moveToBookmark(b); + } else + this.getDoc().execCommand("FormatBlock", false, value); } tinyMCE.triggerNodeChange(); @@ -2829,6 +2998,9 @@ TinyMCE_Control.prototype = { tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body)); tinyMCE.convertAllRelativeURLs(doc.body); + // Cleanup any mess left from storyAwayURLs + tinyMCE._removeInternal(this.getBody()); + // When editing always use fonts internaly if (tinyMCE.getParam("convert_fonts_to_spans")) tinyMCE.convertSpansToFonts(doc); @@ -3273,7 +3445,7 @@ TinyMCE_Control.prototype = { if (tinyMCE.settings['debug']) { hc = ''; } else { - hc = ''; + hc = ''; this.oldTargetElement.style.display = "none"; } @@ -3318,7 +3490,8 @@ TinyMCE_Control.prototype = { var tElm = targetDoc.getElementById(this.editorId); if (!tinyMCE.isMSIE) { - if (tElm && tElm.nodeName == "SPAN") { + // Node case is preserved in XML strict mode + if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) { tElm = tinyMCE._createIFrame(tElm, targetDoc); dynamicIFrame = true; } @@ -3413,7 +3586,27 @@ TinyMCE_Control.prototype = { }, triggerSave : function(skip_cleanup, skip_callback) { + var e, nl = new Array(), i, s; + this.switchSettings(); + s = tinyMCE.settings; + + // Force hidden tabs visible while serializing + if (tinyMCE.isMSIE && !tinyMCE.isOpera) { + e = this.iframeElement; + + do { + if (e.style && e.style.display == 'none') { + e.style.display = 'block'; + nl[nl.length] = {elm : e, type : 'style'}; + } + + if (e.style && s.hidden_tab_class.length > 0 && e.className.indexOf(s.hidden_tab_class) != -1) { + e.className = s.display_tab_class; + nl[nl.length] = {elm : e, type : 'class'}; + } + } while ((e = e.parentNode) != null) + } tinyMCE.settings['preformatted'] = false; @@ -3456,33 +3649,42 @@ TinyMCE_Control.prototype = { if (tinyMCE.isSafari && this.formElement) this.formElement.innerText = htm; + + // Hide them again (tabs in MSIE) + for (i=0; i/gi, '

 

'); - s = s.replace(/

\s*<\/p>/gi, '

 

'); + s = s.replace(new RegExp('

', 'gi'), '

 

'); + s = s.replace(new RegExp('

\\s*<\\/p>', 'gi'), '

 

'); + + // Fix close BR elements + s = s.replace(new RegExp('
\\s*<\\/br>', 'gi'), '
'); // Open closed tags like to -// tinyMCE.debug("f:" + s); - s = s.replace(/<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\|>]*?)\/>/gi, '<$1$2$3>'); -// tinyMCE.debug("e:" + s); + s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3>'); // Remove trailing space to s = s.replace(new RegExp('\\s+> to - s = s.replace(/<(img|br|hr)(.*?)><\/(img|br|hr)>/gi, '<$1$2 />'); + s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />'); // Weird MSIE bug,


breaks runtime? if (tinyMCE.isMSIE) - s = s.replace(/


<\/p>/gi, "
"); + s = s.replace(new RegExp('


<\\/p>', 'gi'), "
"); // Convert relative anchors to absolute URLs ex: #something to file.htm#something if (tinyMCE.getParam('convert_urls')) - s = s.replace(new RegExp('(href=\"?)(\\s*?#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#"); + s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#"); return s; }; @@ -3544,6 +3746,9 @@ TinyMCE_Engine.prototype.serializeStyle = function(ar) { tinyMCE.compressStyle(ar, "border", "", "border"); tinyMCE.compressStyle(ar, "border", "-width", "border-width"); tinyMCE.compressStyle(ar, "border", "-color", "border-color"); + tinyMCE.compressStyle(ar, "border", "-style", "border-style"); + tinyMCE.compressStyle(ar, "padding", "", "padding"); + tinyMCE.compressStyle(ar, "margin", "", "margin"); for (var key in ar) { var val = ar[key]; @@ -3704,7 +3909,8 @@ TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { TinyMCE_Engine.prototype.cleanupAnchors = function(doc) { var i, cn, x, an = doc.getElementsByTagName("a"); - for (i=0; i=0; i--) { if (tinyMCE.getAttrib(an[i], "name") != "" && tinyMCE.getAttrib(an[i], "href") == "") { cn = an[i].childNodes; @@ -3836,7 +4042,7 @@ TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, h = h.replace(/

\s*( | )\s*
\s*( | )\s*<\/p>/g, '

 

'); h = h.replace(/

\s*( | )\s*
\s*<\/p>/g, '

 

'); h = h.replace(/

\s*
\s* \s*<\/p>/g, '

 

'); - h = h.replace(/(.*?)<\/a>/g, '$1'); + h = h.replace(new RegExp('(.*?)<\\/a>', 'g'), '$1'); h = h.replace(/]*)>\s*<\/p>/g, ' 

'); // Clean body @@ -3912,7 +4118,7 @@ function TinyMCE_Cleanup() { this.vElements = tinyMCE.clearArray(new Array()); this.vElementsRe = ''; - this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON)$/; + this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON|AREA)$/; this.codeElementsRe = /^(SCRIPT|STYLE)$/; this.serializationId = 0; this.mceAttribs = { @@ -4027,8 +4233,8 @@ TinyMCE_Cleanup.prototype = { for (i=0; i 0) { if (av[0].charAt(0) == ':') { if (!r.forceAttribs) @@ -4334,13 +4540,6 @@ TinyMCE_Cleanup.prototype = { c = s.charCodeAt(i); e = this.entities[c]; - // ' is not working in MSIE - // More info: http://www.w3.org/TR/xhtml1/#C_16 - if (c == 39) { - o += "'"; - continue; - } - if (e && e != '') o += '&' + e + ';'; else @@ -4378,12 +4577,6 @@ TinyMCE_Cleanup.prototype = { }, _trimComment : function(s) { - // Make xsrc, xhref as src and href again - if (tinyMCE.isGecko) { - s = s.replace(/\sxsrc=/gi, " src="); - s = s.replace(/\sxhref=/gi, " href="); - } - // Remove mce_src, mce_href s = s.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); s = s.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); @@ -4406,6 +4599,15 @@ TinyMCE_Cleanup.prototype = { if (this.isMSIE && n == "http-equiv") v = e.httpEquiv; + if (this.isMSIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded") + v = ""; + + if (this.isMSIE && e.nodeName == "INPUT" && n == "size" && v == "20") + v = ""; + + if (this.isMSIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647") + v = ""; + if (n == "style" && !tinyMCE.isOpera) v = e.style.cssText; @@ -4557,7 +4759,8 @@ TinyMCE_Engine.prototype.setInnerHTML = function(e, h) { // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones h = h.replace(/]*)>\u00A0?<\/p>/gi, ' 

'); // Keep empty paragraphs - h = h.replace(/]*)> <\/p>/gi, ' 

'); // Keep empty paragraphs + h = h.replace(/]*)>\s* \s*<\/p>/gi, ' 

'); // Keep empty paragraphs + h = h.replace(/]*)>\s+<\/p>/gi, ' 

'); // Keep empty paragraphs // Remove first comment e.innerHTML = tinyMCE.uniqueTag + h; @@ -4670,6 +4873,17 @@ TinyMCE_Engine.prototype.getParentElement = function(node, names, attrib_name, a return null; }; +TinyMCE_Engine.prototype.getParentNode = function(n, f) { + while (n) { + if (f(n)) + return n; + + n = n.parentNode; + } + + return null; +}; + TinyMCE_Engine.prototype.getAttrib = function(elm, name, default_value) { if (typeof(default_value) == "undefined") default_value = ""; @@ -4791,6 +5005,62 @@ TinyMCE_Engine.prototype.nextNode = function(e, n) { return null; }; +TinyMCE_Engine.prototype.selectNodes = function(n, f, a) { + var i; + + if (!a) + a = new Array(); + + if (f(n)) + a[a.length] = n; + + if (n.hasChildNodes()) { + for (i=0; i-1; i--) { + if (ar[i].specified && ar[i].nodeValue) + ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue); + } + + ar = e.childNodes; + for (i=0; i bookmark.index) - rng.addElement(nl[bookmark.index]); + if (nl.length > bookmark.index) { + try { + rng.addElement(nl[bookmark.index]); + } catch (ex) { + // Might be thrown if the node no longer exists + } + } } else { rng = inst.getSel().createRange(); rng.moveToElementText(inst.getBody()); @@ -5877,6 +6171,13 @@ var TinyMCE_ForceParagraphs = { var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); + // If absolute force paragraph generation within + if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) + startBlock = null; + + if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) + endBlock = null; + // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; @@ -6062,13 +6363,21 @@ var TinyMCE_ForceParagraphs = { }, _handleBackSpace : function(inst) { - var r = inst.getRng(); - var sn = r.startContainer; + var r = inst.getRng(), sn = r.startContainer, nv, s = false; - if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR") - sn.nextSibling.parentNode.removeChild(sn.nextSibling); + if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR") { + nv = sn.nodeValue; - return false; + // Handle if a backspace is pressed after a space character #bug 1466054 + if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ') + s = true; + + // Only remove BRs if we are at the end of line #bug 1464152 + if (nv != null && r.startOffset == nv.length) + sn.nextSibling.parentNode.removeChild(sn.nextSibling); + } + + return s; } }; @@ -6080,6 +6389,7 @@ function TinyMCE_Layer(id, bm) { this.events = false; this.element = null; this.blockMode = typeof(bm) != 'undefined' ? bm : true; + this.doc = document; }; TinyMCE_Layer.prototype = { @@ -6144,8 +6454,11 @@ TinyMCE_Layer.prototype = { resizeTo : function(w, h) { var e = this.getElement(); - e.style.width = w + "px"; - e.style.height = h + "px"; + if (w != null) + e.style.width = w + "px"; + + if (h != null) + e.style.height = h + "px"; this.updateBlocker(); }, @@ -6166,7 +6479,7 @@ TinyMCE_Layer.prototype = { getElement : function() { if (!this.element) - this.element = document.getElementById(this.id); + this.element = this.doc.getElementById(this.id); return this.element; }, @@ -6201,7 +6514,7 @@ TinyMCE_Layer.prototype = { var d, b; if (!this.blockerElement && this.blockMode) { - d = document; + d = this.doc; b = d.createElement("iframe"); b.style.cssText = 'display: none; position: absolute; left: 0; top: 0'; @@ -6229,7 +6542,7 @@ TinyMCE_Layer.prototype = { }, create : function(n, c, p) { - var d = document, e = d.createElement(n); + var d = this.doc, e = d.createElement(n); e.setAttribute('id', this.id); @@ -6243,37 +6556,6 @@ TinyMCE_Layer.prototype = { return this.element = e; }, -/* - addCSSClass : function(e, c) { - this.removeCSSClass(e, c); - var a = this.explode(' ', e.className); - a[a.length] = c; - e.className = a.join(' '); - }, - - removeCSSClass : function(e, c) { - var a = this.explode(' ', e.className), i; - - for (i=0; i initArray = { @@ -69,6 +73,7 @@ initArray = { convert_newlines_to_brs : false, remove_linebreaks : false, fix_list_elements : true, + entities : "38,amp,60,lt,62,gt", content_css : "", valid_elements : "", save_callback : 'TinyMCE_wordpressPlugin.saveCallback', diff --git a/wp-includes/js/tinymce/tiny_mce_popup.js b/wp-includes/js/tinymce/tiny_mce_popup.js index c5864e6e28..cbcdf3eda5 100644 --- a/wp-includes/js/tinymce/tiny_mce_popup.js +++ b/wp-includes/js/tinymce/tiny_mce_popup.js @@ -263,6 +263,15 @@ TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) { eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);"); }; +TinyMCE_Popup.prototype.importClass = function(c) { + window[c] = function() {}; + + for (var n in window.opener[c].prototype) + window[c].prototype[n] = window.opener[c].prototype[n]; + + window[c].constructor = window.opener[c].constructor; +}; + // Setup global instance var tinyMCEPopup = new TinyMCE_Popup();