diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-27 11:03:10 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-27 11:03:10 +0000 |
commit | 8db1e81228b0e295199f6e3ee8a99d223c48f8c2 (patch) | |
tree | 131d8b23b9e939a9c23f24ec650b343efa918c5c /wp-includes/js | |
parent | 13aff523358403d08dc7fcb0d844a2e6c12df41a (diff) | |
download | wordpress-mu-8db1e81228b0e295199f6e3ee8a99d223c48f8c2.tar.gz wordpress-mu-8db1e81228b0e295199f6e3ee8a99d223c48f8c2.tar.xz wordpress-mu-8db1e81228b0e295199f6e3ee8a99d223c48f8c2.zip |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@599 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/js')
11 files changed, 519 insertions, 648 deletions
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js deleted file mode 100644 index 102d69b..0000000 --- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js +++ /dev/null @@ -1,30 +0,0 @@ -/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
-
-function TinyMCE_autosave_getInfo() {
- return {
- longname : 'Auto save',
- author : 'Moxiecode Systems',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
-};
-
-function TinyMCE_autosave_beforeUnloadHandler() {
- var msg = tinyMCE.getLang("lang_autosave_unload_msg");
-
- var anyDirty = false;
- for (var n in tinyMCE.instances) {
- var inst = tinyMCE.instances[n];
- if (!tinyMCE.isInstance(inst))
- continue;
-
- if (inst.isDirty())
- return msg;
- }
-
- return;
-}
-
-window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
diff --git a/wp-includes/js/tinymce/plugins/autosave/readme.txt b/wp-includes/js/tinymce/plugins/autosave/readme.txt deleted file mode 100644 index 4fdb78a..0000000 --- a/wp-includes/js/tinymce/plugins/autosave/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Check the TinyMCE documentation for details on this plugin.
diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js index c866b53..ad0fa87 100644 --- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js @@ -1,83 +1,92 @@ -/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('directionality', 'en,sv,fr_ca,zh_cn,cs,da,he,no,de,hu,ru,ru_KOI8-R,ru_UTF-8,es,cy,is,pl');
-
-function TinyMCE_directionality_getInfo() {
- return {
- longname : 'Directionality',
- author : 'Moxiecode Systems',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
-};
+/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.16 $
+ * $Date: 2006/02/10 21:34:28 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
-function TinyMCE_directionality_getControlHTML(control_name) {
- switch (control_name) {
- case "ltr":
- var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\');return false;';
- return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_ltr" src="{$pluginurl}/images/ltr.gif" title="{$lang_directionality_ltr_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>'
- + '<div class="zerosize"><input type="button" accesskey="." onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\',false);" /></div>';
-
- case "rtl":
- var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\');return false;';
- return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_rtl" src="{$pluginurl}/images/rtl.gif" title="{$lang_directionality_rtl_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>'
- + '<div class="zerosize"><input type="button" accesskey="," onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\',false);" /></div>';
- }
-
- 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);
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('directionality', 'en,tr,sv,fr_ca,zh_cn,cs,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,pl,nl,fr,pt_br');
+
+var TinyMCE_DirectionalityPlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Directionality',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ },
+
+ getControlHTML : function(cn) {
+ switch (cn) {
+ case "ltr":
+ return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
+
+ case "rtl":
+ return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
+ }
+
+ return "";
+ },
+
+ execCommand : function(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;
+ },
+
+ handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+ function getAttrib(elm, name) {
+ return elm.getAttribute(name) ? elm.getAttribute(name) : "";
+ }
+
+ if (node == null)
+ return;
+
+ var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
+ if (!elm) {
+ tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
+ tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
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;
- }
+ tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
+ tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
- // Pass to next handler in chain
- return false;
-}
+ var dir = getAttrib(elm, "dir");
+ if (dir == "ltr" || dir == "")
+ tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
+ else
+ tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
-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) : "";
+ return true;
}
+};
- 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/inlinepopups/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js deleted file mode 100644 index e69de29..0000000 --- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js +++ /dev/null diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt deleted file mode 100644 index e69de29..0000000 --- a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt +++ /dev/null diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index 916e29f..7a7b133 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -1,388 +1,2 @@ -/**
- * $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.
- */
+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';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';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,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=tinyMCE.regexpReplace(content,"\r\n\r\n","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\r\r","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\n\n","</p><p>","gi");if((pos=content.indexOf('</p><p>'))!=-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="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(tinyMCE.getParam("paste_create_linebreaks",true)){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","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,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(tinyMCE.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(tinyMCE.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/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> <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!tinyMCE.settings['force_p_newlines']){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','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]> <\/h[1-6]>/gi,'<p> </p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b> <\/b>/gi,'<b> </b>');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<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var mdot=String.fromCharCode(183);var bull=String.fromCharCode(8226);var nodes=div.getElementsByTagName("p");var prevul;for(var i=0;i<nodes.length;i++){var p=nodes[i];if(p.innerHTML.indexOf(search)==0){var ul=document.createElement("ul");if(class_name)ul.className=class_name;var li=document.createElement("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');ul.appendChild(li);var np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+| )').test(np.innerHTML)){if(!prevul){prevul=ul;ul=document.createElement("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}var cp=np.nextSibling;var li=document.createElement("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}};tinyMCE.addPlugin("paste",TinyMCE_PastePlugin);
-/* 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,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
- for (var i=0; i<rl.length; i+=2)
- content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
-
- content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
- content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
- content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
-
- // Has paragraphs
- if ((pos = content.indexOf('</p><p>')) != -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 = "</p>";
- before += content.substring(0, pos);
-
- for (var i=0; i<breakElms.length; i++) {
- before += "</" + breakElms[i].nodeName + ">";
- after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
- }
-
- before += "<p>";
- content = before + content.substring(pos+7) + after;
- }
- }
-
- if (tinyMCE.getParam("paste_create_linebreaks", true)) {
- content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
- content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
- content = tinyMCE.regexpReplace(content, "\n", "<br />", "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,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
- for (var i=0; i<rl.length; i+=2)
- content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
-
- if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
- content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
- }
-
- content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
- content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
- content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
- content = content.replace(/<o:p><\/o:p>/gi, "");
- content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
- content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
-
- if (tinyMCE.getParam("paste_remove_spans", true))
- content = content.replace(/<\/?span[^>]*>/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> <\/p>/gi, ""); // Remove pagebreaks
- content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
-
- // content = content.replace(/\/? */gi, "");
- // content = content.replace(/<p> <\/p>/gi, '');
-
- if (!tinyMCE.settings['force_p_newlines']) {
- content = content.replace('', '' ,'gi');
- content = content.replace('</p>', '<br /><br />' ,'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]> <\/h[1-6]>/gi, '<p> </p>');
- content = content.replace(/<h[1-6]>/gi, '<p><b>');
- content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
- content = content.replace(/<b> <\/b>/gi, '<b> </b>');
- 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; i<s.length; i++) {
- var c = s.charAt(i);
-
- if (l.indexOf(c) != -1)
- o += '\\' + c;
- else
- o += c;
- }
-
- return o;
- },
-
- _convertMiddots : function(div, search, class_name) {
- var mdot = String.fromCharCode(183);
- var bull = String.fromCharCode(8226);
-
- var nodes = div.getElementsByTagName("p");
- var prevul;
- for (var i=0; i<nodes.length; i++) {
- var p = nodes[i];
-
- // Is middot
- if (p.innerHTML.indexOf(search) == 0) {
- var ul = document.createElement("ul");
-
- if (class_name)
- ul.className = class_name;
-
- // Add the first one
- var li = document.createElement("li");
- li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
- ul.appendChild(li);
-
- // Add the rest
- var np = p.nextSibling;
- while (np) {
- // If the node is whitespace, then
- // ignore it and continue on.
- if (np.nodeType == 3 && /^\s$/m.test(np.nodeValue)) {
- np = np.nextSibling;
- continue;
- }
-
- if (search == mdot) {
- if (np.nodeType == 1 && /^o(\s+| )/.test(np.innerHTML)) {
- // Second level of nesting
- if (!prevul) {
- prevul = ul;
- ul = document.createElement("ul");
- prevul.appendChild(ul);
- }
- np.innerHTML = np.innerHTML.replace(/^o/, '');
- } else {
- // Pop the stack if we're going back up to the first level
- if (prevul) {
- ul = prevul;
- prevul = null;
- }
- // Not element or middot paragraph
- if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
- break;
- }
- } else {
- // Not element or middot paragraph
- if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
- break;
- }
-
- var cp = np.nextSibling;
- var li = document.createElement("li");
- li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
- np.parentNode.removeChild(np);
- ul.appendChild(li);
- np = cp;
- }
-
- p.parentNode.replaceChild(ul, p);
-
- return true;
- }
- }
-
- return false;
- },
-
- _clipboardHTML : function() {
- var div = document.getElementById('_TinyMCE_clipboardHTML');
-
- if (!div) {
- var div = document.createElement('DIV');
- div.id = '_TinyMCE_clipboardHTML';
-
- with (div.style) {
- visibility = 'hidden';
- overflow = 'hidden';
- position = 'absolute';
- width = 1;
- height = 1;
- }
-
- document.body.appendChild(div);
- }
-
- div.innerHTML = '';
- var rng = document.body.createTextRange();
- rng.moveToElementText(div);
- rng.execCommand('Paste');
- var html = div.innerHTML;
- div.innerHTML = '';
- return html;
- }
-};
-
-tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index e5067c0..733b4c2 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -379,22 +379,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 5a3e09c..052914e 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 += '<option value="">{$lang_theme_block}</option>'; @@ -90,7 +96,7 @@ var TinyMCE_AdvancedTheme = { for (var i=0; i<formats.length; i++) { for (var x=0; x<lookup.length; x++) { if (formats[i] == lookup[x][0]) - html += '<option value="<' + lookup[x][0] + '>">' + lookup[x][1] + '</option>'; + html += '<option value="<' + lookup[x][0] + '>">' + lookup[x][1] + '</option>'; } } @@ -117,16 +123,16 @@ var TinyMCE_AdvancedTheme = { return fontHTML; case "fontsizeselect": - return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">\ - <option value="0">{$lang_theme_font_size}</option>\ - <option value="1">1 (8 pt)</option>\ - <option value="2">2 (10 pt)</option>\ - <option value="3">3 (12 pt)</option>\ - <option value="4">4 (14 pt)</option>\ - <option value="5">5 (18 pt)</option>\ - <option value="6">6 (24 pt)</option>\ - <option value="7">7 (36 pt)</option>\ - </select>'; + return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+ + '<option value="0">{$lang_theme_font_size}</option>'+ + '<option value="1">1 (8 pt)</option>'+ + '<option value="2">2 (10 pt)</option>'+ + '<option value="3">3 (12 pt)</option>'+ + '<option value="4">4 (14 pt)</option>'+ + '<option value="5">5 (18 pt)</option>'+ + '<option value="6">6 (24 pt)</option>'+ + '<option value="7">7 (36 pt)</option>'+ + '</select>'; 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 = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '"> </div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />'; + var statusbarHTML = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '"> </div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />'; 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'] += '<tr><td align="center" class="mceEditor_border">\ - <span id="{$editor_id}"></span>\ - </td></tr>'; - } + template['html'] += '<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>'; else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath: { var pathClass = "mceStatusbar"; @@ -814,7 +816,7 @@ var TinyMCE_AdvancedTheme = { } } - pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' '; + pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + 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 9fbf19f..643aab4 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 = '<div id="mceTMPElement" style="display: none">TMP</div>'; 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<this.loadedFiles.length; i++) { + var i; + + for (i=0; i<this.loadedFiles.length; i++) { if (this.loadedFiles[i] == url) return; } - document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></script>'); + if (tinyMCE.settings.strict_loading_mode) + this.pendingFiles[this.pendingFiles.length] = url; + else + document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></script>'); 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<csslen; x++) { ignore_css = false; @@ -383,7 +421,18 @@ TinyMCE_Engine.prototype = { } if (!skip) { - document.write('<link href="' + ar[x] + '" rel="stylesheet" type="text/css" />'); + 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('<link href="' + ar[x] + '" rel="stylesheet" type="text/css" />'); + 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<el.childNodes.length; i++) - tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst); + tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true); } }, @@ -1751,35 +1870,54 @@ TinyMCE_Engine.prototype = { */ fixGeckoBaseHREFBug : function(m, e, h) { - var nl, i; + var nl, i, a, n, xsrc, xhref, el; if (tinyMCE.isGecko) { if (m == 1) { - h = h.replace(/\ssrc=/gi, " xsrc="); - h = h.replace(/\shref=/gi, " xhref="); + h = h.replace(/\ssrc=/gi, " mce_tsrc="); + h = h.replace(/\shref=/gi, " mce_thref="); return h; } else { - var el = new Array('a','img','select','area','iframe','base','input','script','embed','object','link'); + el = new Array('a','img','select','area','iframe','base','input','script','embed','object','link'); - for (var a=0; a<el.length; a++) { - var n = e.getElementsByTagName(el[a]); + for (a=0; a<el.length; a++) { + n = e.getElementsByTagName(el[a]); for (i=0; i<n.length; i++) { - var xsrc = tinyMCE.getAttrib(n[i], "xsrc"); - var xhref = tinyMCE.getAttrib(n[i], "xhref"); + xsrc = tinyMCE.getAttrib(n[i], "mce_tsrc"); + xhref = tinyMCE.getAttrib(n[i], "mce_thref"); if (xsrc != "") { - n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc); - n[i].removeAttribute("xsrc"); + try { + n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc); + } catch (e) { + // Ignore, Firefox cast exception if local file wasn't found + } + + n[i].removeAttribute("mce_tsrc"); } if (xhref != "") { - n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref); - n[i].removeAttribute("xhref"); + try { + n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref); + } catch (e) { + // Ignore, Firefox cast exception if local file wasn't found + } + + n[i].removeAttribute("mce_thref"); } } } + + el = tinyMCE.selectNodes(e, function(n) { + if (n.nodeType == 3 || n.nodeType == 8) { + n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src="); + n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, " href="); + } + + return false; + }); } } @@ -1920,14 +2058,14 @@ TinyMCE_Engine.prototype = { } if (doc) { - var styles = tinyMCE.isMSIE ? doc.styleSheets : doc.styleSheets; + var styles = doc.styleSheets; if (styles && styles.length > 0) { for (var x=0; x<styles.length; x++) { var csses = null; // Just ignore any errors - eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(" + x + ").rules : doc.styleSheets[" + x + "].cssRules;} catch(e) {}"); + eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}"); if (!csses) return new Array(); @@ -1938,17 +2076,31 @@ TinyMCE_Engine.prototype = { if (selectorText) { var rules = selectorText.split(','); for (var c=0; c<rules.length; c++) { + var rule = rules[c]; + + // Strip spaces between selectors + while (rule.indexOf(' ') == 0) + rule = rule.substring(1); + // Invalid rule - if (rules[c].indexOf(' ') != -1 || rules[c].indexOf(':') != -1 || rules[c].indexOf('mceItem') != -1) + if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1) continue; - if (rules[c] == "." + tinyMCE.settings['visual_table_class'] || rules[c].indexOf('mceEditable') != -1 || rules[c].indexOf('mceNonEditable') != -1) + if (rule.indexOf(tinyMCE.settings['visual_table_class']) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1) continue; // Is class rule - if (rules[c].indexOf('.') != -1) { - //alert(rules[c].substring(rules[c].indexOf('.'))); - output[output.length] = rules[c].substring(rules[c].indexOf('.')+1); + if (rule.indexOf('.') != -1) { + var cssClass = rule.substring(rule.indexOf('.') + 1); + var addClass = true; + + for (var p=0; p<output.length && addClass; p++) { + if (output[p] == cssClass) + addClass = false; + } + + if (addClass) + output[output.length] = cssClass; } } } @@ -2100,6 +2252,17 @@ TinyMCE_Engine.prototype = { tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass); tinyMCE.lastSelectedMenuBtn = null; } + }, + + explode : function(d, s) { + var ar = s.split(d), oar = new Array(), i; + + for (i = 0; i<ar.length; i++) { + if (ar[i] != "") + oar[oar.length] = ar[i]; + } + + return oar; } }; @@ -2520,15 +2683,21 @@ TinyMCE_Control.prototype = { case "FormatBlock": if (value == null || value == "") { - var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address"); + var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"); if (elm) this.execCommand("mceRemoveNode", false, elm); } else { - if (value == '<div>' && tinyMCE.isGecko) - value = 'div'; - - this.getDoc().execCommand("FormatBlock", false, value); + if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value)) + value = value.replace(/[^a-z]/gi, ''); + + if (tinyMCE.isMSIE && new RegExp('blockquote|code|samp', 'gi').test(value)) { + var b = this.selection.getBookmark(); + this.getDoc().execCommand("FormatBlock", false, '<p>'); + 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 = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>'; } else { - hc = '<input type="hidden" type="text" id="' + form_element_name + '" name="' + form_element_name + '" />'; + hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; 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<nl.length; i++) { + if (nl[i].type == 'style') + nl[i].elm.style.display = 'none'; + else + nl[i].elm.className = s.hidden_tab_class; + } } }; /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */ TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) { - s = s.replace(/<p \/>/gi, '<p> </p>'); - s = s.replace(/<p>\s*<\/p>/gi, '<p> </p>'); + s = s.replace(new RegExp('<p \\/>', 'gi'), '<p> </p>'); + s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p> </p>'); + + // Fix close BR elements + s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />'); // Open closed tags like <b/> to <b></b> -// 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></$1$2>'); -// 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></$1$2>'); // Remove trailing space <b > to <b> s = s.replace(new RegExp('\\s+></', 'gi'), '></'); // Close tags <img></img> to <img/> - 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, <p><hr /></p> breaks runtime? if (tinyMCE.isMSIE) - s = s.replace(/<p><hr \/><\/p>/gi, "<hr>"); + s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>"); // 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<an.length; i++) { + // Loops backwards due to bug #1467987 + for (i=an.length-1; 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(/<p>\s*( | )\s*<br \/>\s*( | )\s*<\/p>/g, '<p> </p>'); h = h.replace(/<p>\s*( | )\s*<br \/>\s*<\/p>/g, '<p> </p>'); h = h.replace(/<p>\s*<br \/>\s* \s*<\/p>/g, '<p> </p>'); - h = h.replace(/<a>(.*?)<\/a>/g, '$1'); + h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1'); h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1> </p>'); // 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<a.length; i++) { t = a[i]; - av = /(=|:|<)(.*?)$/.exec(t); - t = t.replace(/(=|:|<).*?$/, ''); + av = new RegExp('(=|:|<)(.*?)$').exec(t); + t = t.replace(new RegExp('(=|:|<).*?$'), ''); if (av && av.length > 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(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs - h = h.replace(/<p([^>]*)> <\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs + h = h.replace(/<p([^>]*)>\s* \s*<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs + h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // 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<n.childNodes.length; i++) + tinyMCE.selectNodes(n.childNodes[i], f, a); + } + + return a; +}; + +TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) { + var o = this.removeCSSClass(e, c); + + return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; +}; + +TinyMCE_Engine.prototype.removeCSSClass = function(e, c) { + var a = this.explode(' ', e.className), i; + + for (i=0; i<a.length; i++) { + if (a[i] == c) + a[i] = ''; + } + + return e.className = a.join(' '); +}; + +TinyMCE_Engine.prototype.renameElement = function(e, n, d) { + var ne, i, ar; + + d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d; + + if (e) { + ne = d.createElement(n); + + ar = e.attributes; + for (i=ar.length-1; 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<ar.length; i++) + ne.appendChild(ar[i].cloneNode(true)); + + e.parentNode.replaceChild(ne, e); + } +}; + /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */ TinyMCE_Engine.prototype.parseURL = function(url_str) { @@ -4950,9 +5220,9 @@ TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL = function(base_url, ur if (fileName == targetURL.path && targetURL.anchor != "") targetURL.path = ""; - // If empty and not local anchor force slash + // If empty and not local anchor force filename or slash if (targetURL.path == "" && !targetURL.anchor) - targetURL.path = "/"; + targetURL.path = fileName != "" ? fileName : "/"; return this.serializeURL(targetURL); }; @@ -5215,6 +5485,7 @@ TinyMCE_Engine.prototype.addEventHandlers = function(inst) { tinyMCE.addEvent(doc, "keyup", TinyMCE_Engine.prototype._eventPatch); tinyMCE.addEvent(doc, "keydown", TinyMCE_Engine.prototype._eventPatch); tinyMCE.addEvent(doc, "mouseup", TinyMCE_Engine.prototype._eventPatch); + tinyMCE.addEvent(doc, "mousedown", TinyMCE_Engine.prototype._eventPatch); tinyMCE.addEvent(doc, "click", TinyMCE_Engine.prototype._eventPatch); } else { tinyMCE.addEvent(doc, "keypress", tinyMCE.handleEvent); @@ -5308,6 +5579,24 @@ TinyMCE_Engine.prototype.accessibleEventHandler = function(e) { return true; }; +TinyMCE_Engine.prototype._resetIframeHeight = function() { + var ife; + + if (tinyMCE.isMSIE && !tinyMCE.isOpera) { + ife = tinyMCE.selectedInstance.iframeElement; + +/* if (ife._oldWidth) { + ife.style.width = ife._oldWidth; + ife.width = ife._oldWidth; + }*/ + + if (ife._oldHeight) { + ife.style.height = ife._oldHeight; + ife.height = ife._oldHeight; + } + } +}; + /* file:jscripts/tiny_mce/classes/TinyMCE_Selection.class.js */ function TinyMCE_Selection(inst) { @@ -5328,8 +5617,8 @@ TinyMCE_Selection.prototype = { if (tinyMCE.isGecko) e.appendChild(r.cloneContents()); - else - e.innerHTML = r.htmlText; + else + e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText; h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false); @@ -5490,8 +5779,13 @@ TinyMCE_Selection.prototype = { nl = doc.getElementsByTagName(bookmark.tag); - if (nl.length > 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<a.length; i++) { - if (a[i] == c) - a[i] = ''; - } - - e.className = a.join(' '); - }, - - explode : function(d, s) { - var ar = s.split(d); - var oar = new Array(); - - for (var i = 0; i<ar.length; i++) { - if (ar[i] != "") - oar[oar.length] = ar[i]; - } - - return oar; - }, -*/ parseInt : function(s) { if (s == null || s == '') @@ -6397,7 +6679,7 @@ TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, { if (tinyMCE.lastMenu && tinyMCE.lastMenu != this) tinyMCE.lastMenu.hide(); - this.parent.show.call(this); + TinyMCE_Layer.prototype.show.call(this); if (!tinyMCE.isOpera) { // Accessibility stuff diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index 651165a..283ffb8 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -43,6 +43,10 @@ $mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css'; $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css'; $mce_css = apply_filters('mce_css', $mce_css); + if ( $_SERVER['HTTPS'] ) { + $mce_css = str_replace('http://', 'https://', $mce_css); + $mce_popups_css = str_replace('http://', 'https://', $mce_popups_css); + } ?> 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 : "<?php echo $mce_css; ?>", valid_elements : "<?php echo $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 c5864e6..cbcdf3e 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(); |