diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index c76396f74c..63de5ce8a9 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -67,6 +67,10 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); $pee = preg_replace('!()!', "$1\n\n", $pee); $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines + if ( strpos($pee, ']*)>\s*|', "", $pee); // no pee inside object/embed + $pee = preg_replace('|\s*\s*|', '', $pee); + } $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "

$1

\n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|

\s*?

|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 33d3bb9ac3..ff6ad64026 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -952,7 +952,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { @@ -967,7 +967,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { diff --git a/wp-includes/js/tinymce/langs/en.js b/wp-includes/js/tinymce/langs/en.js index c7faa24323..3be7a2c3d1 100644 --- a/wp-includes/js/tinymce/langs/en.js +++ b/wp-includes/js/tinymce/langs/en.js @@ -1,41 +1,154 @@ -// UK lang variables - -tinyMCE.addToLang('',{ -bold_desc : 'Bold (Ctrl+B)', -italic_desc : 'Italic (Ctrl+I)', -underline_desc : 'Underline (Ctrl+U)', -striketrough_desc : 'Strikethrough', -justifyleft_desc : 'Align left', -justifycenter_desc : 'Align center', -justifyright_desc : 'Align right', -justifyfull_desc : 'Align full', -bullist_desc : 'Unordered list', -numlist_desc : 'Ordered list', -outdent_desc : 'Outdent', -indent_desc : 'Indent', -undo_desc : 'Undo (Ctrl+Z)', -redo_desc : 'Redo (Ctrl+Y)', -link_desc : 'Insert/edit link', -unlink_desc : 'Unlink', -image_desc : 'Insert/edit image', -cleanup_desc : 'Cleanup messy code', -focus_alert : 'A editor instance must be focused before using this command.', -edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?', -insert_link_title : 'Insert/edit link', -insert : 'Insert', -update : 'Update', -cancel : 'Cancel', -insert_link_url : 'Link URL', -insert_link_target : 'Target', -insert_link_target_same : 'Open link in the same window', -insert_link_target_blank : 'Open link in a new window', -insert_image_title : 'Insert/edit image', -insert_image_src : 'Image URL', -insert_image_alt : 'Image description', -help_desc : 'Help', -bold_img : "bold.gif", -italic_img : "italic.gif", -underline_img : "underline.gif", -clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?', -popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.' -}); +tinyMCE.addI18n({en:{ +common:{ +edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?", +apply:"Apply", +insert:"Insert", +update:"Update", +cancel:"Cancel", +close:"Close", +browse:"Browse", +class_name:"Class", +not_set:"-- Not set --", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?", +clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.", +popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.", +invalid_data:"Error: Invalid values entered, these are marked in red.", +more_colors:"More colors" +}, +contextmenu:{ +align:"Alignment", +left:"Left", +center:"Center", +right:"Right", +full:"Full" +}, +insertdatetime:{ +date_fmt:"%Y-%m-%d", +time_fmt:"%H:%M:%S", +insertdate_desc:"Insert date", +inserttime_desc:"Insert time", +months_long:"January,February,March,April,May,June,July,August,September,October,November,December", +months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", +day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", +day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" +}, +print:{ +print_desc:"Print" +}, +preview:{ +preview_desc:"Preview" +}, +directionality:{ +ltr_desc:"Direction left to right", +rtl_desc:"Direction right to left" +}, +layer:{ +insertlayer_desc:"Insert new layer", +forward_desc:"Move forward", +backward_desc:"Move backward", +absolute_desc:"Toggle absolute positioning", +content:"New layer..." +}, +save:{ +save_desc:"Save", +cancel_desc:"Cancel all changes" +}, +nonbreaking:{ +nonbreaking_desc:"Insert non-breaking space character" +}, +iespell:{ +iespell_desc:"Run spell checking", +download:"ieSpell not detected. Do you want to install it now?" +}, +advhr:{ +advhr_desc:"Horizontale rule" +}, +emotions:{ +emotions_desc:"Emotions" +}, +searchreplace:{ +search_desc:"Find", +replace_desc:"Find/Replace" +}, +advimage:{ +image_desc:"Insert/edit image" +}, +advlink:{ +link_desc:"Insert/edit link" +}, +xhtmlxtras:{ +cite_desc:"Citation", +abbr_desc:"Abbreviation", +acronym_desc:"Acronym", +del_desc:"Deletion", +ins_desc:"Insertion", +attribs_desc:"Insert/Edit Attributes" +}, +style:{ +desc:"Edit CSS Style" +}, +paste:{ +paste_text_desc:"Paste as Plain Text", +paste_word_desc:"Paste from Word", +selectall_desc:"Select All" +}, +paste_dlg:{ +text_title:"Use CTRL+V on your keyboard to paste the text into the window.", +text_linebreaks:"Keep linebreaks", +word_title:"Use CTRL+V on your keyboard to paste the text into the window." +}, +table:{ +desc:"Inserts a new table", +row_before_desc:"Insert row before", +row_after_desc:"Insert row after", +delete_row_desc:"Delete row", +col_before_desc:"Insert column before", +col_after_desc:"Insert column after", +delete_col_desc:"Remove column", +split_cells_desc:"Split merged table cells", +merge_cells_desc:"Merge table cells", +row_desc:"Table row properties", +cell_desc:"Table cell properties", +props_desc:"Table properties", +paste_row_before_desc:"Paste table row before", +paste_row_after_desc:"Paste table row after", +cut_row_desc:"Cut table row", +copy_row_desc:"Copy table row", +del:"Delete table", +row:"Row", +col:"Column", +cell:"Cell" +}, +autosave:{ +unload_msg:"The changes you made will be lost if you navigate away from this page." +}, +fullscreen:{ +desc:"Toggle fullscreen mode" +}, +media:{ +desc:"Insert / edit embedded media", +edit:"Edit embedded media" +}, +fullpage:{ +desc:"Document properties" +}, +template:{ +desc:"Insert predefined template content" +}, +visualchars:{ +desc:"Visual control characters on/off." +}, +spellchecker:{ +desc:"Toggle spellchecker", +menu:"Spellchecker settings", +ignore_word:"Ignore word", +ignore_words:"Ignore all", +langs:"Languages", +wait:"Please wait...", +sug:"Suggestions", +no_sug:"No suggestions", +no_mpell:"No misspellings found." +}, +pagebreak:{ +desc:"Insert page break." +}}}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js index 2cdfb09bb4..50c6b4b321 100644 --- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js @@ -1,46 +1,51 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * $Id$ * * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('autosave'); +(function() { + tinymce.create('tinymce.plugins.AutoSavePlugin', { + init : function(ed, url) { + var t = this; -var TinyMCE_AutoSavePlugin = { - getInfo : function() { - return { - longname : 'Auto save', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + t.editor = ed; - // Private plugin internal methods + window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; + }, - _beforeUnloadHandler : function() { - var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg"); + getInfo : function() { + return { + longname : 'Auto save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, - if (tinyMCE.getParam("fullscreen_is_enabled")) - return; + // Private plugin internal methods - for (n in tinyMCE.instances) { - inst = tinyMCE.instances[n]; + 'static' : { + _beforeUnloadHandler : function() { + var msg; - if (!tinyMCE.isInstance(inst)) - continue; + tinymce.each(tinyMCE.editors, function(ed) { + if (ed.getParam("fullscreen_is_enabled")) + return; + + if (ed.isDirty()) { + msg = ed.getLang("autosave.unload_msg"); + return false; + } + }); - if (inst.isDirty()) return msg; + } } + }); - return; - } -}; - -window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler; - -tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin); + // Register plugin + tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); +})(); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js index 7864535d11..7572bed214 100644 --- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js @@ -1,90 +1,79 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ * * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('directionality'); +(function() { + tinymce.create('tinymce.plugins.Directionality', { + init : function(ed, url) { + var t = this; -var TinyMCE_DirectionalityPlugin = { - getInfo : function() { - return { - longname : 'Directionality', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + t.editor = ed; - getControlHTML : function(cn) { - switch (cn) { - case "ltr": - return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR'); + ed.addCommand('mceDirectionLTR', function() { + var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); - case "rtl": - return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL'); + if (e) { + if (ed.dom.getAttrib(e, "dir") != "ltr") + ed.dom.setAttrib(e, "dir", "ltr"); + else + ed.dom.setAttrib(e, "dir", ""); + } + + ed.nodeChanged(); + }); + + ed.addCommand('mceDirectionRTL', function() { + var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); + + if (e) { + if (ed.dom.getAttrib(e, "dir") != "rtl") + ed.dom.setAttrib(e, "dir", "rtl"); + else + ed.dom.setAttrib(e, "dir", ""); + } + + ed.nodeChanged(); + }); + + ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); + ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); + + ed.onNodeChange.add(t._nodeChange, t); + }, + + getInfo : function() { + return { + longname : 'Directionality', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _nodeChange : function(ed, cm, n) { + var dom = ed.dom, dir; + + n = dom.getParent(n, dom.isBlock); + if (!n) { + cm.setDisabled('ltr', 1); + cm.setDisabled('rtl', 1); + return; + } + + dir = dom.getAttrib(n, 'dir'); + cm.setActive('ltr', dir == "ltr"); + cm.setDisabled('ltr', 0); + cm.setActive('rtl', dir == "rtl"); + cm.setDisabled('rtl', 0); } + }); - 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; - } - - tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal'); - - var dir = getAttrib(elm, "dir"); - if (dir == "ltr" || dir == "") - tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected'); - else - tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected'); - - return true; - } -}; - -tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin); + // Register plugin + tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); +})(); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css b/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css index 43be823cdf..4c774a97d6 100644 --- a/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css +++ b/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css @@ -1,69 +1,69 @@ -/* Window classes */ - -.mceWindow { - position: absolute; - left: 0; - top: 0; - border: 1px solid black; - background-color: #D4D0C8; -} - -.mceWindowHead { - background-color: #334F8D; - width: 100%; - height: 18px; - cursor: move; - overflow: hidden; -} - -.mceWindowBody { - clear: both; - background-color: white; -} - -.mceWindowStatusbar { - background-color: #D4D0C8; - height: 12px; - border-top: 1px solid black; -} - -.mceWindowTitle { - float: left; - font-family: "MS Sans Serif"; - font-size: 9pt; - font-weight: bold; - line-height: 18px; - color: white; - margin-left: 2px; - overflow: hidden; -} - -.mceWindowHeadTools { - margin-right: 2px; -} - -.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize { - display: block; - float: right; - overflow: hidden; - margin-top: 2px; -} - -.mceWindowClose { - margin-left: 2px; -} - -.mceWindowMinimize { -} - -.mceWindowMaximize { -} - -.mceWindowResize { - display: block; - float: right; - overflow: hidden; - cursor: se-resize; - width: 12px; - height: 12px; -} +/* Window classes */ + +.mceWindow { + position: absolute; + left: 0; + top: 0; + border: 1px solid black; + background-color: #D4D0C8; +} + +.mceWindowHead { + background-color: #334F8D; + width: 100%; + height: 18px; + cursor: move; + overflow: hidden; +} + +.mceWindowBody { + clear: both; + background-color: white; +} + +.mceWindowStatusbar { + background-color: #D4D0C8; + height: 12px; + border-top: 1px solid black; +} + +.mceWindowTitle { + float: left; + font-family: "MS Sans Serif"; + font-size: 9pt; + font-weight: bold; + line-height: 18px; + color: white; + margin-left: 2px; + overflow: hidden; +} + +.mceWindowHeadTools { + margin-right: 2px; +} + +.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize { + display: block; + float: right; + overflow: hidden; + margin-top: 2px; +} + +.mceWindowClose { + margin-left: 2px; +} + +.mceWindowMinimize { +} + +.mceWindowMaximize { +} + +.mceWindowResize { + display: block; + float: right; + overflow: hidden; + cursor: se-resize; + width: 12px; + height: 12px; +} diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js index 9b33ce3b1e..2151ce4d67 100644 --- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js @@ -1,826 +1,559 @@ /** - * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $ - * - * Moxiecode DHTML Windows script. + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ * * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ -// Patch openWindow, closeWindow TinyMCE functions +(function() { + var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; -var TinyMCE_InlinePopupsPlugin = { - getInfo : function() { - return { - longname : 'Inline Popups', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - } -}; + tinymce.create('tinymce.plugins.InlinePopups', { + init : function(ed, url) { + // Replace window manager + ed.onBeforeRenderUI.add(function() { + ed.windowManager = new tinymce.InlineWindowManager(ed); + DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css"); + }); + }, -tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin); - -// Patch openWindow, closeWindow TinyMCE functions - -TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow; -TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; - -TinyMCE_Engine.prototype.openWindow = function(template, args) { - // Does the caller support inline - if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) { - mcWindows.selectedWindow = null; - args['mce_inside_iframe'] = false; - this.orgOpenWindow(template, args); - return; - } - - var url, resizable, scrollbars; - - args['mce_inside_iframe'] = true; - tinyMCE.windowArgs = args; - - if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1) - url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file']; - else - url = template['file']; - - if (!(width = parseInt(template['width']))) - width = 320; - - if (!(height = parseInt(template['height']))) - height = 200; - - if (!(minWidth = parseInt(template['minWidth']))) - minWidth = 100; - - if (!(minHeight = parseInt(template['minHeight']))) - minHeight = 100; - - resizable = (args && args['resizable']) ? args['resizable'] : "no"; - scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; - - height += 18; - - // Replace all args as variables in URL - for (var name in args) { - if (typeof(args[name]) == 'function') - continue; - - url = tinyMCE.replaceVar(url, name, escape(args[name])); - } - - var elm = document.getElementById(this.selectedInstance.editorId + '_parent'); - - if (tinyMCE.hasPlugin('fullscreen') && this.selectedInstance.getData('fullscreen').enabled) - pos = { absLeft: 0, absTop: 0 }; - else - pos = tinyMCE.getAbsPosition(elm); - - // Center div in editor area - pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2)); - pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2)); - - // WordPress cache buster - url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; - - mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop + ",minWidth=" + minWidth + ",minHeight=" + minHeight ); -}; - -TinyMCE_Engine.prototype.closeWindow = function(win) { - var gotit = false, n, w; - - for (n in mcWindows.windows) { - w = mcWindows.windows[n]; - - if (typeof(w) == 'function') - continue; - - if (win.name == w.id + '_iframe') { - w.close(); - gotit = true; + getInfo : function() { + return { + longname : 'InlinePopups', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; } - } - - if (!gotit) - this.orgCloseWindow(win); - - tinyMCE.selectedInstance.getWin().focus(); -}; - -TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) { - for (var n in mcWindows.windows) { - var win = mcWindows.windows[n]; - if (typeof(win) == 'function') - continue; - - if (win_ref.name == win.id + "_iframe") - window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title; - } -}; - -// * * * * * TinyMCE_Windows classes below - -// Windows handler -function TinyMCE_Windows() { - this.settings = new Array(); - this.windows = new Array(); - this.isMSIE = (navigator.appName == "Microsoft Internet Explorer"); - this.isGecko = navigator.userAgent.indexOf('Gecko') != -1; - this.isSafari = navigator.userAgent.indexOf('Safari') != -1; - this.isMac = navigator.userAgent.indexOf('Mac') != -1; - this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1); - this.action = "none"; - this.selectedWindow = null; - this.lastSelectedWindow = null; - this.zindex = 1001; - this.mouseDownScreenX = 0; - this.mouseDownScreenY = 0; - this.mouseDownLayerX = 0; - this.mouseDownLayerY = 0; - this.mouseDownWidth = 0; - this.mouseDownHeight = 0; - this.idCounter = 0; -}; - -TinyMCE_Windows.prototype.init = function(settings) { - this.settings = settings; - - if (this.isMSIE) - this.addEvent(document, "mousemove", mcWindows.eventDispatcher); - else - this.addEvent(window, "mousemove", mcWindows.eventDispatcher); - - this.addEvent(document, "mouseup", mcWindows.eventDispatcher); - - this.addEvent(window, "resize", mcWindows.eventDispatcher); - this.addEvent(document, "scroll", mcWindows.eventDispatcher); - - this.doc = document; -}; - -TinyMCE_Windows.prototype.getBounds = function() { - if (!this.bounds) { - var vp = tinyMCE.getViewPort(window); - var top, left, bottom, right, docEl = this.doc.documentElement; - - top = vp.top; - left = vp.left; - bottom = vp.height + top - 2; - right = vp.width + left - 22; // TODO this number is platform dependant - // x1, y1, x2, y2 - this.bounds = [left, top, right, bottom]; - } - return this.bounds; -}; - -TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) { - var bounds = this.getBounds(); - - x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w); - y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h); - - return this.clampBoxSize(x, y, w, h, minW, minH); -}; - -TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) { - var bounds = this.getBounds(); - - return [ - x, y, - Math.max(minW, Math.min(bounds[2], x + w) - x), - Math.max(minH, Math.min(bounds[3], y + h) - y) - ]; -}; - -TinyMCE_Windows.prototype.getParam = function(name, default_value) { - var value = null; - - value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; - - // Fix bool values - if (value == "true" || value == "false") - return (value == "true"); - - return value; -}; - -TinyMCE_Windows.prototype.eventDispatcher = function(e) { - e = typeof(e) == "undefined" ? window.event : e; - - if (mcWindows.selectedWindow == null) - return; - - // Switch focus - if (mcWindows.isGecko && e.type == "mousedown") { - var elm = e.currentTarget; - - for (var n in mcWindows.windows) { - var win = mcWindows.windows[n]; - - if (win.headElement == elm || win.resizeElement == elm) { - win.focus(); - break; - } - } - } - - switch (e.type) { - case "mousemove": - mcWindows.selectedWindow.onMouseMove(e); - break; - - case "mouseup": - mcWindows.selectedWindow.onMouseUp(e); - break; - - case "mousedown": - mcWindows.selectedWindow.onMouseDown(e); - break; - - case "focus": - mcWindows.selectedWindow.onFocus(e); - break; - case "scroll": - case "resize": - if (mcWindows.clampUpdateTimeout) - clearTimeout(mcWindows.clampUpdateTimeout); - mcWindows.clampEventType = e.type; - mcWindows.clampUpdateTimeout = - setTimeout(function () {mcWindows.updateClamping()}, 100); - break; - } -}; - -TinyMCE_Windows.prototype.updateClamping = function () { - var clamp, oversize, etype = mcWindows.clampEventType; - - this.bounds = null; // Recalc window bounds on resize/scroll - this.clampUpdateTimeout = null; - - for (var n in this.windows) { - win = this.windows[n]; - if (typeof(win) == 'function' || ! win.winElement) continue; - - clamp = mcWindows.clampBoxPosition( - win.left, win.top, - win.winElement.scrollWidth, - win.winElement.scrollHeight, - win.features.minWidth, - win.features.minHeight - ); - oversize = ( - clamp[2] != win.winElement.scrollWidth || - clamp[3] != win.winElement.scrollHeight - ) ? true : false; - - if (!oversize || win.features.resizable == "yes" || etype != "scroll") - win.moveTo(clamp[0], clamp[1]); - if (oversize && win.features.resizable == "yes") - win.resizeTo(clamp[2], clamp[3]); - } -}; - -TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) { - if (this.isMSIE) - obj.attachEvent("on" + name, handler); - else - obj.addEventListener(name, handler, false); -}; - -TinyMCE_Windows.prototype.cancelEvent = function(e) { - if (this.isMSIE) { - e.returnValue = false; - e.cancelBubble = true; - } else - e.preventDefault(); -}; - -TinyMCE_Windows.prototype.parseFeatures = function(opts) { - // Cleanup the options - opts = opts.toLowerCase(); - opts = opts.replace(/;/g, ","); - opts = opts.replace(/[^0-9a-z=,]/g, ""); - - var optionChunks = opts.split(','); - var options = new Array(); - - options['left'] = "10"; - options['top'] = "10"; - options['width'] = "300"; - options['height'] = "300"; - options['minwidth'] = "100"; - options['minheight'] = "100"; - options['resizable'] = "yes"; - options['minimizable'] = "yes"; - options['maximizable'] = "yes"; - options['close'] = "yes"; - options['movable'] = "yes"; - options['statusbar'] = "yes"; - options['scrollbars'] = "auto"; - options['modal'] = "no"; - - if (opts == "") - return options; - - for (var i=0; i'; - html += ''; - html += ''; - - html += '
'; - html += '
'; - html += '
'; - if (features['resizable'] == "yes" && features['maximizable'] == "yes") - html += ' '; - // html += ' '; - html += '
'; - html += '
'; - html += '
'; - - if (features['statusbar'] == "yes") { - html += '
'; - - if (features['resizable'] == "yes") { - if (this.isGecko) - html += '
'; - else - html += '
'; - } - - html += '
'; - } - - html += '
'; - - html += ''; - html += ''; - - // Create iframe - this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html); -}; - -// Blocks the document events by placing a image over the whole document -TinyMCE_Windows.prototype.setDocumentLock = function(state) { - var elm = document.getElementById('mcWindowEventBlocker'); - - if (state) { - if (elm == null) { - elm = document.createElement("div"); - - elm.id = "mcWindowEventBlocker"; - elm.style.position = "absolute"; - elm.style.left = "0"; - elm.style.top = "0"; - - document.body.appendChild(elm); - } - - elm.style.display = "none"; - - var imgPath = this.getParam("images_path"); - var width = document.body.clientWidth; - var height = document.body.clientHeight; - - elm.style.width = width; - elm.style.height = height; - elm.innerHTML = ''; - - elm.style.zIndex = mcWindows.zindex-1; - elm.style.display = "block"; - } else if (elm != null) { - if (mcWindows.windows.length == 0) - elm.parentNode.removeChild(elm); - else - elm.style.zIndex = mcWindows.zindex-1; - } -}; - -// Gets called when wrapper iframe is initialized -TinyMCE_Windows.prototype.onLoad = function(name) { - var win = mcWindows.windows[name]; - var id = "mcWindow_" + name; - var wrapperIframe = window.frames[id + "_iframe"].frames[0]; - var wrapperDoc = window.frames[id + "_iframe"].document; - var doc = window.frames[id + "_iframe"].document; - var winDiv = document.getElementById("mcWindow_" + name + "_div"); - var realIframe = window.frames[id + "_iframe"].frames[0]; - - // Set window data - win.id = "mcWindow_" + name; - win.winElement = winDiv; - win.bodyElement = doc.getElementById(id + '_body'); - win.iframeElement = doc.getElementById(id + '_iframe'); - win.headElement = doc.getElementById(id + '_head'); - win.titleElement = doc.getElementById(id + '_title'); - win.resizeElement = doc.getElementById(id + '_resize'); - win.containerElement = doc.getElementById(id + '_container'); - win.left = win.features['left']; - win.top = win.features['top']; - win.frame = window.frames[id + '_iframe'].frames[0]; - win.wrapperFrame = window.frames[id + '_iframe']; - win.wrapperIFrameElement = document.getElementById(id + "_iframe"); - - // Add event handlers - mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher); - - if (win.resizeElement != null) - mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher); - - if (mcWindows.isMSIE) { - mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher); - mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher); - } else { - mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher); - mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher); - mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher); - } - - for (var i=0; i')); + } - height = height - this.deltaHeight; + // Register events + mdf = Event.add(id, 'mousedown', function(e) { + var n = e.target, w, vp; - this.containerElement.style.width = width + 'px'; - this.iframeElement.style.width = width + 'px'; - this.iframeElement.style.height = height + 'px'; - this.bodyElement.style.width = width + 'px'; - this.bodyElement.style.height = height + 'px'; - this.headElement.style.width = width + 'px'; - //this.statusElement.style.width = width + 'px'; -}; + w = t.windows[id]; + t.focus(id); -TinyMCE_Window.prototype.updateClamping = function () { - var clamp, oversize; + if (n.nodeName == 'A' || n.nodeName == 'a') { + if (n.className == 'max') { + w.oldPos = w.element.getXY(); + w.oldSize = w.element.getSize(); - clamp = mcWindows.clampBoxPosition( - this.left, this.top, - this.winElement.scrollWidth, - this.winElement.scrollHeight, - this.features.minWidth, this.features.minHeight - ); - oversize = ( - clamp[2] != this.winElement.scrollWidth || - clamp[3] != this.winElement.scrollHeight - ) ? true : false; + vp = DOM.getViewPort(); - this.moveTo(clamp[0], clamp[1]); - if (this.features.resizable == "yes" && oversize) - this.resizeTo(clamp[2], clamp[3]); -}; + // Reduce viewport size to avoid scrollbars + vp.w -= 2; + vp.h -= 2; -function debug(msg) { - document.getElementById('debug').value += msg + "\n"; -} + w.element.moveTo(vp.x, vp.y); + w.element.resizeTo(vp.w, vp.h); + DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight}); + DOM.addClass(id + '_wrapper', 'maximized'); + } else if (n.className == 'med') { + // Reset to old size + w.element.moveTo(w.oldPos.x, w.oldPos.y); + w.element.resizeTo(w.oldSize.w, w.oldSize.h); + w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight); -TinyMCE_Window.prototype.onMouseUp = function(e) { - mcWindows.action = "none"; -}; + DOM.removeClass(id + '_wrapper', 'maximized'); + } else if (n.className == 'move') + return t._startDrag(id, e, n.className); + else if (DOM.hasClass(n, 'resize')) + return t._startDrag(id, e, n.className.substring(7)); + } + }); -TinyMCE_Window.prototype.onFocus = function(e) { - // Gecko only handler - var winRef = e.currentTarget; + clf = Event.add(id, 'click', function(e) { + var n = e.target; - for (var n in mcWindows.windows) { - var win = mcWindows.windows[n]; - if (typeof(win) == 'function') - continue; + t.focus(id); - if (winRef.name == win.id + "_iframe") { - win.focus(); - return; + if (n.nodeName == 'A' || n.nodeName == 'a') { + switch (n.className) { + case 'close': + t.close(null, id); + return Event.cancel(e); + + case 'button ok': + case 'button cancel': + f.button_func(n.className == 'button ok'); + return Event.cancel(e); + } + } + }); + + // Add window + t.windows = t.windows || {}; + w = t.windows[id] = { + id : id, + mousedown_func : mdf, + click_func : clf, + element : new Element(id, {blocker : 1, container : ed.getContainer()}), + iframeElement : new Element(id + '_ifr'), + features : f, + deltaWidth : dw, + deltaHeight : dh + }; + + w.iframeElement.on('focus', function() { + t.focus(id); + }); + + t.focus(id); + t._fixIELayout(id, 1); + +// if (DOM.get(id + '_ok')) +// DOM.get(id + '_ok').focus(); + + return w; + }, + + focus : function(id) { + var t = this, w = t.windows[id]; + + w.zIndex = this.zIndex++; + w.element.setStyle('zIndex', w.zIndex); + w.element.update(); + + id = id + '_wrapper'; + DOM.removeClass(t.lastId, 'focus'); + DOM.addClass(id, 'focus'); + t.lastId = id; + }, + + _addAll : function(te, ne) { + var i, n, t = this, dom = tinymce.DOM; + + if (is(ne, 'string')) + te.appendChild(dom.doc.createTextNode(ne)); + else if (ne.length) { + te = te.appendChild(dom.create(ne[0], ne[1])); + + for (i=2; i ix) { + fw = w; + ix = w.zIndex; + } + }); + + if (fw) + t.focus(fw.id); + } + }, + + setTitle : function(ti, id) { + DOM.get(id + '_title').innerHTML = DOM.encode(ti); + }, + + alert : function(txt, cb, s) { + var t = this, w; + + w = t.open({ + title : t, + type : 'alert', + button_func : function(s) { + if (cb) + cb.call(s || t, s); + + t.close(null, w.id); + }, + content : DOM.encode(t.editor.getLang(txt, txt)), + inline : 1, + width : 400, + height : 130 + }); + }, + + confirm : function(txt, cb, s) { + var t = this, w; + + w = t.open({ + title : t, + type : 'confirm', + button_func : function(s) { + if (cb) + cb.call(s || t, s); + + t.close(null, w.id); + }, + content : DOM.encode(t.editor.getLang(txt, txt)), + inline : 1, + width : 400, + height : 130 + }); + }, + + // Internal functions + + _fixIELayout : function(id, s) { + var w, img; + + if (!tinymce.isIE6) + return; + + // Fixes the bug where hover flickers and does odd things in IE6 + each(['n','s','w','e','nw','ne','sw','se'], function(v) { + var e = DOM.get(id + '_resize_' + v); + + DOM.setStyles(e, { + width : s ? e.clientWidth : '', + height : s ? e.clientHeight : '', + cursor : DOM.getStyle(e, 'cursor', 1) + }); + + DOM.setStyle(id + "_bottom", 'bottom', '-1px'); + + e = 0; + }); + + // Fixes graphics glitch + if (w = this.windows[id]) { + // Fixes rendering bug after resize + w.element.hide(); + w.element.show(); + + // Forced a repaint of the window + //DOM.get(id).style.filter = ''; + + // IE has a bug where images used in CSS won't get loaded + // sometimes when the cache in the browser is disabled + // This fix tries to solve it by loading the images using the image object + each(DOM.select('div,a', id), function(e, i) { + if (e.currentStyle.backgroundImage != 'none') { + img = new Image(); + img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1'); + } + }); + + DOM.get(id).style.filter = ''; + } } - } -}; + }); -TinyMCE_Window.prototype.onMouseDown = function(e) { - var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target; + // Register plugin + tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups); +})(); - mcWindows.mouseDownScreenX = e.screenX; - mcWindows.mouseDownScreenY = e.screenY; - mcWindows.mouseDownLayerX = this.left; - mcWindows.mouseDownLayerY = this.top; - mcWindows.mouseDownWidth = parseInt(this.winElement.style.width); - mcWindows.mouseDownHeight = parseInt(this.winElement.style.height); - - if (this.resizeElement != null && elm == this.resizeElement.firstChild) - this.startResize(e); - else - this.startMove(e); - - mcWindows.cancelEvent(e); -}; - -// Global instance -var mcWindows = new TinyMCE_Windows(); - -// Initialize windows -mcWindows.init({ - images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images", - css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css" -}); diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif new file mode 100644 index 0000000000..94abd08763 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif new file mode 100644 index 0000000000..e671094cb0 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif new file mode 100644 index 0000000000..6baf64ad32 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif new file mode 100644 index 0000000000..497307a85a Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif new file mode 100644 index 0000000000..c894b2e835 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif new file mode 100644 index 0000000000..c2a2ad454d Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif new file mode 100644 index 0000000000..43a735f22c Binary files /dev/null and b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css new file mode 100644 index 0000000000..e68d8975a2 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css @@ -0,0 +1,87 @@ +/* Clearlooks 2 */ + +/* General */ +.clearlooks2 div, .clearlooks2 span, .clearlooks2 a {position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block} +.clearlooks2 {position:absolute} +.clearlooks2 .wrapper {position:static} +.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} +.clearlooks2 .placeholder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50)} + +/* Top */ +.clearlooks2 .top, .clearlooks2 .top div {top:0; width:100%; height:23px} +.clearlooks2 .top .left {width:6px; background:url(img/corners.gif)} +.clearlooks2 .top .center {right:6px; width:100%; height:23px; background:url(img/horizontal.gif) 12px 0; clip:rect(auto auto auto 12px)} +.clearlooks2 .top .right {right:0; width:6px; height:23px; background:url(img/corners.gif) -12px 0} +.clearlooks2 .top span {width:100%; text-align:center; vertical-align:middle; line-height:23px; font-weight:bold} +.clearlooks2 .focus .top .left {background:url(img/corners.gif) -6px 0} +.clearlooks2 .focus .top .center {background:url(img/horizontal.gif) 0 -23px} +.clearlooks2 .focus .top .right {background:url(img/corners.gif) -18px 0} +.clearlooks2 .focus .top span {color:#FFF} + +/* Middle */ +.clearlooks2 .middle, .clearlooks2 .middle div {top:0} +.clearlooks2 .middle {width:100%; height:100%; clip:rect(23px auto auto auto)} +.clearlooks2 .middle .left {left:0; width:5px; height:100%; background:url(img/vertical.gif) -5px 0} +.clearlooks2 .middle span {top:23px; left:5px; width:100%; height:100%; background:#FFF} +.clearlooks2 .middle .right {right:0; width:5px; height:100%; background:url(img/vertical.gif)} + +/* Bottom */ +.clearlooks2 .bottom, .clearlooks2 .bottom div {height:6px} +.clearlooks2 .bottom {left:0; bottom:0; width:100%} +.clearlooks2 .bottom div {top:0} +.clearlooks2 .bottom .left {left:0; width:5px; background:url(img/corners.gif) -34px -6px} +.clearlooks2 .bottom .center {left:5px; width:100%; background:url(img/horizontal.gif) 0 -46px} +.clearlooks2 .bottom .right {right:0; width:5px; background: url(img/corners.gif) -34px 0} +.clearlooks2 .bottom span {display:none} +.clearlooks2 .statusbar .bottom, .clearlooks2 .statusbar .bottom div {height:23px} +.clearlooks2 .statusbar .bottom .left {background:url(img/corners.gif) -29px 0} +.clearlooks2 .statusbar .bottom .center {background:url(img/horizontal.gif) 0 -52px} +.clearlooks2 .statusbar .bottom .right {background:url(img/corners.gif) -24px 0} +.clearlooks2 .statusbar .bottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px} + +/* Actions */ +.clearlooks2 a {width:29px; height:16px; top:3px;} +.clearlooks2 .close {right:6px; background:url(img/buttons.gif) -87px 0} +.clearlooks2 .min {display:none; right:68px; background:url(img/buttons.gif) 0 0} +.clearlooks2 .med {display:none; right:37px; background:url(img/buttons.gif) -29px 0} +.clearlooks2 .max {display:none; right:37px; background:url(img/buttons.gif) -58px 0} +.clearlooks2 .move {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px} +.clearlooks2 .movable .move {display:block} +.clearlooks2 .focus .close {right:6px; background:url(img/buttons.gif) -87px -16px} +.clearlooks2 .focus .min {right:68px; background:url(img/buttons.gif) 0 -16px} +.clearlooks2 .focus .med {right:37px; background:url(img/buttons.gif) -29px -16px} +.clearlooks2 .focus .max {right:37px; background:url(img/buttons.gif) -58px -16px} +.clearlooks2 .focus .close:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .focus .close:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .focus .min:hover {right:68px; background:url(img/buttons.gif) 0 -32px} +.clearlooks2 .focus .med:hover {right:37px; background:url(img/buttons.gif) -29px -32px} +.clearlooks2 .focus .max:hover {right:37px; background:url(img/buttons.gif) -58px -32px} + +/* Resize */ +.clearlooks2 .resize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px} +.clearlooks2 .resizable .resize {display:block} +.clearlooks2 .resizable .min, .clearlooks2 .max {display:none} +.clearlooks2 .minimizable .min {display:block} +.clearlooks2 .maximizable .max {display:block} +.clearlooks2 .maximized .med {display:block} +.clearlooks2 .maximized .max {display:none} +.clearlooks2 a.resize-n {top:0; left:0; width:100%; cursor:n-resize} +.clearlooks2 a.resize-nw {top:0; left:0; cursor:nw-resize} +.clearlooks2 a.resize-ne {top:0; right:0; cursor:ne-resize} +.clearlooks2 a.resize-w {top:0; left:0; height:100%; cursor:w-resize;} +.clearlooks2 a.resize-e {top:0; right:0; height:100%; cursor:e-resize} +.clearlooks2 a.resize-s {bottom:0; left:0; width:100%; cursor:s-resize} +.clearlooks2 a.resize-sw {bottom:0; left:0; cursor:sw-resize} +.clearlooks2 a.resize-se {bottom:0; right:0; cursor:se-resize} + +/* Alert/Confirm */ +.clearlooks2 .button {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0} +.clearlooks2 .middle .icon {left:15px; top:35px; width:32px; height:32px} +.clearlooks2 .alert .middle span, .clearlooks2 .confirm .middle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal} +.clearlooks2 a:hover {font-weight:bold;} +.clearlooks2 .alert .middle, .clearlooks2 .confirm .middle {background:#D6D7D5} +.clearlooks2 .alert .ok {left:50%; top:auto; margin-left: -40px} +.clearlooks2 .alert .icon {background:url(img/alert.gif)} +.clearlooks2 .confirm .ok {left:50%; top:auto; margin-left: -90px} +.clearlooks2 .confirm .cancel {left:50%; top:auto} +.clearlooks2 .confirm .icon {background:url(img/confirm.gif)} diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/template.htm b/wp-includes/js/tinymce/plugins/inlinepopups/template.htm new file mode 100644 index 0000000000..1e959c6cf1 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/template.htm @@ -0,0 +1,387 @@ + + + +Template for dialogs + + + + +
+
+
+
+
+
+
+ Blured +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Focused +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Statusbar +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Statusbar, Resizable +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Resizable, Maximizable +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Blurred, Maximizable, Statusbar, Resizable +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Maximized, Maximizable, Minimizable, Focused +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ Maximized, Maximizable, Minimizable +
+ +
+
+ Content +
+
+ +
+
+
+
+ Statusbar text. +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + + diff --git a/wp-includes/js/tinymce/plugins/media/css/content.css b/wp-includes/js/tinymce/plugins/media/css/content.css new file mode 100644 index 0000000000..7739381da5 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/media/css/content.css @@ -0,0 +1,6 @@ +.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;} +.mceItemShockWave {background-image: url(../img/shockwave.gif);} +.mceItemFlash {background-image:url(../img/flash.gif);} +.mceItemQuickTime {background-image:url(../img/quicktime.gif);} +.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);} +.mceItemRealMedia {background-image:url(../img/realmedia.gif);} diff --git a/wp-includes/js/tinymce/plugins/media/css/media.css b/wp-includes/js/tinymce/plugins/media/css/media.css new file mode 100644 index 0000000000..62d666a5f8 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/media/css/media.css @@ -0,0 +1,68 @@ +#id, #name, #hspace, #vspace, #class_name, #align { + width: 100px; +} + +#hspace, #vspace { + width: 50px; +} + +#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { + width: 100px; +} + +#flash_base, #flash_flashvars { + width: 240px; +} + +#width, #height { + width: 40px; +} + +#src, #media_type { + width: 250px; +} + +#class { + width: 120px; +} + +#prev { + margin: 0; + border: 1px solid black; + width: 99%; + height: 230px; + overflow: auto; +} + +.panel_wrapper div.current { + height: 390px; + overflow: auto; +} + +#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { + display: none; +} + +.mceAddSelectValue { + background-color: #DDDDDD; +} + +#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { + width: 70px; +} + +#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { + width: 70px; +} + +#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { + width: 70px; +} + +#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { + width: 90px; +} + +#qt_qtsrc { + width: 200px; +} diff --git a/wp-includes/js/tinymce/plugins/media/editor_plugin.js b/wp-includes/js/tinymce/plugins/media/editor_plugin.js new file mode 100644 index 0000000000..e58f933251 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/media/editor_plugin.js @@ -0,0 +1,323 @@ +/** + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.MediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + function isMediaElm(n) { + return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); + }; + + // Register commands + ed.addCommand('mceMedia', function() { + ed.windowManager.open({ + file : url + '/media.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); + }); + + ed.onInit.add(function() { + var lo = { + mceItemFlash : 'flash', + mceItemShockWave : 'shockwave', + mceItemWindowsMedia : 'windowsmedia', + mceItemQuickTime : 'quicktime', + mceItemRealMedia : 'realmedia' + }; + + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.name == 'img') { + each(lo, function(v, k) { + if (ed.dom.hasClass(o.node, k)) { + o.name = v; + o.title = ed.dom.getAttrib(o.node, 'title'); + return false; + } + }); + } + }); + } + + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { + m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); + } + }); + } + }); + + ed.onBeforeSetContent.add(function(ed, o) { + var h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = eval("({" + c + "})"); + + return '' + }); + + h = h.replace(/]*)>/gi, '
'); + h = h.replace(/]*)>/gi, '
'); + h = h.replace(/<\/(object|embed)([^>]*)>/gi, '
'); + h = h.replace(/]*)>/gi, function(a, b) {return '
'}); + h = h.replace(/\/ class=\"mceItemParam\"><\/div>/gi, 'class="mceItemParam">
'); + + o.content = h; + }); + + ed.onSetContent.add(function() { + t._divsToImgs(ed.getBody()); + }); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + t._divsToImgs(o.node); + + each(dom.select('IMG', o.node), function(n) { + var p; + + if (isMediaElm(n)) { + p = t._parse(n.title); + dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); + dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); + } + }); + } + + if (o.get) { + each(dom.select('IMG', o.node), function(n) { + var ci, cb, mt; + + if (ed.getParam('media_use_script')) { + if (isMediaElm(n)) + n.className = n.className.replace(/mceItem/g, 'mceTemp'); + + return; + } + + switch (n.className) { + case 'mceItemFlash': + ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'application/x-shockwave-flash'; + break; + + case 'mceItemShockWave': + ci = '166b1bca-3f9c-11cf-8075-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + mt = 'application/x-director'; + break; + + case 'mceItemWindowsMedia': + ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; + cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + mt = 'application/x-mplayer2'; + break; + + case 'mceItemQuickTime': + ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; + cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + mt = 'video/quicktime'; + break; + + case 'mceItemRealMedia': + ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (ci) { + dom.replace(t._buildObj({ + classid : ci, + codebase : cb, + type : mt + }, n), n); + } + }); + } + }); + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/_value=/g, 'value='); + }); + + if (ed.getParam('media_use_script')) { + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + + return n ? ed.dom.decode(n[1]) : ''; + }; + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/]+>/g, function(im) { + var cl = getAttr(im, 'class'); + + if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { + at = t._parse(getAttr(im, 'title')); + at.width = getAttr(im, 'width'); + at.height = getAttr(im, 'height'); + im = ''; + } + + return im; + }); + }); + } + }, + + getInfo : function() { + return { + longname : 'Media', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _buildObj : function(o, n) { + var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); + + p.width = o.width = dom.getAttrib(n, 'width') || 100; + p.height = o.height = dom.getAttrib(n, 'height') || 100; + + ob = dom.create('div', { + mce_name : 'object', + classid : "clsid:" + o.classid, + codebase : o.codebase, + width : o.width, + height : o.height + }); + + if (p.src) + p.src = ed.convertURL(p.src, 'src', n); + + each (p, function(v, k) { + if (v && !/^(width|height|codebase|classid)$/.test(k)) + dom.add(ob, 'div', {mce_name : 'param', name : k, '_value' : v}); + }); + + dom.add(ob, 'div', tinymce.extend({mce_name : 'embed', type : o.type}, p)); + + return ob; + }, + + _divsToImgs : function(p) { + var t = this, dom = t.editor.dom, im, ci; + + each(dom.select('div', p), function(n) { + // Convert object into image + if (dom.getAttrib(n, 'class') == 'mceItemObject') { + ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); + + switch (ci) { + case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': + case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': + case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + } + }); + }, + + _createImg : function(cl, n) { + var im, dom = this.editor.dom, pa = {}, ti = ''; + + // Create image + im = dom.create('img', { + src : this.url + '/img/trans.gif', + width : dom.getAttrib(n, 'width') || 100, + height : dom.getAttrib(n, 'height') || 100, + 'class' : cl + }); + + // Setup base parameters + each(['id', 'name', 'width', 'height', 'bgcolor', 'align'], function(n) { + var v = dom.getAttrib(n, 'align'); + + if (v) + pa[v] = v; + }); + + // Add optional parameters + each(dom.select('div', n), function(n) { + if (dom.hasClass(n, 'mceItemParam')) + pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value'); + }); + + // Use src not movie + if (pa.movie) { + pa.src = pa.movie; + delete pa.movie; + } + + delete pa.width; + delete pa.height; + + im.title = this._serialize(pa); + + return im; + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + _serialize : function(o) { + return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); + } + }); + + // Register plugin + tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); +})(); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/media/img/flash.gif b/wp-includes/js/tinymce/plugins/media/img/flash.gif new file mode 100644 index 0000000000..cb192e6ced Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/flash.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/img/flv_player.swf b/wp-includes/js/tinymce/plugins/media/img/flv_player.swf new file mode 100644 index 0000000000..042c2ab969 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/flv_player.swf differ diff --git a/wp-includes/js/tinymce/plugins/media/img/quicktime.gif b/wp-includes/js/tinymce/plugins/media/img/quicktime.gif new file mode 100644 index 0000000000..3b0499145b Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/quicktime.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/img/realmedia.gif b/wp-includes/js/tinymce/plugins/media/img/realmedia.gif new file mode 100644 index 0000000000..fdfe0b9ac0 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/realmedia.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/img/shockwave.gif b/wp-includes/js/tinymce/plugins/media/img/shockwave.gif new file mode 100644 index 0000000000..5f235dfc73 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/shockwave.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/img/trans.gif b/wp-includes/js/tinymce/plugins/media/img/trans.gif new file mode 100644 index 0000000000..388486517f Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/trans.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif b/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif new file mode 100644 index 0000000000..ab50f2d887 Binary files /dev/null and b/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif differ diff --git a/wp-includes/js/tinymce/plugins/media/js/embed.js b/wp-includes/js/tinymce/plugins/media/js/embed.js new file mode 100644 index 0000000000..6fe25de090 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/media/js/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += ''; + + h += ''); + +function init() { + var pl = "", f, val; + var type = "flash", fe, i; + + ed = tinyMCEPopup.editor; + + tinyMCEPopup.resizeToInnerSize(); + f = document.forms[0] + + fe = ed.selection.getNode(); + if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + pl = "x={" + fe.title + "};"; + + switch (ed.dom.getAttrib(fe, 'class')) { + case 'mceItemFlash': + type = 'flash'; + break; + + case 'mceItemFlashVideo': + type = 'flv'; + break; + + case 'mceItemShockWave': + type = 'shockwave'; + break; + + case 'mceItemWindowsMedia': + type = 'wmp'; + break; + + case 'mceItemQuickTime': + type = 'qt'; + break; + + case 'mceItemRealMedia': + type = 'rmp'; + break; + } + + document.forms[0].insert.value = ed.getLang('update', 'Insert', true); + } + + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var html = getMediaListHTML('medialist','src','media','media'); + if (html == "") + document.getElementById("linklistrow").style.display = 'none'; + else + document.getElementById("linklistcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('filebrowser')) + document.getElementById('src').style.width = '230px'; + + // Setup form + if (pl != "") { + pl = eval(pl); + + switch (type) { + case "flash": + setBool(pl, 'flash', 'play'); + setBool(pl, 'flash', 'loop'); + setBool(pl, 'flash', 'menu'); + setBool(pl, 'flash', 'swliveconnect'); + setStr(pl, 'flash', 'quality'); + setStr(pl, 'flash', 'scale'); + setStr(pl, 'flash', 'salign'); + setStr(pl, 'flash', 'wmode'); + setStr(pl, 'flash', 'base'); + setStr(pl, 'flash', 'flashvars'); + break; + + case "qt": + setBool(pl, 'qt', 'loop'); + setBool(pl, 'qt', 'autoplay'); + setBool(pl, 'qt', 'cache'); + setBool(pl, 'qt', 'controller'); + setBool(pl, 'qt', 'correction'); + setBool(pl, 'qt', 'enablejavascript'); + setBool(pl, 'qt', 'kioskmode'); + setBool(pl, 'qt', 'autohref'); + setBool(pl, 'qt', 'playeveryframe'); + setBool(pl, 'qt', 'tarsetcache'); + setStr(pl, 'qt', 'scale'); + setStr(pl, 'qt', 'starttime'); + setStr(pl, 'qt', 'endtime'); + setStr(pl, 'qt', 'tarset'); + setStr(pl, 'qt', 'qtsrcchokespeed'); + setStr(pl, 'qt', 'volume'); + setStr(pl, 'qt', 'qtsrc'); + break; + + case "shockwave": + setBool(pl, 'shockwave', 'sound'); + setBool(pl, 'shockwave', 'progress'); + setBool(pl, 'shockwave', 'autostart'); + setBool(pl, 'shockwave', 'swliveconnect'); + setStr(pl, 'shockwave', 'swvolume'); + setStr(pl, 'shockwave', 'swstretchstyle'); + setStr(pl, 'shockwave', 'swstretchhalign'); + setStr(pl, 'shockwave', 'swstretchvalign'); + break; + + case "wmp": + setBool(pl, 'wmp', 'autostart'); + setBool(pl, 'wmp', 'enabled'); + setBool(pl, 'wmp', 'enablecontextmenu'); + setBool(pl, 'wmp', 'fullscreen'); + setBool(pl, 'wmp', 'invokeurls'); + setBool(pl, 'wmp', 'mute'); + setBool(pl, 'wmp', 'stretchtofit'); + setBool(pl, 'wmp', 'windowlessvideo'); + setStr(pl, 'wmp', 'balance'); + setStr(pl, 'wmp', 'baseurl'); + setStr(pl, 'wmp', 'captioningid'); + setStr(pl, 'wmp', 'currentmarker'); + setStr(pl, 'wmp', 'currentposition'); + setStr(pl, 'wmp', 'defaultframe'); + setStr(pl, 'wmp', 'playcount'); + setStr(pl, 'wmp', 'rate'); + setStr(pl, 'wmp', 'uimode'); + setStr(pl, 'wmp', 'volume'); + break; + + case "rmp": + setBool(pl, 'rmp', 'autostart'); + setBool(pl, 'rmp', 'loop'); + setBool(pl, 'rmp', 'autogotourl'); + setBool(pl, 'rmp', 'center'); + setBool(pl, 'rmp', 'imagestatus'); + setBool(pl, 'rmp', 'maintainaspect'); + setBool(pl, 'rmp', 'nojava'); + setBool(pl, 'rmp', 'prefetch'); + setBool(pl, 'rmp', 'shuffle'); + setStr(pl, 'rmp', 'console'); + setStr(pl, 'rmp', 'controls'); + setStr(pl, 'rmp', 'numloop'); + setStr(pl, 'rmp', 'scriptcallbacks'); + break; + } + + setStr(pl, null, 'src'); + setStr(pl, null, 'id'); + setStr(pl, null, 'name'); + setStr(pl, null, 'vspace'); + setStr(pl, null, 'hspace'); + setStr(pl, null, 'bgcolor'); + setStr(pl, null, 'align'); + setStr(pl, null, 'width'); + setStr(pl, null, 'height'); + + if ((val = ed.dom.getAttrib(fe, "width")) != "") + pl.width = f.width.value = val; + + if ((val = ed.dom.getAttrib(fe, "height")) != "") + pl.height = f.height.value = val; + + oldWidth = pl.width ? parseInt(pl.width) : 0; + oldHeight = pl.height ? parseInt(pl.height) : 0; + } else + oldWidth = oldHeight = 0; + + selectByValue(f, 'media_type', type); + changedType(type); + updateColor('bgcolor_pick', 'bgcolor'); + + TinyMCE_EditableSelects.init(); + generatePreview(); +} + +function insertMedia() { + var fe, f = document.forms[0], h; + + if (!AutoValidator.validate(f)) { + alert(ed.getLang('invalid_data')); + return false; + } + + f.width.value = f.width.value == "" ? 100 : f.width.value; + f.height.value = f.height.value == "" ? 100 : f.height.value; + + fe = ed.selection.getNode(); + if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + fe.className = "mceItemFlash"; + break; + + case "flv": + fe.className = "mceItemFlashVideo"; + break; + + case "shockwave": + fe.className = "mceItemShockWave"; + break; + + case "qt": + fe.className = "mceItemQuickTime"; + break; + + case "wmp": + fe.className = "mceItemWindowsMedia"; + break; + + case "rmp": + fe.className = "mceItemRealMedia"; + break; + } + + if (fe.width != f.width.value || fe.height != f.height.height) + ed.execCommand('mceRepaint'); + + fe.title = serializeParameters(); + fe.width = f.width.value; + fe.height = f.height.value; + fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); + fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); + fe.align = f.align.options[f.align.selectedIndex].value; + } else { + h = ' 0) { + var html = ""; + + html += ''; + + return html; + } + + return ""; +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/v=(.+)(.*)/)) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + +function setBool(pl, p, n) { + if (typeof(pl[n]) == "undefined") + return; + + document.forms[0].elements[p + "_" + n].checked = pl[n]; +} + +function setStr(pl, p, n) { + var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; + + if (typeof(pl[n]) == "undefined") + return; + + if (e.type == "text") + e.value = pl[n]; + else + selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); +} + +function getBool(p, n, d, tv, fv) { + var v = document.forms[0].elements[p + "_" + n].checked; + + tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; + fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; + + return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); +} + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function getInt(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = ''; + + nw = parseInt(f.width.value); + nh = parseInt(f.height.value); + + if (f.width.value != "" && f.height.value != "") { + if (f.constrain.checked) { + if (c == 'width' && oldWidth != 0) { + wp = nw / oldWidth; + nh = Math.round(wp * nh); + f.height.value = nh; + } else if (c == 'height' && oldHeight != 0) { + hp = nh / oldHeight; + nw = Math.round(hp * nw); + f.width.value = nw; + } + } + } + + if (f.width.value != "") + oldWidth = nw; + + if (f.height.value != "") + oldHeight = nh; + + // After constrain + pl = serializeParameters(); + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = eval('x={' + pl + '};'); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'obj' : pl.id; + pl.name = !pl.name ? 'eobj' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + h += ''; + + for (n in pl) { + h += ''; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += ''; + } + + h += ' + + + {#media_dlg.title} + + + + + + + + + + +
+ + +
+
+
+ {#media_dlg.general} + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
 
+
 
+ + + + + + +
x   
+
+
+ +
+ {#media_dlg.preview} + +
+
+ +
+
+ {#media_dlg.advanced} + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
 
+
+
+ +
+ {#media_dlg.flash_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + + + + + + + +
+
+ +
+ {#media_dlg.flv_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.qt_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+  
+ + + + + +
 
+
+
+ +
+ {#media_dlg.wmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.rmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+   +
+
+ +
+ {#media_dlg.shockwave_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/wp-includes/js/tinymce/plugins/paste/blank.htm b/wp-includes/js/tinymce/plugins/paste/blank.htm index 2c2559553b..f841206c0d 100644 --- a/wp-includes/js/tinymce/plugins/paste/blank.htm +++ b/wp-includes/js/tinymce/plugins/paste/blank.htm @@ -1,19 +1,22 @@ - + - - blank_page - - - - - - - - +blank_page + + + + + + + + + diff --git a/wp-includes/js/tinymce/plugins/paste/css/blank.css b/wp-includes/js/tinymce/plugins/paste/css/blank.css index eca411a422..f1ab113384 100644 --- a/wp-includes/js/tinymce/plugins/paste/css/blank.css +++ b/wp-includes/js/tinymce/plugins/paste/css/blank.css @@ -1,13 +1,14 @@ -body { - background-color: #FFFFFF; - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; - scrollbar-3dlight-color: #F0F0EE; - scrollbar-arrow-color: #676662; - scrollbar-base-color: #F0F0EE; - scrollbar-darkshadow-color: #DDDDDD; - scrollbar-face-color: #E0E0DD; - scrollbar-highlight-color: #F0F0EE; - scrollbar-shadow-color: #F0F0EE; - scrollbar-track-color: #F5F5F5; -} +html, body {height:98%} +body { +background-color: #FFFFFF; +font-family: Verdana, Arial, Helvetica, sans-serif; +font-size: 10px; +scrollbar-3dlight-color: #F0F0EE; +scrollbar-arrow-color: #676662; +scrollbar-base-color: #F0F0EE; +scrollbar-darkshadow-color: #DDDDDD; +scrollbar-face-color: #E0E0DD; +scrollbar-highlight-color: #F0F0EE; +scrollbar-shadow-color: #F0F0EE; +scrollbar-track-color: #F5F5F5; +} diff --git a/wp-includes/js/tinymce/plugins/paste/css/pasteword.css b/wp-includes/js/tinymce/plugins/paste/css/pasteword.css index b3be6270bb..77685fd2ee 100644 --- a/wp-includes/js/tinymce/plugins/paste/css/pasteword.css +++ b/wp-includes/js/tinymce/plugins/paste/css/pasteword.css @@ -1,3 +1,3 @@ -.sourceIframe { - border: 1px solid #808080; -} +.sourceIframe { + border: 1px solid #808080; +} diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index 5e884cffa2..42210882d2 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -1,395 +1,383 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ * * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('paste'); +(function() { + var Event = tinymce.dom.Event; -var TinyMCE_PastePlugin = { - getInfo : function() { - return { - longname : 'Paste text/word', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + tinymce.create('tinymce.plugins.PastePlugin', { + init : function(ed, url) { + var t = this; - initInstance : function(inst) { - if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false)) - tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); - }, + t.editor = ed; - handleEvent : function(e) { - // Force paste dialog if non IE browser - if (!tinyMCE.isRealIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false) && e.ctrlKey && e.keyCode == 86 && e.type == "keydown") { - window.setTimeout('tinyMCE.selectedInstance.execCommand("mcePasteText",true)', 1); - return tinyMCE.cancelEvent(e); - } - - return true; - }, - - 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'}); - } + // Register commands + ed.addCommand('mcePasteText', function(ui, v) { + if (ui) { + ed.windowManager.open({ + file : url + '/pastetext.htm', + width : 450, + height : 400, + inline : 1 + }, { + plugin_url : url + }); } else - TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']); + t._insertText(v.html, v.linebreaks); + }); - return true; - - case "mcePasteWord": - if (user_interface) { - if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) { - TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML()); - } 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'}); - } + ed.addCommand('mcePasteWord', function(ui, v) { + if (ui) { + ed.windowManager.open({ + file : url + '/pasteword.htm', + width : 450, + height : 400, + inline : 1 + }, { + plugin_url : url + }); } else - TinyMCE_PastePlugin._insertWordContent(value); + t._insertWordContent(v); + }); - return true; + ed.addCommand('mceSelectAll', function() { + ed.execCommand('selectall'); + }); - case "mceSelectAll": - tinyMCE.execInstanceCommand(editor_id, 'selectall'); - return true; + // Register buttons + ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true}); + ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true}); + ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'}); - } + if (ed.getParam("paste_auto_cleanup_on_paste", false)) { + ed.onPaste.add(function(ed, e) { + return t._handlePasteEvent(e) + }); + } - // Pass to next handler in chain - return false; - }, + if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) { + // Force paste dialog if non IE browser + ed.onKeyDown.add(function(ed, e) { + if (e.ctrlKey && e.keyCode == 86) { + window.setTimeout(function() { + ed.execCommand("mcePasteText", true); + }, 1); - // Private plugin internal methods + Event.cancel(e); + } + }); + } + }, - _handlePasteEvent : function(e) { - switch (e.type) { - case "paste": - var html = TinyMCE_PastePlugin._clipboardHTML(); - var r, inst = tinyMCE.selectedInstance; + getInfo : function() { + return { + longname : 'Paste text/word', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, - // Removes italic, strong etc, the if was needed due to bug #1437114 - if (inst && (r = inst.getRng()) && r.text.length > 0) - tinyMCE.execCommand('delete'); + // Private methods - if (html && html.length > 0) - tinyMCE.execCommand('mcePasteWord', false, html); + _handlePasteEvent : function(e) { + var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r; - tinyMCE.cancelEvent(e); - return false; - } + // Removes italic, strong etc, the if was needed due to bug #1437114 + if (ed && (r = sel.getRng()) && r.text.length > 0) + ed.execCommand('delete'); - return true; - }, + if (html && html.length > 0) + ed.execCommand('mcePasteWord', false, html); - _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"); + _insertText : function(content, bLinebreaks) { + if (content && content.length > 0) { + if (bLinebreaks) { + // Special paragraph treatment + if (this.editor.getParam("paste_create_paragraphs", true)) { + var rl = this.editor.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i

')) != -1) { - tinyMCE.execCommand("Delete"); + content = content.replace(/\r\n\r\n/g, '

'); + content = content.replace(/\r\r/g, '

'); + content = content.replace(/\n\n/g, '

'); - var node = tinyMCE.selectedInstance.getFocusElement(); + // Has paragraphs + if ((pos = content.indexOf('

')) != -1) { + this.editor.execCommand("Delete"); - // Get list of elements to break - var breakElms = new Array(); + var node = this.editor.selection.getNode(); - 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; + // Get list of elements to break + var breakElms = []; + + 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 + ">"; } - } 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; } - - before += "

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

$1

'); } - } - - tinyMCE.execCommand("mceInsertRawHTML", false, content); - } - }, - _insertWordContent : function(content) { - if (content && content.length > 0) { - // Cleanup Word content + 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 (this.editor.getParam("paste_remove_styles", true)) + content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); + + content = content.replace(/<\/?font[^>]*>/gi, ""); + + // Strips class attributes. + switch (this.editor.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="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI()); + 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 (!this.editor.getParam('force_p_newlines')) { + content = content.replace('', '' ,'gi'); + content = content.replace('

', '

' ,'gi'); + } + + if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) { + content = content.replace(/<\/?p[^>]*>/gi, ""); + } + + content = content.replace(/<\/?div[^>]*>/gi, ""); + + // Convert all middlot lists to UL lists + if (this.editor.getParam("paste_convert_middot_lists", true)) { + var div = ed.dom.create("div", null, content); + + // Convert all middot paragraphs to li elements + var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList"); + + while (this._convertMiddots(div, "--list--")) ; // bull + while (this._convertMiddots(div, middot, className)) ; // Middot + while (this._convertMiddots(div, bull)) ; // bull + + content = div.innerHTML; + } + + // Replace all headers with strong and fix some other issues + if (this.editor.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 = this.editor.getParam("paste_insert_word_content_callback", "")) != "") + content = eval(cb + "('after', content)"); + + // Insert cleaned content + this.editor.execCommand("mceInsertContent", false, content); + + if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) { + var ed = this.editor; + + window.setTimeout(function() { + ed.execCommand("mceCleanup"); + }, 1); // Do normal cleanup detached from this thread + } + } + }, + + _reEscape : function(s) { + var l = "?.\\*[](){}+^$:"; + var o = ""; + + for (var i=0; iTM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); - for (var i=0; i(.*?)<\/p>', 'gi'), '

$1

'); - } + if (class_name) + ul.className = class_name; - 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); - - if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true)) - 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 - - {$lang_paste_text_desc} - - - - - - -
-
{$lang_paste_text_desc}
- -
- -
- -
- -
{$lang_paste_text_title}
- - - -
-
- -
- -
- -
-
-
- + + + {#paste.paste_text_desc} + + + + + + +
+
{#paste.paste_text_desc}
+ +
+ +
+ +
+ +
{#paste_dlg.text_title}
+ + + +
+
+ +
+ +
+ +
+
+
+ \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/paste/pasteword.htm b/wp-includes/js/tinymce/plugins/paste/pasteword.htm index 7acc7f78f6..f96d47846f 100644 --- a/wp-includes/js/tinymce/plugins/paste/pasteword.htm +++ b/wp-includes/js/tinymce/plugins/paste/pasteword.htm @@ -1,29 +1,29 @@ - - - - {$lang_paste_word_desc} - - - - - - -
-
{$lang_paste_word_desc}
- -
{$lang_paste_word_title}
- -
- -
-
- -
- -
- -
-
-
- - + + + + {#paste.paste_word_desc} + + + + + + +
+
{#paste.paste_word_desc}
+ +
{#paste_dlg.word_title}
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/wp-includes/js/tinymce/plugins/safari/blank.htm b/wp-includes/js/tinymce/plugins/safari/blank.htm new file mode 100644 index 0000000000..266808ce2b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/safari/blank.htm @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/safari/editor_plugin.js b/wp-includes/js/tinymce/plugins/safari/editor_plugin.js new file mode 100644 index 0000000000..dc8f958825 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/safari/editor_plugin.js @@ -0,0 +1,401 @@ +/** + * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit; + + tinymce.create('tinymce.plugins.Safari', { + init : function(ed) { + var t = this, dom; + + // Ignore on non webkit + if (!tinymce.isWebKit) + return; + + t.editor = ed; + t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; + t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + // Safari will crash if the build in createlink command is used +/* ed.addCommand('CreateLink', function(u, v) { + ed.execCommand("mceInsertContent", false, '' + ed.selection.getContent() + ''); + });*/ + + // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 + ed.addCommand('FormatBlock', function(u, v) { + var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); + + if (e) + dom.replace(dom.create(v), e, 1); + else + ed.getDoc().execCommand("FormatBlock", false, v); + }); + + // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 + ed.addCommand('mceInsertContent', function(u, v) { + ed.getDoc().execCommand("InsertText", false, 'mce_marker'); + ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + 'XX'); + ed.selection.select(ed.dom.get('_mce_tmp')); + ed.getDoc().execCommand("Delete", false, ' '); + }); + + // Workaround for List ID bug, http://bugs.webkit.org/show_bug.cgi?id=16004 +/* function addList(c) { + var cb = Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e.nodeName == 'OL' || e.nodeName == 'UL') + e.id = ''; + }); + + ed.getDoc().execCommand(c, false, false); + Event.remove(ed.getDoc(), 'DOMNodeInserted', cb); + }; + + ed.addCommand('InsertUnorderedList', function() {addList('InsertUnorderedList');}); + ed.addCommand('InsertOrderedList', function() {addList('InsertOrderedList');});*/ + + // Safari returns incorrect values + ed.addQueryValueHandler('FontSize', function(u, v) { + var e, v; + + // Check for the real font size at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Check for the real font size at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontSize'); + }); + + // Safari returns incorrect values + ed.addQueryValueHandler('FontName', function(u, v) { + var e, v; + + // Check for the real font name at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Check for the real font name at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontName'); + }); + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName == 'IMG') { + t.selElm = e; + ed.selection.select(e); + } else + t.selElm = null; + }); + + ed.onBeforeExecCommand.add(function(ed, c, b) { + var r = t.bookmarkRng; + + // Restore selection + if (r) { + ed.selection.setRng(r); + t.bookmarkRng = null; + //console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + }); + + ed.onInit.add(function() { + t._fixWebKitSpans(); + + ed.windowManager.onOpen.add(function() { + var r = ed.selection.getRng(); + + // Store selection if valid + if (r.startContainer != ed.getDoc()) { + t.bookmarkRng = r.cloneRange(); + //console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + }); + + ed.windowManager.onClose.add(function() { + t.bookmarkRng = null; + }); + + if (isOldWebKit) + t._patchSafari2x(ed); + }); + + ed.onSetContent.add(function() { + dom = ed.dom; + + // Convert strong,b,em,u,strike to spans + each(['strong','b','em','u','strike','sub','sup','a'], function(v) { + each(grep(dom.select(v)).reverse(), function(n) { + var nn = n.nodeName.toLowerCase(), st; + + // Convert anchors into images + if (nn == 'a') { + if (n.name) + dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); + + return; + } + + switch (nn) { + case 'b': + case 'strong': + if (nn == 'b') + nn = 'strong'; + + st = 'font-weight: bold;'; + break; + + case 'em': + st = 'font-style: italic;'; + break; + + case 'u': + st = 'text-decoration: underline;'; + break; + + case 'sub': + st = 'vertical-align: sub;'; + break; + + case 'sup': + st = 'vertical-align: super;'; + break; + + case 'strike': + st = 'text-decoration: line-through;'; + break; + } + + dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); + }); + }); + }); + + ed.onPreProcess.add(function(ed, o) { + dom = ed.dom; + + each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { + var v, bg; + + if (o.get) { + if (dom.hasClass(n, 'Apple-style-span')) { + bg = n.style.backgroundColor; + + switch (dom.getAttrib(n, 'mce_name')) { + case 'font': + if (!ed.settings.convert_fonts_to_spans) + dom.setAttrib(n, 'style', ''); + break; + + case 'strong': + case 'em': + case 'sub': + case 'sup': + dom.setAttrib(n, 'style', ''); + break; + + case 'strike': + case 'u': + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + else + dom.setAttrib(n, 'mce_name', ''); + + break; + + default: + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + } + + + if (bg) + n.style.backgroundColor = bg; + } + } + + if (dom.hasClass(n, 'mceItemRemoved')) + dom.remove(n, 1); + }); + }); + + ed.onPostProcess.add(function(ed, o) { + // Safari adds BR at end of all block elements + o.content = o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g, ''); + + // Safari adds id="undefined" to HR elements + o.content = o.content.replace(/ id=\"undefined\"/g, ''); + }); + }, + + _fixWebKitSpans : function() { + var t = this, ed = t.editor; + + if (!isOldWebKit) { + // Use mutator events on new WebKit + Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e && e.nodeType == 1) + t._fixAppleSpan(e); + }); + } else { + // Do post command processing in old WebKit since the browser crashes on Mutator events :( + ed.onExecCommand.add(function() { + each(ed.dom.select('span'), function(n) { + t._fixAppleSpan(n); + }); + + ed.nodeChanged(); + }); + } + }, + + _fixAppleSpan : function(e) { + var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; + + if (dom.getAttrib(e, 'mce_fixed')) + return; + + // Handle Apple style spans + if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { + st = e.style; + + if (!s.convert_fonts_to_spans) { + if (st.fontSize) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); + } + + if (st.fontFamily) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'face', st.fontFamily); + } + + if (st.color) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'color', dom.toHex(st.color)); + } + + if (st.backgroundColor) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setStyle(e, 'background-color', st.backgroundColor); + } + } else { + if (st.fontSize) + dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); + } + + if (st.fontWeight == 'bold') + dom.setAttrib(e, 'mce_name', 'strong'); + + if (st.fontStyle == 'italic') + dom.setAttrib(e, 'mce_name', 'em'); + + if (st.textDecoration == 'underline') + dom.setAttrib(e, 'mce_name', 'u'); + + if (st.textDecoration == 'line-through') + dom.setAttrib(e, 'mce_name', 'strike'); + + if (st.verticalAlign == 'super') + dom.setAttrib(e, 'mce_name', 'sup'); + + if (st.verticalAlign == 'sub') + dom.setAttrib(e, 'mce_name', 'sub'); + + dom.setAttrib(e, 'mce_fixed', '1'); + } + }, + + _patchSafari2x : function(ed) { + var t = this, setContent, getNode, dom = ed.dom, lr; + + // Inline dialogs + if (ed.windowManager.onBeforeOpen) { + ed.windowManager.onBeforeOpen.add(function() { + r = ed.selection.getRng(); + }); + } + + // Fake select on 2.x + ed.selection.select = function(n) { + this.getSel().setBaseAndExtent(n, 0, n, 1); + }; + + getNode = ed.selection.getNode; + ed.selection.getNode = function() { + return t.selElm || getNode.call(this); + }; + + // Fake range on Safari 2.x + ed.selection.getRng = function() { + var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di; + + // Fake range on Safari 2.x + if (s.anchorNode) { + r = d.createRange(); + + try { + // Setup before range + rb = d.createRange(); + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(1); + + // Setup after range + ra = d.createRange(); + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(1); + + // Setup start/end points by comparing locations + di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset); + r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset); + + lr = r; + } catch (ex) { + // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!! + } + } + + return r || lr; + }; + + // Fix setContent so it works + setContent = ed.selection.setContent; + ed.selection.setContent = function(h, s) { + var r = this.getRng(), b; + + try { + setContent.call(this, h, s); + } catch (ex) { + // Workaround for Safari 2.x + b = dom.create('body'); + b.innerHTML = h; + + each(b.childNodes, function(n) { + r.insertNode(n.cloneNode(true)); + }); + } + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('safari', tinymce.plugins.Safari); +})(); + diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php new file mode 100644 index 0000000000..58d7809688 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php @@ -0,0 +1,158 @@ +_getMatches($lang, $wordstr); + $words = array(); + + for ($i=0; $i_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8")); + + return $words; + } + + /** + * Returns suggestions of for a specific word. + * + * @param {String} $lang Language code like sv or en. + * @param {String} $word Specific word to get suggestions for. + * @return {Array} Array of suggestions for the specified word. + */ + function &getSuggestions($lang, $word) { + $sug = array(); + $osug = array(); + $matches = $this->_getMatches($lang, $word); + + if (count($matches) > 0) + $sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4]))); + + // Remove empty + foreach ($sug as $item) { + if ($item) + $osug[] = $item; + } + + return $osug; + } + + function &_getMatches($lang, $str) { + $server = "www.google.com"; + $port = 443; + $path = "/tbproxy/spell?lang=" . $lang . "&hl=en"; + $host = "www.google.com"; + $url = "https://" . $server; + + // Setup XML request + $xml = '' . $str . ''; + + $header = "POST ".$path." HTTP/1.0 \r\n"; + $header .= "MIME-Version: 1.0 \r\n"; + $header .= "Content-type: application/PTI26 \r\n"; + $header .= "Content-length: ".strlen($xml)." \r\n"; + $header .= "Content-transfer-encoding: text \r\n"; + $header .= "Request-number: 1 \r\n"; + $header .= "Document-type: Request \r\n"; + $header .= "Interface-Version: Test 1.4 \r\n"; + $header .= "Connection: close \r\n\r\n"; + $header .= $xml; + + // Use curl if it exists + if (function_exists('curl_init')) { + // Use curl + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + $xml = curl_exec($ch); + curl_close($ch); + } else { + // Use raw sockets + $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30); + if ($fp) { + // Send request + fwrite($fp, $header); + + // Read response + $xml = ""; + while (!feof($fp)) + $xml .= fgets($fp, 128); + + fclose($fp); + } else + echo "Could not open SSL connection to google."; + } + + // Grab and parse content + $matches = array(); + preg_match_all('/([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER); + + return $matches; + } + + function _unhtmlentities($string) { + $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); + $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string); + + $trans_tbl = get_html_translation_table(HTML_ENTITIES); + $trans_tbl = array_flip($trans_tbl); + + return strtr($string, $trans_tbl); + } +} + +// Patch in multibyte support +if (!function_exists('mb_substr')) { + function mb_substr($str, $start, $len = '', $encoding="UTF-8"){ + $limit = strlen($str); + + for ($s = 0; $start > 0;--$start) {// found the real start + if ($s >= $limit) + break; + + if ($str[$s] <= "\x7F") + ++$s; + else { + ++$s; // skip length + + while ($str[$s] >= "\x80" && $str[$s] <= "\xBF") + ++$s; + } + } + + if ($len == '') + return substr($str, $s); + else + for ($e = $s; $len > 0; --$len) {//found the real end + if ($e >= $limit) + break; + + if ($str[$e] <= "\x7F") + ++$e; + else { + ++$e;//skip length + + while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit) + ++$e; + } + } + + return substr($str, $s, $e - $s); + } +} + +?> diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php new file mode 100644 index 0000000000..48af87379a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php @@ -0,0 +1,81 @@ +_getPLink($lang); + + $outWords = array(); + foreach ($words as $word) { + if (!pspell_check($plink, trim($word))) + $outWords[] = utf8_encode($word); + } + + return $outWords; + } + + /** + * Returns suggestions of for a specific word. + * + * @param {String} $lang Language code like sv or en. + * @param {String} $word Specific word to get suggestions for. + * @return {Array} Array of suggestions for the specified word. + */ + function &getSuggestions($lang, $word) { + $words = pspell_suggest($this->_getPLink($lang), $word); + + for ($i=0; $ithrowError("PSpell support not found in PHP installation."); + + // Setup PSpell link + $plink = pspell_new( + $lang, + $this->_config['PSpell.spelling'], + $this->_config['PSpell.jargon'], + $this->_config['PSpell.encoding'], + $this->_config['PSpell.mode'] + ); + + // Setup PSpell link +/* if (!$plink) { + $pspellConfig = pspell_config_create( + $lang, + $this->_config['PSpell.spelling'], + $this->_config['PSpell.jargon'], + $this->_config['PSpell.encoding'] + ); + + $plink = pspell_new_config($pspell_config); + }*/ + + if (!$plink) + $this->throwError("No PSpell link found opened."); + + return $plink; + } +} + +?> diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php new file mode 100644 index 0000000000..779e837227 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php @@ -0,0 +1,112 @@ +_getCMD($lang); + + if ($fh = fopen($this->_tmpfile, "w")) { + fwrite($fh, "!\n"); + + foreach($words as $key => $value) + fwrite($fh, "^" . $value . "\n"); + + fclose($fh); + } else + $this->throwError("PSpell support was not found."); + + $data = shell_exec($cmd); + @unlink($this->_tmpfile); + + $returnData = array(); + $dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY); + + foreach ($dataArr as $dstr) { + $matches = array(); + + // Skip this line. + if (strpos($dstr, "@") === 0) + continue; + + preg_match("/\& ([^ ]+) .*/i", $dstr, $matches); + + if (!empty($matches[1])) + $returnData[] = utf8_encode(trim($matches[1])); + } + + return $returnData; + } + + /** + * Returns suggestions of for a specific word. + * + * @param {String} $lang Language code like sv or en. + * @param {String} $word Specific word to get suggestions for. + * @return {Array} Array of suggestions for the specified word. + */ + function &getSuggestions($lang, $word) { + $cmd = $this->_getCMD($lang); + + if (function_exists("mb_convert_encoding")) + $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8")); + else + $word = utf8_encode($word); + + if ($fh = fopen($this->_tmpfile, "w")) { + fwrite($fh, "!\n"); + fwrite($fh, "^$word\n"); + fclose($fh); + } else + $this->throwError("Error opening tmp file."); + + $data = shell_exec($cmd); + @unlink($this->_tmpfile); + + $returnData = array(); + $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); + + foreach($dataArr as $dstr) { + $matches = array(); + + // Skip this line. + if (strpos($dstr, "@") === 0) + continue; + + preg_match("/\&[^:]+:(.*)/i", $dstr, $matches); + + if (!empty($matches[1])) { + $words = array_slice(explode(',', $matches[1]), 0, 10); + + for ($i=0; $i_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell"); + + if(preg_match("#win#i", php_uname())) + return $this->_config['PSpellShell.aspell'] . " -a --lang=". $lang . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1"; + + return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". $lang; + } +} + +?> diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php new file mode 100644 index 0000000000..c3cf778209 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php @@ -0,0 +1,61 @@ +_config = $config; + } + + /** + * Simple loopback function everything that gets in will be send back. + * + * @param $args.. Arguments. + * @return {Array} Array of all input arguments. + */ + function &loopback(/* args.. */) { + return func_get_args(); + } + + /** + * Spellchecks an array of words. + * + * @param {String} $lang Language code like sv or en. + * @param {Array} $words Array of words to spellcheck. + * @return {Array} Array of misspelled words. + */ + function &checkWords($lang, $words) { + return $words; + } + + /** + * Returns suggestions of for a specific word. + * + * @param {String} $lang Language code like sv or en. + * @param {String} $word Specific word to get suggestions for. + * @return {Array} Array of suggestions for the specified word. + */ + function &getSuggestions($lang, $word) { + return array(); + } + + /** + * Throws an error message back to the user. This will stop all execution. + * + * @param {String} $str Message to send back to user. + */ + function throwError($str) { + die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); + } +} + +?> diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php new file mode 100644 index 0000000000..1c46116768 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php @@ -0,0 +1,595 @@ +_data = $data; + $this->_len = strlen($data); + $this->_pos = -1; + $this->_location = JSON_IN_BETWEEN; + $this->_lastLocations = array(); + $this->_needProp = false; + } + + function getToken() { + return $this->_token; + } + + function getLocation() { + return $this->_location; + } + + function getTokenName() { + switch ($this->_token) { + case JSON_BOOL: + return 'JSON_BOOL'; + + case JSON_INT: + return 'JSON_INT'; + + case JSON_STR: + return 'JSON_STR'; + + case JSON_FLOAT: + return 'JSON_FLOAT'; + + case JSON_NULL: + return 'JSON_NULL'; + + case JSON_START_OBJ: + return 'JSON_START_OBJ'; + + case JSON_END_OBJ: + return 'JSON_END_OBJ'; + + case JSON_START_ARRAY: + return 'JSON_START_ARRAY'; + + case JSON_END_ARRAY: + return 'JSON_END_ARRAY'; + + case JSON_KEY: + return 'JSON_KEY'; + } + + return 'UNKNOWN'; + } + + function getValue() { + return $this->_value; + } + + function readToken() { + $chr = $this->read(); + + if ($chr != null) { + switch ($chr) { + case '[': + $this->_lastLocation[] = $this->_location; + $this->_location = JSON_IN_ARRAY; + $this->_token = JSON_START_ARRAY; + $this->_value = null; + $this->readAway(); + return true; + + case ']': + $this->_location = array_pop($this->_lastLocation); + $this->_token = JSON_END_ARRAY; + $this->_value = null; + $this->readAway(); + + if ($this->_location == JSON_IN_OBJECT) + $this->_needProp = true; + + return true; + + case '{': + $this->_lastLocation[] = $this->_location; + $this->_location = JSON_IN_OBJECT; + $this->_needProp = true; + $this->_token = JSON_START_OBJ; + $this->_value = null; + $this->readAway(); + return true; + + case '}': + $this->_location = array_pop($this->_lastLocation); + $this->_token = JSON_END_OBJ; + $this->_value = null; + $this->readAway(); + + if ($this->_location == JSON_IN_OBJECT) + $this->_needProp = true; + + return true; + + // String + case '"': + case '\'': + return $this->_readString($chr); + + // Null + case 'n': + return $this->_readNull(); + + // Bool + case 't': + case 'f': + return $this->_readBool($chr); + + default: + // Is number + if (is_numeric($chr) || $chr == '-' || $chr == '.') + return $this->_readNumber($chr); + + return true; + } + } + + return false; + } + + function _readBool($chr) { + $this->_token = JSON_BOOL; + $this->_value = $chr == 't'; + + if ($chr == 't') + $this->skip(3); // rue + else + $this->skip(4); // alse + + $this->readAway(); + + if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) + $this->_needProp = true; + + return true; + } + + function _readNull() { + $this->_token = JSON_NULL; + $this->_value = null; + + $this->skip(3); // ull + $this->readAway(); + + if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) + $this->_needProp = true; + + return true; + } + + function _readString($quote) { + $output = ""; + $this->_token = JSON_STR; + $endString = false; + + while (($chr = $this->peek()) != -1) { + switch ($chr) { + case '\\': + // Read away slash + $this->read(); + + // Read escape code + $chr = $this->read(); + switch ($chr) { + case 't': + $output .= "\t"; + break; + + case 'b': + $output .= "\b"; + break; + + case 'f': + $output .= "\f"; + break; + + case 'r': + $output .= "\r"; + break; + + case 'n': + $output .= "\n"; + break; + + case 'u': + $output .= $this->_int2utf8(hexdec($this->read(4))); + break; + + default: + $output .= $chr; + break; + } + + break; + + case '\'': + case '"': + if ($chr == $quote) + $endString = true; + + $chr = $this->read(); + if ($chr != -1 && $chr != $quote) + $output .= $chr; + + break; + + default: + $output .= $this->read(); + } + + // String terminated + if ($endString) + break; + } + + $this->readAway(); + $this->_value = $output; + + // Needed a property + if ($this->_needProp) { + $this->_token = JSON_KEY; + $this->_needProp = false; + return true; + } + + if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) + $this->_needProp = true; + + return true; + } + + function _int2utf8($int) { + $int = intval($int); + + switch ($int) { + case 0: + return chr(0); + + case ($int & 0x7F): + return chr($int); + + case ($int & 0x7FF): + return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F)); + + case ($int & 0xFFFF): + return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F)); + + case ($int & 0x1FFFFF): + return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F)); + } + } + + function _readNumber($start) { + $value = ""; + $isFloat = false; + + $this->_token = JSON_INT; + $value .= $start; + + while (($chr = $this->peek()) != -1) { + if (is_numeric($chr) || $chr == '-' || $chr == '.') { + if ($chr == '.') + $isFloat = true; + + $value .= $this->read(); + } else + break; + } + + $this->readAway(); + + if ($isFloat) { + $this->_token = JSON_FLOAT; + $this->_value = floatval($value); + } else + $this->_value = intval($value); + + if ($this->_location == JSON_IN_OBJECT && !$this->_needProp) + $this->_needProp = true; + + return true; + } + + function readAway() { + while (($chr = $this->peek()) != null) { + if ($chr != ':' && $chr != ',' && $chr != ' ') + return; + + $this->read(); + } + } + + function read($len = 1) { + if ($this->_pos < $this->_len) { + if ($len > 1) { + $str = substr($this->_data, $this->_pos + 1, $len); + $this->_pos += $len; + + return $str; + } else + return $this->_data[++$this->_pos]; + } + + return null; + } + + function skip($len) { + $this->_pos += $len; + } + + function peek() { + if ($this->_pos < $this->_len) + return $this->_data[$this->_pos + 1]; + + return null; + } +} + +/** + * This class handles JSON stuff. + * + * @package MCManager.utils + */ +class Moxiecode_JSON { + function Moxiecode_JSON() { + } + + function decode($input) { + $reader = new Moxiecode_JSONReader($input); + + return $this->readValue($reader); + } + + function readValue(&$reader) { + $this->data = array(); + $this->parents = array(); + $this->cur =& $this->data; + $key = null; + $loc = JSON_IN_ARRAY; + + while ($reader->readToken()) { + switch ($reader->getToken()) { + case JSON_STR: + case JSON_INT: + case JSON_BOOL: + case JSON_FLOAT: + case JSON_NULL: + switch ($reader->getLocation()) { + case JSON_IN_OBJECT: + $this->cur[$key] = $reader->getValue(); + break; + + case JSON_IN_ARRAY: + $this->cur[] = $reader->getValue(); + break; + + default: + return $reader->getValue(); + } + break; + + case JSON_KEY: + $key = $reader->getValue(); + break; + + case JSON_START_OBJ: + case JSON_START_ARRAY: + if ($loc == JSON_IN_OBJECT) + $this->addArray($key); + else + $this->addArray(null); + + $cur =& $obj; + + $loc = $reader->getLocation(); + break; + + case JSON_END_OBJ: + case JSON_END_ARRAY: + $loc = $reader->getLocation(); + + if (count($this->parents) > 0) { + $this->cur =& $this->parents[count($this->parents) - 1]; + array_pop($this->parents); + } + break; + } + } + + return $this->data[0]; + } + + // This method was needed since PHP is crapy and doesn't have pointers/references + function addArray($key) { + $this->parents[] =& $this->cur; + $ar = array(); + + if ($key) + $this->cur[$key] =& $ar; + else + $this->cur[] =& $ar; + + $this->cur =& $ar; + } + + function getDelim($index, &$reader) { + switch ($reader->getLocation()) { + case JSON_IN_ARRAY: + case JSON_IN_OBJECT: + if ($index > 0) + return ","; + break; + } + + return ""; + } + + function encode($input) { + switch (gettype($input)) { + case 'boolean': + return $input ? 'true' : 'false'; + + case 'integer': + return (int) $input; + + case 'float': + case 'double': + return (float) $input; + + case 'NULL': + return 'null'; + + case 'string': + return $this->encodeString($input); + + case 'array': + return $this->_encodeArray($input); + + case 'object': + return $this->_encodeArray(get_object_vars($input)); + } + + return ''; + } + + function encodeString($input) { + // Needs to be escaped + if (preg_match('/[^a-zA-Z0-9]/', $input)) { + $output = ''; + + for ($i=0; $i_utf82utf16($char))); + } if (($byte & 0xF0) == 0xE0) { + $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2])); + $i += 2; + $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); + } if (($byte & 0xF8) == 0xF0) { + $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]))); + $i += 3; + $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); + } if (($byte & 0xFC) == 0xF8) { + $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]))); + $i += 4; + $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); + } if (($byte & 0xFE) == 0xFC) { + $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]))); + $i += 5; + $output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char))); + } else if ($byte < 128) + $output .= $input[$i]; + } + } + + return '"' . $output . '"'; + } + + return '"' . $input . '"'; + } + + function _utf82utf16($utf8) { + if (function_exists('mb_convert_encoding')) + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + + switch (strlen($utf8)) { + case 1: + return $utf8; + + case 2: + return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1]))); + + case 3: + return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2]))); + } + + return ''; + } + + function _encodeArray($input) { + $output = ''; + $isIndexed = true; + + $keys = array_keys($input); + for ($i=0; $iencodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]); + $isIndexed = false; + } else + $output .= $this->encode($input[$keys[$i]]); + + if ($i != count($keys) - 1) + $output .= ','; + } + + return $isIndexed ? '[' . $output . ']' : '{' . $output . '}'; + } +} + +?> diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php new file mode 100644 index 0000000000..a1fb4cd09e --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php @@ -0,0 +1,268 @@ +_path = ""; + $this->_filename = "{level}.log"; + $this->setMaxSize("100k"); + $this->_maxFiles = 10; + $this->_level = MC_LOGGER_DEBUG; + $this->_format = "[{time}] [{level}] {message}"; + } + + /** + * Sets the current log level, use the MC_LOGGER constants. + * + * @param int $level Log level instance for example MC_LOGGER_DEBUG. + */ + function setLevel($level) { + if (is_string($level)) { + switch (strtolower($level)) { + case "debug": + $level = MC_LOGGER_DEBUG; + break; + + case "info": + $level = MC_LOGGER_INFO; + break; + + case "warn": + case "warning": + $level = MC_LOGGER_WARN; + break; + + case "error": + $level = MC_LOGGER_ERROR; + break; + + case "fatal": + $level = MC_LOGGER_FATAL; + break; + + default: + $level = MC_LOGGER_FATAL; + } + } + + $this->_level = $level; + } + + /** + * Returns the current log level for example MC_LOGGER_DEBUG. + * + * @return int Current log level for example MC_LOGGER_DEBUG. + */ + function getLevel() { + return $this->_level; + } + + function setPath($path) { + $this->_path = $path; + } + + function getPath() { + return $this->_path; + } + + function setFileName($file_name) { + $this->_filename = $file_name; + } + + function getFileName() { + return $this->_filename; + } + + function setFormat($format) { + $this->_format = $format; + } + + function getFormat() { + return $this->_format; + } + + function setMaxSize($size) { + // Fix log max size + $logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size)); + + // Is KB + if (strpos((strtolower($size)), "k") > 0) + $logMaxSizeBytes *= 1024; + + // Is MB + if (strpos((strtolower($size)), "m") > 0) + $logMaxSizeBytes *= (1024 * 1024); + + $this->_maxSizeBytes = $logMaxSizeBytes; + $this->_maxSize = $size; + } + + function getMaxSize() { + return $this->_maxSize; + } + + function setMaxFiles($max_files) { + $this->_maxFiles = $max_files; + } + + function getMaxFiles() { + return $this->_maxFiles; + } + + function debug($msg) { + $args = func_get_args(); + $this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args)); + } + + function info($msg) { + $args = func_get_args(); + $this->_logMsg(MC_LOGGER_INFO, implode(', ', $args)); + } + + function warn($msg) { + $args = func_get_args(); + $this->_logMsg(MC_LOGGER_WARN, implode(', ', $args)); + } + + function error($msg) { + $args = func_get_args(); + $this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args)); + } + + function fatal($msg) { + $args = func_get_args(); + $this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args)); + } + + function isDebugEnabled() { + return $this->_level >= MC_LOGGER_DEBUG; + } + + function isInfoEnabled() { + return $this->_level >= MC_LOGGER_INFO; + } + + function isWarnEnabled() { + return $this->_level >= MC_LOGGER_WARN; + } + + function isErrorEnabled() { + return $this->_level >= MC_LOGGER_ERROR; + } + + function isFatalEnabled() { + return $this->_level >= MC_LOGGER_FATAL; + } + + function _logMsg($level, $message) { + $roll = false; + + if ($level < $this->_level) + return; + + $logFile = $this->toOSPath($this->_path . "/" . $this->_filename); + + switch ($level) { + case MC_LOGGER_DEBUG: + $levelName = "DEBUG"; + break; + + case MC_LOGGER_INFO: + $levelName = "INFO"; + break; + + case MC_LOGGER_WARN: + $levelName = "WARN"; + break; + + case MC_LOGGER_ERROR: + $levelName = "ERROR"; + break; + + case MC_LOGGER_FATAL: + $levelName = "FATAL"; + break; + } + + $logFile = str_replace('{level}', strtolower($levelName), $logFile); + + $text = $this->_format; + $text = str_replace('{time}', date("Y-m-d H:i:s"), $text); + $text = str_replace('{level}', strtolower($levelName), $text); + $text = str_replace('{message}', $message, $text); + $message = $text . "\r\n"; + + // Check filesize + if (file_exists($logFile)) { + $size = @filesize($logFile); + + if ($size + strlen($message) > $this->_maxSizeBytes) + $roll = true; + } + + // Roll if the size is right + if ($roll) { + for ($i=$this->_maxFiles-1; $i>=1; $i--) { + $rfile = $this->toOSPath($logFile . "." . $i); + $nfile = $this->toOSPath($logFile . "." . ($i+1)); + + if (@file_exists($rfile)) + @rename($rfile, $nfile); + } + + @rename($logFile, $this->toOSPath($logFile . ".1")); + + // Delete last logfile + $delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1)); + if (@file_exists($delfile)) + @unlink($delfile); + } + + // Append log line + if (($fp = @fopen($logFile, "a")) != null) { + @fputs($fp, $message); + @fflush($fp); + @fclose($fp); + } + } + + /** + * Converts a Unix path to OS specific path. + * + * @param String $path Unix path to convert. + */ + function toOSPath($path) { + return str_replace("/", DIRECTORY_SEPARATOR, $path); + } +} + +?> \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/spellchecker/config.php b/wp-includes/js/tinymce/plugins/spellchecker/config.php index 097d46b6bd..a518570082 100644 --- a/wp-includes/js/tinymce/plugins/spellchecker/config.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/config.php @@ -1,24 +1,21 @@ diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/content.css b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css index c56a4538a7..656ce1eee6 100644 --- a/wp-includes/js/tinymce/plugins/spellchecker/css/content.css +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css @@ -1,4 +1 @@ -.mceItemHiddenSpellWord { - background: url('../images/wline.gif') repeat-x bottom left; - cursor: default; -} +.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css index f2c6ac74de..2891cec484 100644 --- a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css @@ -1,35 +1,35 @@ -.mceMsgBox { - border: 1px solid gray; - padding: 8px; -} - -.mceMsgBox span { - vertical-align: top; - color: #555555; -} - -/* Misc */ - -.mceBlockBox { - display: none; - position: absolute; - left: 0; - top: 0; - z-index: 100; - filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60); - -moz-opacity:0.6; - opacity: 0.6; - background-color: white; -} - -.mceMsgBox { - display: none; - z-index: 101; - position: absolute; - left: 0; - top: 0; - font-family: Arial, Verdana, Tahoma, Helvetica; - font-weight: bold; - font-size: 11px; - background-color: #FFF; -} +.mceMsgBox { + border: 1px solid gray; + padding: 8px; +} + +.mceMsgBox span { + vertical-align: top; + color: #555555; +} + +/* Misc */ + +.mceBlockBox { + display: none; + position: absolute; + left: 0; + top: 0; + z-index: 100; + filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60); + -moz-opacity:0.6; + opacity: 0.6; + background-color: white; +} + +.mceMsgBox { + display: none; + z-index: 101; + position: absolute; + left: 0; + top: 0; + font-family: Arial, Verdana, Tahoma, Helvetica; + font-weight: bold; + font-size: 11px; + background-color: #FFF; +} diff --git a/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js index 865b332a19..ea425b14d4 100644 --- a/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js @@ -1,551 +1,190 @@ /** - * $Id: editor_plugin_src.js 289 2007-05-28 09:12:16Z spocke $ + * $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $ * * @author Moxiecode - * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ -tinyMCE.importPluginLanguagePack('spellchecker', 'en,fr,sv,nn,nb'); - -// Plucin static class -var TinyMCE_SpellCheckerPlugin = { - _contextMenu : new TinyMCE_Menu(), - _menu : new TinyMCE_Menu(), - _counter : 0, - _ajaxPage : '/tinyspell.php', - - getInfo : function() { - return { - longname : 'Spellchecker PHP', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', - version : "1.0.5" - }; - }, - - handleEvent : function(e) { - var elm = tinyMCE.isMSIE ? e.srcElement : e.target; - var inst = tinyMCE.selectedInstance, args = ''; - var self = TinyMCE_SpellCheckerPlugin; - var cm = self._contextMenu; - var p, p2, x, y, sx, sy, h, elm; - - // Handle click on word - if ((e.type == "click" || e.type == "contextmenu") && elm) { - do { - if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") { - inst.spellCheckerElm = elm; - - // Setup arguments - args += 'id=' + inst.editorId + "|" + (++self._counter); - args += '&cmd=suggest&check=' + encodeURIComponent(elm.innerHTML); - args += '&lang=' + escape(inst.spellCheckerLang); - - elm = inst.spellCheckerElm; - p = tinyMCE.getAbsPosition(inst.iframeElement); - p2 = tinyMCE.getAbsPosition(elm); - h = parseInt(elm.offsetHeight); - sx = inst.getBody().scrollLeft; - sy = inst.getBody().scrollTop; - x = p.absLeft + p2.absLeft - sx; - y = p.absTop + p2.absTop - sy + h; - - cm.clear(); - cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true)); - cm.show(); - cm.moveTo(x, y); - - inst.selection.selectNode(elm, false, false); - - self._sendAjax(self.baseURL + self._ajaxPage, self._ajaxResponse, 'post', args); - - tinyMCE.cancelEvent(e); - return false; - } - } while ((elm = elm.parentNode)); - } - - return true; - }, - - initInstance : function(inst) { - var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e; - - tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css"); - - if (!tinyMCE.hasMenu('spellcheckercontextmenu')) { - tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css"); - - cm.init({drop_menu : false}); - tinyMCE.addMenu('spellcheckercontextmenu', cm); - } - - if (!tinyMCE.hasMenu('spellcheckermenu')) { - m.init({}); - tinyMCE.addMenu('spellcheckermenu', m); - } - - inst.spellCheckerLang = 'en'; - self._buildSettingsMenu(inst, null); - - e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent')); - self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent')); - }, - - _getMsgBoxLayer : function(inst) { - if (!inst.spellCheckerMsgBoxL) - inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false); - - return inst.spellCheckerMsgBoxL; - }, - - _getBlockBoxLayer : function(inst) { - if (!inst.spellCheckerBoxL) - inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false); - - return inst.spellCheckerBoxL; - }, - - _buildSettingsMenu : function(inst, lang) { - var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p; - var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c; - - m.clear(); - m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true)); - - for (i=0; i'; - h += ''; - h += ''; - h += ''; - } else { - if (tinyMCE.isMSIE && !tinyMCE.isOpera) - h += ''; - else - h += ''; - - h += ''; - h += ''; - h += ''; - h += ''; - } - - return h; - }, - - _menuButtonEvent : function(e, o) { - var t = this; - - // Give IE some time since it's buggy!! :( - window.setTimeout(function() { - t._menuButtonEvent2(e, o); - }, 1); - }, - - _menuButtonEvent2 : function(e, o) { - if (o.className == 'mceMenuButtonFocus') - return; - - if (e == 'over') - o.className = o.className + ' mceMenuHover'; - else - o.className = o.className.replace(/\s.*$/, ''); - }, - - _toggleMenu : function(editor_id, id) { - var self = TinyMCE_SpellCheckerPlugin; - var e = document.getElementById(editor_id + '_spellchecker'); - var inst = tinyMCE.getInstanceById(editor_id); - - if (self._menu.isVisible()) { - tinyMCE.hideMenus(); - return; - } - - tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, ''); - tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus'); - - self._menu.moveRelativeTo(e, 'bl'); - self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1); - - if (tinyMCE.isOpera) - self._menu.moveBy(0, -2); - - self._onMenuEvent(inst, self._menu, 'show'); - - self._menu.show(); - - tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker'; - }, - - _onMenuEvent : function(inst, m, n) { - TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang); - }, - - execCommand : function(editor_id, element, command, user_interface, value) { - var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e, mbs; - - // Handle commands - switch (command) { - case "mceSpellCheck": - if (!inst.spellcheckerOn) { - inst.spellCheckerBookmark = inst.selection.getBookmark(); - - // Fix for IE bug: #1610184 - if (tinyMCE.isRealIE) - tinyMCE.setInnerHTML(inst.getBody(), inst.getBody().innerHTML); - - // Setup arguments - args += 'id=' + inst.editorId + "|" + (++self._counter); - args += '&cmd=spell&check=' + encodeURIComponent(self._getWordList(inst.getBody())).replace(/\'/g, '%27'); - args += '&lang=' + escape(inst.spellCheckerLang); - - co = document.getElementById(inst.editorId + '_parent').firstChild; - bb = self._getBlockBoxLayer(inst); - bb.moveRelativeTo(co, 'tl'); - bb.resizeTo(co.offsetWidth, co.offsetHeight); - bb.show(); - - // Setup message box - mb = self._getMsgBoxLayer(inst); - e = mb.getElement(); - - if (e.childNodes[0]) - e.removeChild(e.childNodes[0]); - - mbs = document.createElement("span"); - mbs.innerHTML = '' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + ''; - e.appendChild(mbs); - - mb.show(); - mb.moveRelativeTo(co, 'cc'); - - if (tinyMCE.isMSIE && !tinyMCE.isOpera) { - nl = co.getElementsByTagName('select'); - for (i=0; i 500) - text = text.substring(500); - - inst.spellcheckerOn = false; - tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton'); - alert("Could not execute AJAX call, server didn't return valid a XML.\nResponse: " + text); - return; - } - - err = el.getAttribute("error"); - - if (err == "true") { - inst.spellcheckerOn = false; - tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton'); - alert(el.getAttribute("msg")); - return; - } - - switch (cmd) { - case "spell": - if (xml.documentElement.firstChild) { - self._markWords(inst.getDoc(), inst.getBody(), decodeURIComponent(el.firstChild.nodeValue).split('+')); - inst.selection.moveToBookmark(inst.spellCheckerBookmark); - - if(tinyMCE.getParam('spellchecker_report_misspellings', false)) - alert(tinyMCE.getLang('lang_spellchecker_mpell_found', '', true, {words : self._countWords(inst)})); +(function() { + var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.SpellcheckerPlugin', { + getInfo : function() { + return { + longname : 'Spellchecker', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', + version : "2.0b2" + }; + }, + + init : function(ed, url) { + var t = this, cm; + + t.url = url; + t.editor = ed; + + // Register commands + ed.addCommand('mceSpellCheck', function() { + if (!t.active) { + ed.setProgressState(1); + t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) { + if (r.length > 0) { + t.active = 1; + t._markWords(r); + ed.setProgressState(0); + ed.nodeChanged(); + } else { + ed.setProgressState(0); + ed.windowManager.alert('spellchecker.no_mpell'); + } + }); } else - alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true)); + t._done(); + }); - self._checkDone(inst); + ed.onInit.add(function() { + ed.dom.loadCSS(url + '/css/content.css'); + }); - // Odd stuff FF removed useCSS, disable state for it - inst.useCSS = false; + ed.onClick.add(t._showMenu, t); + ed.onContextMenu.add(t._showMenu, t); + ed.onBeforeGetContent.add(function() { + if (t.active) + t._removeWords(); + }); - break; + ed.onNodeChange.add(function(ed, cm) { + cm.setActive('spellchecker', t.active); + }); - case "suggest": - self._buildMenu(el.firstChild ? decodeURIComponent(el.firstChild.nodeValue).split('+') : null, 10); - self._contextMenu.show(); - break; - } - }, + ed.onSetContent.add(function() { + t._done(); + }); - _getWordSeparators : function() { - var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c'); + ed.onBeforeGetContent.add(function() { + t._done(); + }); - for (i=0; i 0) - wl[wl.length] = nl[i]; - } + // Internal functions - return wl.join(' '); - }, + _walk : function(n, f) { + var d = this.editor.getDoc(), w; - _removeWords : function(doc, word, cleanup) { - var i, c, nl = doc.getElementsByTagName("span"); - var self = TinyMCE_SpellCheckerPlugin; - var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null; + if (d.createTreeWalker) { + w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); - word = typeof(word) == 'undefined' ? null : word; + while ((n = w.nextNode()) != null) + f.call(this, n); + } else + tinymce.walk(n, f, 'childNodes'); + }, - for (i=nl.length-1; i>=0; i--) { - c = tinyMCE.getAttrib(nl[i], 'class'); + _getSeparators : function() { + var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c'); - if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word)) - self._removeWord(nl[i]); - } + // Build word separator regexp + for (i=0; i=0; i--) { - c = tinyMCE.getAttrib(nl[i], 'class'); + // Build word array and remove duplicates + each(tx.split(' '), function(v) { + if (!lo[v]) { + wl.push(v); + lo[v] = 1; + } + }); - if (c == 'mceItemHiddenSpellWord') - w++; - } + return wl; + }, - return w; - }, + _removeWords : function(w) { + var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark(); - _removeWord : function(e) { - if (e != null) - tinyMCE.setOuterHTML(e, e.innerHTML); - }, + each(dom.select('span').reverse(), function(n) { + if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) { + if (!w || dom.decode(n.innerHTML) == w) + dom.remove(n, 1); + } + }); - _markWords : function(doc, n, wl) { - var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3); - var r1, r2, r3, r4, r5, w = ''; - var re = TinyMCE_SpellCheckerPlugin._getWordSeparators(); + se.moveToBookmark(b); + }, - for (i=0; i 0) - w += wl[i] + ((i == wl.length-1) ? '' : '|'); - } + _markWords : function(wl) { + var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = []; + var se = ed.selection, b = se.getBookmark(); - for (i=0; i$1$2'); - nv = nv.replace(r3, '$1$2'); + // Collect all text nodes + this._walk(this.editor.getBody(), function(n) { + if (n.nodeType == 3) { + nl.push(n); + } + }); - nn = doc.createElement('span'); - nn.className = "mceItemHidden"; - nn.innerHTML = nv; + // Wrap incorrect words in spans + each(nl, function(n) { + var v; - // Remove old text node - nl[i].parentNode.replaceChild(nn, nl[i]); + if (n.nodeType == 3) { + v = n.nodeValue; + + if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) { + v = dom.encode(v); + v = v.replace(r5, '$1$2'); + v = v.replace(r3, '$1$2'); + + dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n); + } + } + }); + + se.moveToBookmark(b); + }, + + _showMenu : function(ed, e) { + var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()); + + if (!m) { + p1 = DOM.getPos(ed.getContentAreaContainer()); + //p2 = DOM.getPos(ed.getContainer()); + + m = ed.controlManager.createDropMenu('spellcheckermenu', { + offset_x : p1.x, + offset_y : p1.y, + 'class' : 'noIcons' + }); + + t._menu = m; } - } - }, - _buildMenu : function(sg, max) { - var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu; + if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) { + m.removeAll(); + m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1); - cm.clear(); + t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) { + m.removeAll(); - if (sg != null) { - cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true)); + if (r.length > 0) { + m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + each(r, function(v) { + m.add({title : v, onclick : function() { + dom.replace(ed.getDoc().createTextNode(v), e.target); + t._checkDone(); + }}); + }); - for (i=0; i $value) + $newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize); + + return $newarray; + } + + return formatParam($_REQUEST[$name], $sanitize); +} + +function &getLogger() { + global $mcLogger, $man; + + if (isset($man)) + $mcLogger = $man->getLogger(); + + if (!$mcLogger) { + $mcLogger = new Moxiecode_Logger(); + + // Set logger options + $mcLogger->setPath(dirname(__FILE__) . "/../logs"); + $mcLogger->setMaxSize("100kb"); + $mcLogger->setMaxFiles("10"); + $mcLogger->setFormat("{time} - {message}"); + } + + return $mcLogger; +} + +function debug($msg) { + $args = func_get_args(); + + $log = getLogger(); + $log->debug(implode(', ', $args)); +} + +function info($msg) { + $args = func_get_args(); + + $log = getLogger(); + $log->info(implode(', ', $args)); +} + +function error($msg) { + $args = func_get_args(); + + $log = getLogger(); + $log->error(implode(', ', $args)); +} + +function warn($msg) { + $args = func_get_args(); + + $log = getLogger(); + $log->warn(implode(', ', $args)); +} + +function fatal($msg) { + $args = func_get_args(); + + $log = getLogger(); + $log->fatal(implode(', ', $args)); +} + +?> \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/spellchecker/rpc.php b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php new file mode 100644 index 0000000000..d7b74362e7 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php @@ -0,0 +1,75 @@ +decode($raw); + +// Execute RPC +if (isset($config['general.engine'])) { + $spellchecker = new $config['general.engine']($config); + $result = call_user_func_array(array($spellchecker, $input['method']), $input['params']); +} else + die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); + +// Request and response id should always be the same +$output = array( + "id" => $input->id, + "result" => $result, + "error" => null +); + +// Return JSON encoded string +echo $json->encode($output); + +?> \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index 8d5f25774e..6708faae37 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -1,5 +1,5 @@ /* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('wordpress', 'en'); +//tinyMCE.importPluginLanguagePack('wordpress', 'en'); var TinyMCE_wordpressPlugin = { getInfo : function() { @@ -287,6 +287,10 @@ var TinyMCE_wordpressPlugin = { saveCallback : function(el, content, body) { // We have a TON of cleanup to do. + if ( tinyMCE.activeEditor.isHidden() ) { + // return content; + } + // Mark

if it has any attributes. content = content.replace(new RegExp('(]+>.*?)

', 'mg'), '$1'); @@ -294,7 +298,7 @@ var TinyMCE_wordpressPlugin = { // content = content.replace(new RegExp('&', 'g'), '&'); // Get it ready for wpautop. - content = content.replace(new RegExp('\\s*

', 'mgi'), ''); + content = content.replace(new RegExp('\\s*

', 'mgi'), ''); content = content.replace(new RegExp('\\s*

\\s*', 'mgi'), '\n\n'); content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); content = content.replace(new RegExp('\\s*
\\s*', 'gi'), '\n'); @@ -304,7 +308,12 @@ var TinyMCE_wordpressPlugin = { content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); content = content.replace(new RegExp('\\s*\\s*', 'mg'), '\n'); content = content.replace(new RegExp('
  • ', 'g'), '\t
  • '); - + + if ( content.indexOf(']*)>\\s*', 'g'), ""); // no pee inside object/embed + content = content.replace(new RegExp('\\s*\\s*', 'g'), ''); + } + // Unmark special paragraph closing tags content = content.replace(new RegExp('', 'g'), '

    \n'); content = content.replace(new RegExp('\\s*(]+>.*

    )', 'mg'), '\n$1'); @@ -365,7 +374,7 @@ var TinyMCE_wordpressPlugin = { } }; -tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin); +//tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin); /* This little hack protects our More and Page placeholders from the removeformat command */ tinyMCE.orgExecCommand = tinyMCE.execCommand; @@ -476,7 +485,7 @@ function switchEditors(id) { var ta = document.getElementById(id); var pdr = ta.parentNode; - if ( inst ) { + if ( ! inst.isHidden(id) ) { edToggle(H, P); if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { @@ -492,19 +501,19 @@ function switchEditors(id) { var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0]; var y1 = table.offsetTop + table.offsetHeight; - if ( TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height") == null ) { + if ( tinymce.util.Cookie.get("TinyMCE_" + inst.editorId + "_height") == null ) { var expires = new Date(); expires.setTime(expires.getTime() + 3600000 * 24 * 30); var offset = tinyMCE.isMSIE ? 1 : 2; - TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires); + tinymce.util.Cookie.set("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires); } // Unload the rich editor - inst.triggerSave(false, false); - htm = inst.formElement.value; - tinyMCE.removeMCEControl(id); - document.getElementById(id).value = htm; - --tinyMCE.idCounter; + // inst.triggerSave(false, false); + // inst.formElement.value; + inst.hide(); // tinyMCE.removeMCEControl(id); + // document.getElementById(id).value = htm; + // --tinyMCE.idCounter; // Reveal Quicktags and textarea qt.style.display = 'block'; @@ -543,14 +552,14 @@ function switchEditors(id) { ta.parentNode.style.paddingRight = '0px'; // Load the rich editor with formatted html - if ( tinyMCE.isMSIE ) { + //if ( tinyMCE.isMSIE ) { + // ta.value = wpautop(ta.value); + // tinyMCE.addMCEControl(ta, id); + //} else { ta.value = wpautop(ta.value); - tinyMCE.addMCEControl(ta, id); - } else { - htm = wpautop(ta.value); - tinyMCE.addMCEControl(ta, id); - tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm); - } + inst.show() // tinyMCE.addMCEControl(ta, id); + //tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm); + //} if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { } else { diff --git a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css index 115b291ccc..a611ed0176 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css +++ b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css @@ -1,81 +1,81 @@ -.mce_plugin_wordpress_more { - border: 0px; - border-top: 1px dotted #cccccc; - display:block; - background-color: #ffffff; - margin-top:15px; - background-image: url(images/more_bug.gif); - background-repeat: no-repeat; - background-position: right top; -} - -.mce_plugin_wordpress_page { - border: 0px; - border-top: 1px dotted #cccccc; - display:block; - background-color: #ffffff; - margin-top:15px; - background-image: url(images/page_bug.gif); - background-repeat: no-repeat; - background-position: right top; -} - -/* This file contains the CSS data for the editable area(iframe) of TinyMCE */ -/* You can extend this CSS by adding your own CSS file with the the content_css option */ - -body { - background: #fff; - font: 1em/1.3em Georgia, "Times New Roman", Times, serif; - padding: .5em; -} - -td { - font-size: 10px; -} - -pre { - font-family: "Courier New", fixed; - font-size: 11px; - line-height: 13px; -} - -.mceVisualAid { - border: 1px dashed #BBBBBB !important; -} - -.mceItemAnchor { - width: 12px; - line-height: 6px; - overflow: hidden; - padding-left: 12px; - background-position: bottom; - background-repeat: no-repeat; -} - -/* Important is needed in Gecko browsers inorder to style links */ -/* -a { - color: green !important; -} -*/ - -/* Style selection range colors in Gecko browsers */ -/* -::-moz-selection { - background-color: red; - color: green; -} -*/ - -/* MSIE specific */ - -* html body { - scrollbar-3dlight-color: #F0F0EE; - scrollbar-arrow-color: #676662; - scrollbar-base-color: #F0F0EE; - scrollbar-darkshadow-color: #DDDDDD; - scrollbar-face-color: #E0E0DD; - scrollbar-highlight-color: #F0F0EE; - scrollbar-shadow-color: #F0F0EE; - scrollbar-track-color: #F5F5F5; +.mce_plugin_wordpress_more { + border: 0px; + border-top: 1px dotted #cccccc; + display:block; + background-color: #ffffff; + margin-top:15px; + background-image: url(images/more_bug.gif); + background-repeat: no-repeat; + background-position: right top; +} + +.mce_plugin_wordpress_page { + border: 0px; + border-top: 1px dotted #cccccc; + display:block; + background-color: #ffffff; + margin-top:15px; + background-image: url(images/page_bug.gif); + background-repeat: no-repeat; + background-position: right top; +} + +/* This file contains the CSS data for the editable area(iframe) of TinyMCE */ +/* You can extend this CSS by adding your own CSS file with the the content_css option */ + +body { + background: #fff; + font: 1em/1.3em Georgia, "Times New Roman", Times, serif; + padding: .5em; +} + +td { + font-size: 10px; +} + +pre { + font-family: "Courier New", fixed; + font-size: 11px; + line-height: 13px; +} + +.mceVisualAid { + border: 1px dashed #BBBBBB !important; +} + +.mceItemAnchor { + width: 12px; + line-height: 6px; + overflow: hidden; + padding-left: 12px; + background-position: bottom; + background-repeat: no-repeat; +} + +/* Important is needed in Gecko browsers inorder to style links */ +/* +a { + color: green !important; +} +*/ + +/* Style selection range colors in Gecko browsers */ +/* +::-moz-selection { + background-color: red; + color: green; +} +*/ + +/* MSIE specific */ + +* html body { + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; } \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/about.htm b/wp-includes/js/tinymce/themes/advanced/about.htm index bb275f0a9a..3c0a2fbf1d 100644 --- a/wp-includes/js/tinymce/themes/advanced/about.htm +++ b/wp-includes/js/tinymce/themes/advanced/about.htm @@ -1,35 +1,39 @@ + - {$lang_about_title} - - - - + {#advanced_dlg.about_title} + + + - +
    -

    {$lang_about_title}

    -

    Version: {$tinymce_version} ({$tinymce_releasedate})

    +

    {#advanced_dlg.about_title}

    +

    Version: ()

    TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

    Copyright © 2003-2007, Moxiecode Systems AB, All rights reserved.

    For more information about this software visit the TinyMCE website.

    -
    +
    + Got Moxie? + Hosted By Sourceforge + Also on freshmeat +
    -

    {$lang_loaded_plugins}

    +

    {#advanced_dlg.about_loaded}

    @@ -45,7 +49,7 @@
    - +
    diff --git a/wp-includes/js/tinymce/themes/advanced/anchor.htm b/wp-includes/js/tinymce/themes/advanced/anchor.htm index 988bcb68ed..c1c37b043f 100644 --- a/wp-includes/js/tinymce/themes/advanced/anchor.htm +++ b/wp-includes/js/tinymce/themes/advanced/anchor.htm @@ -1,33 +1,32 @@ + - {$lang_insert_anchor_title} - - + {#advanced_dlg.anchor_title} + + - -
    - + + - + - +
    {$lang_insert_anchor_title}{#advanced_dlg.anchor_title}
    {$lang_insert_anchor_name}:{#advanced_dlg.anchor_name}:
    - +
    - +
    -
    diff --git a/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-includes/js/tinymce/themes/advanced/charmap.htm index fbd472b191..9333836937 100644 --- a/wp-includes/js/tinymce/themes/advanced/charmap.htm +++ b/wp-includes/js/tinymce/themes/advanced/charmap.htm @@ -1,19 +1,19 @@ - {$lang_theme_charmap_title} + {#advanced_dlg.charmap_title} - - + + - + - + - '; - deltaHeight -= 23; - } - - template['html'] += '
    {$lang_theme_charmap_title}{#advanced_dlg.charmap_title}
    - + + diff --git a/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-includes/js/tinymce/themes/advanced/color_picker.htm index 5e2492034f..c4c6fb0916 100644 --- a/wp-includes/js/tinymce/themes/advanced/color_picker.htm +++ b/wp-includes/js/tinymce/themes/advanced/color_picker.htm @@ -1,27 +1,27 @@ + - {$lang_theme_colorpicker_title} - - - - + {#advanced_dlg.colorpicker_title} + + + - +
    - {$lang_color_picker} + {#advanced_dlg.colorpicker_picker_title}
    - +
    @@ -34,7 +34,7 @@
    - {$lang_web_colors} + {#advanced_dlg.colorpicker_palette_title}
    @@ -45,7 +45,7 @@
    - {$lang_named_colors} + {#advanced_dlg.colorpicker_named_title}
    @@ -53,7 +53,7 @@
    - {$lang_color_name} + {#advanced_dlg.colorpicker_name}
    @@ -61,13 +61,13 @@
    - +
    - +
    diff --git a/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css b/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css index 4b0360bf11..ae02c65376 100644 --- a/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css +++ b/wp-includes/js/tinymce/themes/advanced/css/colorpicker.css @@ -1,53 +1,53 @@ -/* Colorpicker dialog specific CSS */ - -#preview { - float: right; - width: 50px; - height: 14px; - line-height: 1px; - border: 1px solid black; - margin-left: 5px; -} - -#colorpicker { - float: left; - cursor: crosshair; -} - -#light { - border: 1px solid gray; - margin-left: 5px; - float: left; - width: 15px; - cursor: crosshair; -} - -#light div { - overflow: hidden; -} - -#previewblock { - float: right; - padding-left: 10px; - height: 20px; -} - -.panel_wrapper div.current { - height: 175px; -} - -#namedcolors { - width: 150px; -} - -#namedcolors a { - display: block; - float: left; - width: 10px; height: 10px; - margin: 1px 1px 0 0; - overflow: hidden; -} - -#colornamecontainer { - margin-top: 5px; +/* Colorpicker dialog specific CSS */ + +#preview { + float: right; + width: 50px; + height: 14px; + line-height: 1px; + border: 1px solid black; + margin-left: 5px; +} + +#colorpicker { + float: left; + cursor: crosshair; +} + +#light { + border: 1px solid gray; + margin-left: 5px; + float: left; + width: 15px; + cursor: crosshair; +} + +#light div { + overflow: hidden; +} + +#previewblock { + float: right; + padding-left: 10px; + height: 20px; +} + +.panel_wrapper div.current { + height: 175px; +} + +#namedcolors { + width: 150px; +} + +#namedcolors a { + display: block; + float: left; + width: 10px; height: 10px; + margin: 1px 1px 0 0; + overflow: hidden; +} + +#colornamecontainer { + margin-top: 5px; } \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css index 182e791211..5cbe6bbbee 100644 --- a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css +++ b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css @@ -1,58 +1,58 @@ -/* This file contains the CSS data for the editable area(iframe) of TinyMCE */ -/* You can extend this CSS by adding your own CSS file with the the content_css option */ - -body, td, pre { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; -} - -body { - background-color: #FFFFFF; -} - -.mceVisualAid { - border: 1px dashed #BBBBBB !important; -} - -div.mceVisualAid { - background-image:url('../images/spacer.gif'); - visibility: visible !important; -} - -.mceItemAnchor { - width: 12px; - line-height: 6px; - overflow: hidden; - padding-left: 12px; - background-image: url('../images/anchor_symbol.gif'); - background-position: bottom; - background-repeat: no-repeat; -} - -/* Important is needed in Gecko browsers inorder to style links */ -/* -a { - color: green !important; -} -*/ - -/* Style selection range colors in Gecko browsers */ -/* -::-moz-selection { - background-color: red; - color: green; -} -*/ - -/* MSIE specific */ - -* html body { - scrollbar-3dlight-color: #F0F0EE; - scrollbar-arrow-color: #676662; - scrollbar-base-color: #F0F0EE; - scrollbar-darkshadow-color: #DDDDDD; - scrollbar-face-color: #E0E0DD; - scrollbar-highlight-color: #F0F0EE; - scrollbar-shadow-color: #F0F0EE; - scrollbar-track-color: #F5F5F5; -} +/* This file contains the CSS data for the editable area(iframe) of TinyMCE */ +/* You can extend this CSS by adding your own CSS file with the the content_css option */ + +body, td, pre { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; +} + +body { + background-color: #FFFFFF; +} + +.mceVisualAid { + border: 1px dashed #BBBBBB !important; +} + +div.mceVisualAid { + background-image:url('../images/spacer.gif'); + visibility: visible !important; +} + +.mceItemAnchor { + width: 12px; + line-height: 6px; + overflow: hidden; + padding-left: 12px; + background-image: url('../images/anchor_symbol.gif'); + background-position: bottom; + background-repeat: no-repeat; +} + +/* Important is needed in Gecko browsers inorder to style links */ +/* +a { + color: green !important; +} +*/ + +/* Style selection range colors in Gecko browsers */ +/* +::-moz-selection { + background-color: red; + color: green; +} +*/ + +/* MSIE specific */ + +* html body { + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; +} diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css index e7853e4d82..834f849def 100644 --- a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css +++ b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css @@ -1,358 +1,358 @@ -/* This file contains the CSS data for all popups in TinyMCE */ - -body { - background-color: #F0F0EE; - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 11px; - scrollbar-3dlight-color: #F0F0EE; - scrollbar-arrow-color: #676662; - scrollbar-base-color: #F0F0EE; - scrollbar-darkshadow-color: #DDDDDD; - scrollbar-face-color: #E0E0DD; - scrollbar-highlight-color: #F0F0EE; - scrollbar-shadow-color: #F0F0EE; - scrollbar-track-color: #F5F5F5; - margin: 8px; -} - -td { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 11px; -} - -input { - background: #FFFFFF; - border: 1px solid #cccccc; -} - -td, input, select, textarea { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; -} - -input, select, textarea { - border: 1px solid #808080; -} - -.input_noborder { - border: 0; -} - -#insert, .updateButton { - font-weight: bold; - width: 90px; - height: 21px; - border: 0; - background-image: url('../images/insert_button_bg.gif'); - cursor: pointer; -} - -#cancel { - font-weight: bold; - width: 90px; - height: 21px; - border: 0; - background-image: url('../images/cancel_button_bg.gif'); - cursor: pointer; -} - -/* Mozilla only style */ -html>body #insert, html>body #cancel { - padding-bottom: 2px; -} - -.title { - font-size: 12px; - font-weight: bold; - color: #2B6FB6; -} - -table.charmap { - border-style: solid; - border-width: 1px; - border-color: #AAAAAA; -} - -td.charmap, td.charmapOver { - color: #000000; - border-color: #AAAAAA; - border-style: solid; - border-width: 1px; - text-align: center; - font-size: 12px; -} - -td.charmapOver { - background-color: #CCCCCC; - cursor: default; -} - -a.charmap { - color: #000000; - text-decoration: none -} - -.wordWrapCode { - vertical-align: middle; - border: 1px none #000000; - background-color: transparent; -} - -input.radio { - border: 1px none #000000; - background-color: transparent; - vertical-align: middle; -} - -input.checkbox { - border: 1px none #000000; - background-color: transparent; - vertical-align: middle; -} - -.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected { - margin-left: 1px; -} - -.mceButtonNormal { - border-top: 1px solid; - border-left: 1px solid; - border-bottom: 1px solid; - border-right: 1px solid; - border-color: #F0F0EE; - cursor: default; -} - -.mceButtonOver { - border: 1px solid #0A246A; - cursor: default; - background-color: #B6BDD2; -} - -.mceButtonDown { - cursor: default; - border: 1px solid #0A246A; - background-color: #8592B5; -} - -.mceButtonDisabled { - filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); - -moz-opacity:0.3; - opacity: 0.3; - border-top: 1px solid; - border-left: 1px solid; - border-bottom: 1px solid; - border-right: 1px solid; - border-color: #F0F0EE; - cursor: default; -} - -.mceActionPanel { - margin-top: 5px; -} - -/* Tabs classes */ - -.tabs { - float: left; - width: 100%; - line-height: normal; - background-image: url("../images/xp/tabs_bg.gif"); -} - -.tabs ul { - margin: 0; - padding: 0 0 0; - list-style: none; -} - -.tabs li { - float: left; - background: url("../images/xp/tab_bg.gif") no-repeat left top; - margin: 0; - margin-left: 0; - margin-right: 2px; - padding: 0 0 0 10px; - line-height: 18px; -} - -.tabs li.current { - background: url("../images/xp/tab_sel_bg.gif") no-repeat left top; - margin-right: 2px; -} - -.tabs span { - float: left; - display: block; - background: url("../images/xp/tab_end.gif") no-repeat right top; - padding: 0px 10px 0 0; -} - -.tabs .current span { - background: url("../images/xp/tab_sel_end.gif") no-repeat right top; -} - -.tabs a { - text-decoration: none; - font-family: Verdana, Arial; - font-size: 10px; -} - -.tabs a:link, .tabs a:visited, .tabs a:hover { - color: black; -} - -.tabs a:hover { -} - -.tabs .current { -} - -.tabs .current a, .tabs .current a:link, .tabs .current a:visited { -} - -.panel_wrapper div.panel { - display: none; -} - -.panel_wrapper div.current { - display: block; - width: 100%; - height: 300px; - overflow: visible; /* Should be auto but that breaks Safari */ -} - -.panel_wrapper { - border: 1px solid #919B9C; - border-top: 0px; - padding: 10px; - padding-top: 5px; - clear: both; - background-color: white; -} - -fieldset { - border: 1px solid #919B9C; - font-family: Verdana, Arial; - font-size: 10px; - padding: 0; - margin: 0; - padding: 4px; -} - -legend { - color: #2B6FB6; - font-weight: bold; -} - -.properties { - width: 100%; -} - -.properties .column1 { -} - -.properties .column2 { - text-align: left; -} - -a:link, a:visited { - color: black; -} - -a:hover { - color: #2B6FB6; -} - -#plugintable thead { - font-weight: bold; - background-color: #DDDDDD; -} - -#plugintable, #about #plugintable td { - border: 1px solid #919B9C; -} - -#plugintable { - width: 99%; - margin-top: 10px; -} - -#pluginscontainer { - height: 290px; - overflow: auto; -} - -/* MSIE Specific styles */ - -* html .panel_wrapper { - width: 100%; -} - -.column { - float: left; -} - -h1, h2, h3, h4 { - color: #2B6FB6; - margin: 0; - padding: 0; - padding-top: 5px; -} - -h3 { - font-size: 14px; -} - -#link .panel_wrapper, #link div.current { - height: 125px; -} - -#image .panel_wrapper, #image div.current { - height: 190px; -} - -label.msg { display: none; } -label.invalid { color: #EE0000; display: inline; } -input.invalid { border: 1px solid #EE0000; } - -/* Disables the advanced tab in the table plugin. */ -/* -#table #advanced_tab { - display: none; -} -*/ - -/* Disables the border input field and label in the table plugin. */ -/* -#table #border, #table #borderlabel { - display: none; -} -*/ - -/* Below this line is WordPress customizations */ -#insert, #cancel, .submitbutton { - font: 11px Verdana, Arial, Helvetica, sans-serif; - height: auto; - width: auto; - background-color: transparent; - background-image: url(../../../../../../wp-admin/images/fade-butt.png); - background-repeat: repeat; - border: 3px double; - border-right-color: rgb(153, 153, 153); - border-bottom-color: rgb(153, 153, 153); - border-left-color: rgb(204, 204, 204); - border-top-color: rgb(204, 204, 204); - color: rgb(51, 51, 51); - padding: 0.1em 0.5em; -} - -#insert:active, #cancel:active, .submitbutton:active { - background: #f4f4f4; - border-left-color: #999; - border-top-color: #999; -} - -#styleSelectRow { - display: none; +/* This file contains the CSS data for all popups in TinyMCE */ + +body { + background-color: #F0F0EE; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; + margin: 8px; +} + +td { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; +} + +input { + background: #FFFFFF; + border: 1px solid #cccccc; +} + +td, input, select, textarea { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; +} + +input, select, textarea { + border: 1px solid #808080; +} + +.input_noborder { + border: 0; +} + +#insert, .updateButton { + font-weight: bold; + width: 90px; + height: 21px; + border: 0; + background-image: url('../images/insert_button_bg.gif'); + cursor: pointer; +} + +#cancel { + font-weight: bold; + width: 90px; + height: 21px; + border: 0; + background-image: url('../images/cancel_button_bg.gif'); + cursor: pointer; +} + +/* Mozilla only style */ +html>body #insert, html>body #cancel { + padding-bottom: 2px; +} + +.title { + font-size: 12px; + font-weight: bold; + color: #2B6FB6; +} + +table.charmap { + border-style: solid; + border-width: 1px; + border-color: #AAAAAA; +} + +td.charmap, td.charmapOver { + color: #000000; + border-color: #AAAAAA; + border-style: solid; + border-width: 1px; + text-align: center; + font-size: 12px; +} + +td.charmapOver { + background-color: #CCCCCC; + cursor: default; +} + +a.charmap { + color: #000000; + text-decoration: none +} + +.wordWrapCode { + vertical-align: middle; + border: 1px none #000000; + background-color: transparent; +} + +input.radio { + border: 1px none #000000; + background-color: transparent; + vertical-align: middle; +} + +input.checkbox { + border: 1px none #000000; + background-color: transparent; + vertical-align: middle; +} + +.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected { + margin-left: 1px; +} + +.mceButtonNormal { + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: #F0F0EE; + cursor: default; +} + +.mceButtonOver { + border: 1px solid #0A246A; + cursor: default; + background-color: #B6BDD2; +} + +.mceButtonDown { + cursor: default; + border: 1px solid #0A246A; + background-color: #8592B5; +} + +.mceButtonDisabled { + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); + -moz-opacity:0.3; + opacity: 0.3; + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: #F0F0EE; + cursor: default; +} + +.mceActionPanel { + margin-top: 5px; +} + +/* Tabs classes */ + +.tabs { + float: left; + width: 100%; + line-height: normal; + background-image: url("../images/xp/tabs_bg.gif"); +} + +.tabs ul { + margin: 0; + padding: 0 0 0; + list-style: none; +} + +.tabs li { + float: left; + background: url("../images/xp/tab_bg.gif") no-repeat left top; + margin: 0; + margin-left: 0; + margin-right: 2px; + padding: 0 0 0 10px; + line-height: 18px; +} + +.tabs li.current { + background: url("../images/xp/tab_sel_bg.gif") no-repeat left top; + margin-right: 2px; +} + +.tabs span { + float: left; + display: block; + background: url("../images/xp/tab_end.gif") no-repeat right top; + padding: 0px 10px 0 0; +} + +.tabs .current span { + background: url("../images/xp/tab_sel_end.gif") no-repeat right top; +} + +.tabs a { + text-decoration: none; + font-family: Verdana, Arial; + font-size: 10px; +} + +.tabs a:link, .tabs a:visited, .tabs a:hover { + color: black; +} + +.tabs a:hover { +} + +.tabs .current { +} + +.tabs .current a, .tabs .current a:link, .tabs .current a:visited { +} + +.panel_wrapper div.panel { + display: none; +} + +.panel_wrapper div.current { + display: block; + width: 100%; + height: 300px; + overflow: visible; /* Should be auto but that breaks Safari */ +} + +.panel_wrapper { + border: 1px solid #919B9C; + border-top: 0px; + padding: 10px; + padding-top: 5px; + clear: both; + background-color: white; +} + +fieldset { + border: 1px solid #919B9C; + font-family: Verdana, Arial; + font-size: 10px; + padding: 0; + margin: 0; + padding: 4px; +} + +legend { + color: #2B6FB6; + font-weight: bold; +} + +.properties { + width: 100%; +} + +.properties .column1 { +} + +.properties .column2 { + text-align: left; +} + +a:link, a:visited { + color: black; +} + +a:hover { + color: #2B6FB6; +} + +#plugintable thead { + font-weight: bold; + background-color: #DDDDDD; +} + +#plugintable, #about #plugintable td { + border: 1px solid #919B9C; +} + +#plugintable { + width: 99%; + margin-top: 10px; +} + +#pluginscontainer { + height: 290px; + overflow: auto; +} + +/* MSIE Specific styles */ + +* html .panel_wrapper { + width: 100%; +} + +.column { + float: left; +} + +h1, h2, h3, h4 { + color: #2B6FB6; + margin: 0; + padding: 0; + padding-top: 5px; +} + +h3 { + font-size: 14px; +} + +#link .panel_wrapper, #link div.current { + height: 125px; +} + +#image .panel_wrapper, #image div.current { + height: 190px; +} + +label.msg { display: none; } +label.invalid { color: #EE0000; display: inline; } +input.invalid { border: 1px solid #EE0000; } + +/* Disables the advanced tab in the table plugin. */ +/* +#table #advanced_tab { + display: none; +} +*/ + +/* Disables the border input field and label in the table plugin. */ +/* +#table #border, #table #borderlabel { + display: none; +} +*/ + +/* Below this line is WordPress customizations */ +#insert, #cancel, .submitbutton { + font: 11px Verdana, Arial, Helvetica, sans-serif; + height: auto; + width: auto; + background-color: transparent; + background-image: url(../../../../../../wp-admin/images/fade-butt.png); + background-repeat: repeat; + border: 3px double; + border-right-color: rgb(153, 153, 153); + border-bottom-color: rgb(153, 153, 153); + border-left-color: rgb(204, 204, 204); + border-top-color: rgb(204, 204, 204); + color: rgb(51, 51, 51); + padding: 0.1em 0.5em; +} + +#insert:active, #cancel:active, .submitbutton:active { + background: #f4f4f4; + border-left-color: #999; + border-top-color: #999; +} + +#styleSelectRow { + display: none; } \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js index be0e234ee4..a3e5730c98 100644 --- a/wp-includes/js/tinymce/themes/advanced/editor_template.js +++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js @@ -1,1521 +1,992 @@ /** - * $Id: editor_template_src.js 256 2007-04-24 09:03:20Z spocke $ + * $Id: editor_template_src.js 520 2008-01-07 16:30:32Z spocke $ * * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ -/* Import theme specific language pack */ -tinyMCE.importThemeLanguagePack('advanced'); +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID; -var TinyMCE_AdvancedTheme = { - // Private theme fields - _defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF", - _autoImportCSSClasses : true, - _resizer : {}, - _buttons : [ - // Control id, button img, button title, command, user_interface, value - ['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'], - ['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'], - ['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'], - ['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'], - ['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'], - ['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'], - ['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'], - ['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'], - ['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'], - ['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'], - ['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'], - ['indent', 'indent.gif', 'lang_indent_desc', 'Indent'], - ['cut', 'cut.gif', 'lang_cut_desc', 'Cut'], - ['copy', 'copy.gif', 'lang_copy_desc', 'Copy'], - ['paste', 'paste.gif', 'lang_paste_desc', 'Paste'], - ['undo', 'undo.gif', 'lang_undo_desc', 'Undo'], - ['redo', 'redo.gif', 'lang_redo_desc', 'Redo'], - ['link', 'link.gif', 'lang_link_desc', 'mceLink', true], - ['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'], - ['image', 'image.gif', 'lang_image_desc', 'mceImage', true], - ['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'], - ['help', 'help.gif', 'lang_help_desc', 'mceHelp'], - ['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'], - ['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'], - ['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'], - ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'], - ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], - ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], - ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true], - ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], - ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true], - ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], - ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], - ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'], - ['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument'] - ], + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('advanced'); - _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table', + tinymce.create('tinymce.themes.AdvancedTheme', { + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + link : ['link_desc', 'mceLink'], + unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, - /** - * Returns HTML code for the specificed control. - */ - getControlHTML : function(button_name) { - var i, x, but; + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], - // Lookup button in button list - for (i=0; i 4 ? but[4] : false), (but.length > 5 ? but[5] : null)); + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); - if (but[0] == button_name) - return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null)); - } + // Default settings + t.settings = s = extend({ + theme_advanced_path : true, + theme_advanced_toolbar_location : 'bottom', + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", + theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_advanced_toolbar_align : "center", + theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_advanced_font_sizes : "1,2,3,4,5,6,7", + theme_advanced_more_colors : 1, + theme_advanced_row_height : 23, + theme_advanced_resize_horizontal : 1, + theme_advanced_resizing_use_cookie : 1 + }, ed.settings); - // Custom controlls other than buttons - switch (button_name) { - case "formatselect": - var html = ''; + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); - return html; - - case "styleselect": - return ''; - - case "fontselect": - var fontHTML = ''; - return fontHTML; - - case "fontsizeselect": - return ''; - - case "|": - case "separator": - return ''; - - case "spacer": - return ''; - - case "rowseparator": - return '
    '; - } - - return ""; - }, - - /** - * Theme specific execcommand handling. - */ - execCommand : function(editor_id, element, command, user_interface, value) { - switch (command) { - case 'mceHelp': - tinyMCE.openWindow({ - file : 'about.htm', - width : 480, - height : 380 - }, { - tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion, - tinymce_releasedate : tinyMCE.releaseDate, - inline : "yes" - }); - return true; - - case "mceLink": - var inst = tinyMCE.getInstanceById(editor_id); - var doc = inst.getDoc(); - var selectedText = ""; - - if (tinyMCE.isMSIE) { - var rng = doc.selection.createRange(); - selectedText = rng.text; - } else - selectedText = inst.getSel().toString(); - - if (!tinyMCE.linkElement) { - if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0)) - return true; - } - - var href = "", target = "", title = "", onclick = "", action = "insert", style_class = ""; - - if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a") - tinyMCE.linkElement = tinyMCE.selectedElement; - - // Is anchor not a link - if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "") - tinyMCE.linkElement = null; - - if (tinyMCE.linkElement) { - href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href'); - target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target'); - title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title'); - onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick'); - style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class'); - - // Try old onclick to if copy/pasted content - if (onclick == "") - onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick'); - - onclick = tinyMCE.cleanupEventStr(onclick); - - href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);"); - - // Use mce_href if defined - mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href'); - if (mceRealHref != "") { - href = mceRealHref; - - if (tinyMCE.getParam('convert_urls')) - href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);"); - } - - action = "update"; - } - - var template = new Array(); - - template['file'] = 'link.htm'; - template['width'] = 310; - template['height'] = 200; - - // Language specific width and height addons - template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0); - - if (inst.settings['insertlink_callback']) { - var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);"); - if (returnVal && returnVal['href']) - TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']); + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); } else { - tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"}); + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); } + }); - return true; + DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css")); + }, - case "mceImage": - var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = ""; - var title = "", onmouseover = "", onmouseout = "", action = "insert"; - var img = tinyMCE.imgElement; - var inst = tinyMCE.getInstanceById(editor_id); + createControl : function(n, cf) { + var cd, c; - if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") { - img = tinyMCE.selectedElement; - tinyMCE.imgElement = img; - } + if (c = cf.createControl(n)) + return c; - if (img) { - // Is it a internal MCE visual aid image, then skip this one. - if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0) - return true; + switch (n) { + case "styleselect": + return this._createStyleSelect(); - src = tinyMCE.getAttrib(img, 'src'); - alt = tinyMCE.getAttrib(img, 'alt'); + case "formatselect": + return this._createBlockFormats(); - // Try polling out the title - if (alt == "") - alt = tinyMCE.getAttrib(img, 'title'); + case "fontselect": + return this._createFontSelect(); - // Fix width/height attributes if the styles is specified - if (tinyMCE.isGecko) { - var w = img.style.width; - if (w != null && w != "") - img.setAttribute("width", w); + case "fontsizeselect": + return this._createFontSizeSelect(); - var h = img.style.height; - if (h != null && h != "") - img.setAttribute("height", h); - } + case "forecolor": + return this._createForeColorMenu(); - border = tinyMCE.getAttrib(img, 'border'); - hspace = tinyMCE.getAttrib(img, 'hspace'); - vspace = tinyMCE.getAttrib(img, 'vspace'); - width = tinyMCE.getAttrib(img, 'width'); - height = tinyMCE.getAttrib(img, 'height'); - align = tinyMCE.getAttrib(img, 'align'); - onmouseover = tinyMCE.getAttrib(img, 'onmouseover'); - onmouseout = tinyMCE.getAttrib(img, 'onmouseout'); - title = tinyMCE.getAttrib(img, 'title'); - - // Is realy specified? - if (tinyMCE.isMSIE) { - width = img.attributes['width'].specified ? width : ""; - height = img.attributes['height'].specified ? height : ""; - } - - //onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover)); - //onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout)); - - src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);"); - - // Use mce_src if defined - mceRealSrc = tinyMCE.getAttrib(img, 'mce_src'); - if (mceRealSrc != "") { - src = mceRealSrc; - - if (tinyMCE.getParam('convert_urls')) - src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);"); - } - - //if (onmouseover != "") - // onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);"); - - //if (onmouseout != "") - // onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);"); - - action = "update"; - } - - var template = new Array(); - - template['file'] = 'image.htm?src={$src}'; - template['width'] = 355; - template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0); - - // Language specific width and height addons - template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0); - - if (inst.settings['insertimage_callback']) { - var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);"); - if (returnVal && returnVal['src']) - TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']); - } else - tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"}); - - return true; - - case "forecolor": - var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm; - - TinyMCE_AdvancedTheme._hideMenus(editor_id); - - if (!fcp.exists()) { - fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); - elm = fcp.getElement(); - elm._editor_id = editor_id; - elm._command = "forecolor"; - elm._switchId = editor_id + "_forecolor"; - tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); - tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); - tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); - } - - img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0]; - p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); - - fcp.moveTo(p.absLeft, p.absTop); - fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor; - fcp.show(); - - return false; - - case "forecolorpicker": - this._pickColor(editor_id, 'forecolor'); - return true; - - case "forecolorMenu": - TinyMCE_AdvancedTheme._hideMenus(editor_id); - - // Create color layer - var ml = new TinyMCE_Layer(editor_id + '_fcMenu'); - - if (!ml.exists()) - ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor')); - - tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus'); - ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl'); - - ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); - - if (tinyMCE.isOpera) - ml.moveBy(0, -2); - - ml.show(); - return true; - - case "HiliteColor": - var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img; - - TinyMCE_AdvancedTheme._hideMenus(editor_id); - - if (!bcp.exists()) { - bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); - elm = bcp.getElement(); - elm._editor_id = editor_id; - elm._command = "HiliteColor"; - elm._switchId = editor_id + "_backcolor"; - tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); - tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); - tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); - } - - img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0]; - p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); - - bcp.moveTo(p.absLeft, p.absTop); - bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor; - bcp.show(); - - return false; - - case "HiliteColorMenu": - TinyMCE_AdvancedTheme._hideMenus(editor_id); - - // Create color layer - var ml = new TinyMCE_Layer(editor_id + '_bcMenu'); - - if (!ml.exists()) - ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor')); - - tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus'); - ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl'); - - ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); - - if (tinyMCE.isOpera) - ml.moveBy(0, -2); - - ml.show(); - return true; - - case "backcolorpicker": - this._pickColor(editor_id, 'HiliteColor'); - return true; - - case "mceColorPicker": - if (user_interface) { - var template = []; - - if (!value['callback'] && !value['color']) - value['color'] = value['document'].getElementById(value['element_id']).value; - - template['file'] = 'color_picker.htm'; - template['width'] = 380; - template['height'] = 250; - template['close_previous'] = "no"; - - template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0); - - if (typeof(value['store_selection']) == "undefined") - value['store_selection'] = true; - - tinyMCE.lastColorPickerValue = value; - tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']}); - } else { - var savedVal = tinyMCE.lastColorPickerValue, elm; - - if (savedVal['callback']) { - savedVal['callback'](value); - return true; - } - - elm = savedVal['document'].getElementById(savedVal['element_id']); - elm.value = value; - - if (elm.onchange != null && elm.onchange != '') - eval('elm.onchange();'); - } - return true; - - case "mceCodeEditor": - var template = new Array(); - - template['file'] = 'source_editor.htm'; - template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720)); - template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580)); - - tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"}); - return true; - - case "mceCharMap": - var template = new Array(); - - template['file'] = 'charmap.htm'; - template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0); - template['height'] = 250; - - template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0); - - tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); - return true; - - case "mceInsertAnchor": - var template = new Array(); - - template['file'] = 'anchor.htm'; - template['width'] = 320; - template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0); - - template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0); - - tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); - return true; - - case "mceNewDocument": - if (confirm(tinyMCE.getLang('lang_newdocument'))) - tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' '); - - return true; - } - - return false; - }, - - /** - * Editor instance template function. - */ - getEditorTemplate : function(settings, editorId) { - function removeFromArray(in_array, remove_array) { - var outArray = new Array(), skip; - - for (var i=0; i 

    '; - var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout"); - - // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY! - var styleSelectHTML = ''; - if (settings['theme_advanced_styles']) { - var stylesAr = settings['theme_advanced_styles'].split(';'); - - for (var i=0; i' + key + ''; - } - - TinyMCE_AdvancedTheme._autoImportCSSClasses = false; - } - - switch(layoutManager) { - case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)... - var toolbarHTML = ""; - var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom"); - var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center"); - var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity - var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation); - var defVals = { - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect", - theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code", - theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap" - }; - - // Add accessibility control - toolbarHTML += ' 0) { - toolbarHTML += "
    "; - deltaHeight -= 23; - } - } - - // Add accessibility control - toolbarHTML += '
    '; - - // Setup template html - template['html'] = '
    '; - - if (toolbarLocation == "top") - template['html'] += ''; - - if (statusbarLocation == "top") { - template['html'] += ''; - deltaHeight -= 23; - } - - template['html'] += ''; - - if (toolbarLocation == "bottom") - template['html'] += ''; - - // External toolbar changes - if (toolbarLocation == "external") { - var bod = document.body; - var elm = document.createElement ("div"); - - toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML); - toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId}); - - elm.className = "mceToolbarExternal"; - elm.id = editorId+"_toolbar"; - elm.innerHTML = '
    ' + toolbarHTML + '
    ' + statusbarHTML + '
    ' + toolbarHTML + '
    '+toolbarHTML+'
    '; - bod.appendChild (elm); - // bod.style.marginTop = elm.offsetHeight + "px"; - - deltaHeight = 0; - tinyMCE.getInstanceById(editorId).toolbarElement = elm; - - //template['html'] = '
    '+toolbarHTML+'
    ' + template["html"]; - } else { - tinyMCE.getInstanceById(editorId).toolbarElement = null; - } - - if (statusbarLocation == "bottom") { - template['html'] += '
    ' + statusbarHTML + '
    '; - //"SimpleLayout" - break; - - case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom. - template['html'] = ''; - - var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ","); - var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container"); - var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center"); - - //Render Containers: - for (var i = 0; i < containers.length; i++) - { - if (containers[i] == "mceEditor") //Exceptions for mceEditor and ... - template['html'] += ''; - else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath: - { - var pathClass = "mceStatusbar"; - - if (i == containers.length-1) - { - pathClass = "mceStatusbarBottom"; - } - else if (i == 0) - { - pathClass = "mceStatusbar"; - } - else - { - deltaHeight-=2; - } - - template['html'] += ''; - deltaHeight -= 22; - } else { // Render normal Container - var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ','); - var curContainerHTML = ""; - var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign); - var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS); - - curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ',')); - - for (var j=0; j 0) { - curContainerHTML += "
    "; - deltaHeight -= 23; - } - - template['html'] += '
    '; - } - } - - template['html'] += '
    ' + statusbarHTML + '
    ' + curContainerHTML + '
    '; - //RowLayout - break; - - case "CustomLayout" : //User defined layout callback... - var customLayout = tinyMCE.getParam("theme_advanced_custom_layout",""); - - if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") { - template = eval(customLayout + "(template);"); - } - break; - } - - if (resizing) - template['html'] += ''; - - template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML); - - // Set to default values - if (!template['delta_width']) - template['delta_width'] = 0; - - if (!template['delta_height']) - template['delta_height'] = deltaHeight; - - return template; - }, - - initInstance : function(inst) { - if (tinyMCE.getParam("theme_advanced_resizing", false)) { - if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) { - var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width"); - var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height"); - - TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true)); - } - } - - inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink'); - }, - - removeInstance : function(inst) { - new TinyMCE_Layer(inst.editorId + '_fcMenu').remove(); - new TinyMCE_Layer(inst.editorId + '_bcMenu').remove(); - }, - - hideInstance : function(inst) { - TinyMCE_AdvancedTheme._hideMenus(inst.editorId); - }, - - _handleMenuEvent : function(e) { - var te = tinyMCE.isMSIE ? window.event.srcElement : e.target; - tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId)); - - if (e.type == "click") - tinyMCE.execInstanceCommand(te._editor_id, te._command); - }, - - _hideMenus : function(id) { - var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu'); - - if (fcml.exists() && fcml.isVisible()) { - tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton'); - fcml.hide(); - } - - if (bcml.exists() && bcml.isVisible()) { - tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton'); - bcml.hide(); - } - }, - - /** - * Node change handler. - */ - handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) { - var alignNode, breakOut, classNode; - - function selectByValue(select_elm, value, first_index) { - first_index = typeof(first_index) == "undefined" ? false : true; - - if (select_elm) { - for (var i=0; i=0; i--) { - var nodeName = path[i].nodeName.toLowerCase(); - var nodeData = ""; + n = o.targetNode; - if (nodeName.indexOf("html:") == 0) - nodeName = nodeName.substring(5); + // Add classes to first and last TRs + nl = sc.rows; + DOM.addClass(nl[0], 'first'); + DOM.addClass(nl[nl.length - 1], 'last'); - if (nodeName == "b") { - nodeName = "strong"; - } + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'first'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'last'); + }); - if (nodeName == "i") { - nodeName = "em"; - } - - if (nodeName == "span") { - var cn = tinyMCE.getAttrib(path[i], "class"); - if (cn != "" && cn.indexOf('mceItem') == -1) - nodeData += "class: " + cn + " "; - - var st = tinyMCE.getAttrib(path[i], "style"); - if (st != "") { - st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st)); - nodeData += "style: " + tinyMCE.xmlEncode(st) + " "; - } - } - - if (nodeName == "font") { - if (tinyMCE.getParam("convert_fonts_to_spans")) - nodeName = "span"; - - var face = tinyMCE.getAttrib(path[i], "face"); - if (face != "") - nodeData += "font: " + tinyMCE.xmlEncode(face) + " "; - - var size = tinyMCE.getAttrib(path[i], "size"); - if (size != "") - nodeData += "size: " + tinyMCE.xmlEncode(size) + " "; - - var color = tinyMCE.getAttrib(path[i], "color"); - if (color != "") - nodeData += "color: " + tinyMCE.xmlEncode(color) + " "; - } - - if (tinyMCE.getAttrib(path[i], 'id') != "") { - nodeData += "id: " + path[i].getAttribute('id') + " "; - } - - var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false); - if (className != "" && className.indexOf('mceItem') == -1) - nodeData += "class: " + className + " "; - - if (tinyMCE.getAttrib(path[i], 'src') != "") { - var src = tinyMCE.getAttrib(path[i], "mce_src"); - - if (src == "") - src = tinyMCE.getAttrib(path[i], "src"); - - nodeData += "src: " + tinyMCE.xmlEncode(src) + " "; - } - - if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") { - var href = tinyMCE.getAttrib(path[i], "mce_href"); - - if (href == "") - href = tinyMCE.getAttrib(path[i], "href"); - - nodeData += "href: " + tinyMCE.xmlEncode(href) + " "; - } - - className = tinyMCE.getAttrib(path[i], "class"); - if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) { - nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase(); - nodeData = path[i].getAttribute('title'); - } - - if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") { - nodeName = "a"; - nodeName += "#" + tinyMCE.xmlEncode(anchor); - nodeData = ""; - } - - if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) { - var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false); - if (className != "" && className.indexOf('mceItem') == -1) { - nodeName += "." + className; - } - } - - var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');'; - html += '' + nodeName + ''; - - if (i > 0) { - html += " » "; - } - } - - pathElm.innerHTML = '' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' '; - } - - // Reset old states - tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled'); - tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled'); - tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled'); - tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal'); - - if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1) - tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected'); - - // Get link - var anchorLink = tinyMCE.getParentElement(node, "a", "href"); - - if (anchorLink || any_selection) { - tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal'); - } - - // Handle visual aid - tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal'); - - if (undo_levels != -1) { - tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled'); - tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled'); - } - - // Within li, blockquote - if (tinyMCE.getParentElement(node, "li,blockquote")) - tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal'); - - // Has redo levels - if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0)) - tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal'); - - // Has undo levels - if (undo_index != -1 && (undo_index > 0 && undo_levels > 0)) - tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal'); - - // Select class in select box - var selectElm = document.getElementById(editor_id + "_styleSelect"); - - if (selectElm) { - TinyMCE_AdvancedTheme._setupCSSClasses(editor_id); - - classNode = node; - breakOut = false; - var index = 0; - - do { - if (classNode && classNode.className) { - for (var i=0; i"); + if (DOM.get(s.theme_advanced_toolbar_container)) + DOM.get(s.theme_advanced_toolbar_container).appendChild(p); else - selectByValue(selectElm, ""); - } + DOM.insertAfter(p, n); - // Select fontselect - var selectElm = document.getElementById(editor_id + "_fontNameSelect"); - if (selectElm) { - if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) { - var face = inst.queryCommandValue('FontName'); + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; - face = face == null || face == "" ? "" : face; + if (e.nodeName == 'A') { + t._sel(e.href.replace(/^[^#]*#/, '')); - selectByValue(selectElm, face, face != ""); - } else { - var elm = tinyMCE.getParentElement(node, "font", "face"); + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; - if (elm) { - var family = tinyMCE.getAttrib(elm, "face"); + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); - if (family == '') - family = '' + elm.style.fontFamily; - - if (!selectByValue(selectElm, family, family != "")) - selectByValue(selectElm, ""); - } else - selectByValue(selectElm, ""); + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); } - } +*/ + if (s.theme_advanced_toolbar_location == 'external') + o.deltaHeight = 0; - // Select fontsize - var selectElm = document.getElementById(editor_id + "_fontSizeSelect"); - if (selectElm) { - if (!tinyMCE.isSafari && !tinyMCE.isOpera) { - var size = inst.queryCommandValue('FontSize'); - selectByValue(selectElm, size == null || size == "" ? "0" : size); - } else { - var elm = tinyMCE.getParentElement(node, "font", "size"); - if (elm) { - var size = tinyMCE.getAttrib(elm, "size"); + t.deltaHeight = o.deltaHeight; + o.targetNode = null; - if (size == '') { - var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px'); + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, - size = '' + elm.style.fontSize; + getInfo : function() { + return { + longname : 'Simple theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, - for (var i=0; i')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_advanced_buttons' + i + '_add']) + v += ',' + s['theme_advanced_buttons' + i + '_add']; + + if (s['theme_advanced_buttons' + i + '_add_before']) + v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb, di); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_advanced_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_advanced_resizing && !tinymce.isOldWebKit) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'resize'}); + + if (s.theme_advanced_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_advanced_resize_horizontal) + c.style.width = o.cw + 'px'; + + c.style.height = o.ch + 'px'; + DOM.get(ed.id + '_ifr').style.height = (parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_advanced_resizing_min_width || 100; + mih = s.theme_advanced_resizing_min_height || 100; + maw = s.theme_advanced_resizing_max_width || 0xFFFF; + mah = s.theme_advanced_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(document, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_advanced_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(document, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(document, 'mousemove', mf); + Event.remove(document, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_advanced_resize_horizontal) + c.style.width = (r.w + r.dx) + 'px'; + + c.style.height = (r.h + r.dy) + 'px'; + ifr.style.height = (ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_advanced_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) + c.select(ed.queryCommandValue('FontSize')); + + if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; } } - if (!selectByValue(selectElm, size)) - selectByValue(selectElm, ""); - } else - selectByValue(selectElm, "0"); + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "#" + (de++) + "", onmousedown : "return false;", title : ti}, na); + + if (p.hasChildNodes()) { + p.insertBefore(document.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); } - } + }, - // Handle align attributes - alignNode = node; - breakOut = false; - do { - if (!alignNode.getAttribute || !alignNode.getAttribute('align')) - continue; + // Commands gets called by execCommand - switch (alignNode.getAttribute('align').toLowerCase()) { - case "left": - tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected'); - breakOut = true; - break; + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, - case "right": - tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected'); - breakOut = true; - break; + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; - case "middle": - case "center": - tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected'); - breakOut = true; - break; + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/anchor.htm', + width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, - case "justify": - tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected'); - breakOut = true; - break; - } - } while (!breakOut && (alignNode = alignNode.parentNode) != null); + _mceCharMap : function() { + var ed = this.editor; - // Div justification - var div = tinyMCE.getParentElement(node, "div"); - if (div && div.style.textAlign == "center") - tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected'); + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/charmap.htm', + width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, - // Do special text - if (!setup_content) { - // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub" - var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub"); - for (var i=0; i 0) - selectElm.setAttribute('cssImported', 'true'); - } - }, - - _setCookie : function(name, value, expires, path, domain, secure) { - var curCookie = name + "=" + escape(value) + - ((expires) ? "; expires=" + expires.toGMTString() : "") + - ((path) ? "; path=" + escape(path) : "") + - ((domain) ? "; domain=" + domain : "") + - ((secure) ? "; secure" : ""); - - document.cookie = curCookie; - }, - - _getCookie : function(name) { - var dc = document.cookie; - var prefix = name + "="; - var begin = dc.indexOf("; " + prefix); - - if (begin == -1) { - begin = dc.indexOf(prefix); - - if (begin != 0) - return null; - } else - begin += 2; - - var end = document.cookie.indexOf(";", begin); - - if (end == -1) - end = dc.length; - - return unescape(dc.substring(begin + prefix.length, end)); - }, - - _resizeTo : function(inst, w, h, set_w) { - var editorContainer = document.getElementById(inst.editorId + '_parent'); - var tableElm = editorContainer.firstChild; - var iframe = inst.iframeElement; - - if (w == null || w == "null") { - set_w = false; - w = 0; - } - - if (h == null || h == "null") - return; - - w = parseInt(w); - h = parseInt(h); - - if (tinyMCE.isGecko) { - w += 2; - h += 2; - } - - var dx = w - tableElm.clientWidth; - var dy = h - tableElm.clientHeight; - - w = w < 1 ? 30 : w; - h = h < 1 ? 30 : h; - - if (set_w) - tableElm.style.width = w + "px"; - - if ( !tinyMCE.isMSIE || tinyMCE.isMSIE7 || tinyMCE.isOpera ) // WordPress: do this later to avoid creeping toolbar bug in MSIE6 - tableElm.style.height = h + "px"; - - iw = iframe.clientWidth + dx; - ih = iframe.clientHeight + dy; - - iw = iw < 1 ? 30 : iw; - ih = ih < 1 ? 30 : ih; -/* WordPress: found that this led to a shrinking editor with every resize. - (Gray background creeps in 1px at a time.) - if (tinyMCE.isGecko) { - iw -= 2; - ih -= 2; - } -*/ - - if (set_w) - iframe.style.width = iw + "px"; - - iframe.style.height = ih + "px"; - - // Is it to small, make it bigger again - if (set_w) { - var tableBodyElm = tableElm.firstChild; - var minIframeWidth = tableBodyElm.scrollWidth; - if (inst.iframeElement.clientWidth < minIframeWidth) { - dx = minIframeWidth - inst.iframeElement.clientWidth; - - inst.iframeElement.style.width = (iw + dx) + "px"; - } - } - - tableElm.style.height = h + "px"; // WordPress: see above - - // Remove pesky table controls - inst.useCSS = false; - }, - - /** - * Handles resizing events. - */ - _resizeEventHandler : function(e) { - var resizer = TinyMCE_AdvancedTheme._resizer; - - // Do nothing - if (!resizer.resizing) - return; - - e = typeof(e) == "undefined" ? window.event : e; - - var dx = e.screenX - resizer.downX; - var dy = e.screenY - resizer.downY; - var resizeBox = resizer.resizeBox; - var editorId = resizer.editorId; - - switch (e.type) { - case "mousemove": - var w, h; - - w = resizer.width + dx; - h = resizer.height + dy; - - w = w < 1 ? 1 : w; - h = h < 1 ? 1 : h; - - if (resizer.horizontal) - resizeBox.style.width = w + "px"; - - resizeBox.style.height = h + "px"; - break; - - case "mouseup": - TinyMCE_AdvancedTheme._setResizing(e, editorId, false); - TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal); - - // Expire in a month - if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) { - var expires = new Date(); - expires.setTime(expires.getTime() + 3600000 * 24 * 30); - - // Set the cookies - TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires); - TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires); + this._mceColorPicker(0, { + func : function(co) { + t.editor.execCommand('HiliteColor', false, co); } - break; + }); } - }, + }); - /** - * Starts/stops the editor resizing. - */ - _setResizing : function(e, editor_id, state) { - e = typeof(e) == "undefined" ? window.event : e; - - var resizer = TinyMCE_AdvancedTheme._resizer; - var editorContainer = document.getElementById(editor_id + '_parent'); - var editorArea = document.getElementById(editor_id + '_parent').firstChild; - var resizeBox = document.getElementById(editor_id + '_resize_box'); - var inst = tinyMCE.getInstanceById(editor_id); - - if (state) { - // Place box over editor area - var width = editorArea.clientWidth; - var height = editorArea.clientHeight; - - resizeBox.style.width = width + "px"; - resizeBox.style.height = height + "px"; - - resizer.iframeWidth = inst.iframeElement.clientWidth; - resizer.iframeHeight = inst.iframeElement.clientHeight; - - // Hide editor and show resize box - editorArea.style.display = "none"; - resizeBox.style.display = "block"; - - // Add event handlers, only once - if (!resizer.eventHandlers) { - if (tinyMCE.isMSIE) - tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler); - else - tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler); - - tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler); - - resizer.eventHandlers = true; - } - - resizer.resizing = true; - resizer.downX = e.screenX; - resizer.downY = e.screenY; - resizer.width = parseInt(resizeBox.style.width); - resizer.height = parseInt(resizeBox.style.height); - resizer.editorId = editor_id; - resizer.resizeBox = resizeBox; - resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true); - } else { - resizer.resizing = false; - resizeBox.style.display = "none"; - editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table"; - tinyMCE.execCommand('mceResetDesignMode'); - } - }, - - _getColorHTML : function(id, n, cm) { - var i, h, cl; - - h = ''; - cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(','); - - h += ''; - for (i=0; i'; - - if ((i+1) % 8 == 0) - h += ''; - } - - h += '
    '; - - if (tinyMCE.getParam("theme_advanced_more_colors", true)) - h += '' + tinyMCE.getLang('lang_more_colors') + ''; - - return h; - }, - - _pickColor : function(id, cm) { - var inputColor, inst = tinyMCE.selectedInstance; - - if (cm == 'forecolor' && inst) - inputColor = inst.foreColor; - - if ((cm == 'backcolor' || cm == 'HiliteColor') && inst) - inputColor = inst.backColor; - - tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) { - tinyMCE.execInstanceCommand(id, cm, false, c); - }}); - }, - - _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { - tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', { - src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute - mce_src : src, - alt : alt, - border : border, - hspace : hspace, - vspace : vspace, - width : width, - height : height, - align : align, - title : title, - onmouseover : onmouseover, - onmouseout : onmouseout - })); - }, - - _insertLink : function(href, target, title, onclick, style_class) { - tinyMCE.execCommand('mceBeginUndoLevel'); - - if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") { - var doc = tinyMCE.selectedInstance.getDoc(); - var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a"); - var newLink = false; - - if (!linkElement) { - linkElement = doc.createElement("a"); - newLink = true; - } - - var mhref = href; - var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);"); - mhref = tinyMCE.getParam('convert_urls') ? href : mhref; - - tinyMCE.setAttrib(linkElement, 'href', thref); - tinyMCE.setAttrib(linkElement, 'mce_href', mhref); - tinyMCE.setAttrib(linkElement, 'target', target); - tinyMCE.setAttrib(linkElement, 'title', title); - tinyMCE.setAttrib(linkElement, 'onclick', onclick); - tinyMCE.setAttrib(linkElement, 'class', style_class); - - if (newLink) { - linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true)); - tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement); - } - - return; - } - - if (!tinyMCE.linkElement && tinyMCE.selectedInstance) { - if (tinyMCE.isSafari) { - tinyMCE.execCommand("mceInsertContent", false, '' + tinyMCE.selectedInstance.selection.getSelectedHTML() + ''); - } else - tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL); - - tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL); - - var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL); - - for (var i=0; i - {$lang_insert_image_title} - - - - + {#advanced_dlg.image_title} + + + + - - -
    + + @@ -20,81 +20,65 @@
    - + - - - + + + + - + - - + - + - - + + - - + + - - + +
    - +
     
    x
    -
    - +
    - +
    diff --git a/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg b/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg new file mode 100644 index 0000000000..b4c542d107 Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg differ diff --git a/wp-includes/js/tinymce/themes/advanced/img/icons.gif b/wp-includes/js/tinymce/themes/advanced/img/icons.gif new file mode 100644 index 0000000000..687082782a Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/img/icons.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/js/about.js b/wp-includes/js/tinymce/themes/advanced/js/about.js new file mode 100644 index 0000000000..31325e27e5 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/about.js @@ -0,0 +1,76 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout('insertHelpIFrame();', 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += ''; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += ''; + html += '
    ' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
    ' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
    '; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = ''; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); + +// For modal dialogs in IE +if (tinymce.isIE) + document.write(''); diff --git a/wp-includes/js/tinymce/themes/advanced/js/anchor.js b/wp-includes/js/tinymce/themes/advanced/js/anchor.js new file mode 100644 index 0000000000..f1d01eaf27 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/anchor.js @@ -0,0 +1,33 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) + f.anchorName.value = v; + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/wp-includes/js/tinymce/themes/advanced/js/charmap.js b/wp-includes/js/tinymce/themes/advanced/js/charmap.js new file mode 100644 index 0000000000..12c0084cfb --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/charmap.js @@ -0,0 +1,327 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmap', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = ''; + var cols=-1; + + for (i=0; i' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + + html += '
    '; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/wp-includes/js/tinymce/themes/advanced/js/color_picker.js b/wp-includes/js/tinymce/themes/advanced/js/color_picker.js new file mode 100644 index 0000000000..148d7f5f6d --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/color_picker.js @@ -0,0 +1,245 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = new Array( + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +); + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '
    '; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '' + + ''; + + for (i=0; i' + + '' + + ''; + if ((i+1) % 18 == 0) + h += ''; + } + + h += '
    '; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + if (f.src.value === '') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, ''); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/wp-includes/js/tinymce/themes/advanced/js/link.js b/wp-includes/js/tinymce/themes/advanced/js/link.js new file mode 100644 index 0000000000..712ebd3d77 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/link.js @@ -0,0 +1,124 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + // Remove element if there is no href + if (!f.href.value) { + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + ed.execCommand('mceInsertLink', false, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + html += ''; + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/wp-includes/js/tinymce/themes/advanced/js/source_editor.js b/wp-includes/js/tinymce/themes/advanced/js/source_editor.js new file mode 100644 index 0000000000..a6235a3815 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent(); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/wp-includes/js/tinymce/themes/advanced/langs/en.js b/wp-includes/js/tinymce/themes/advanced/langs/en.js index 62e0053f17..52989e3936 100644 --- a/wp-includes/js/tinymce/themes/advanced/langs/en.js +++ b/wp-includes/js/tinymce/themes/advanced/langs/en.js @@ -1,93 +1,62 @@ -// UK lang variables - -tinyMCE.addToLang('',{ -theme_style_select : '-- Styles --', -theme_code_desc : 'Edit HTML Source', -theme_code_title : 'HTML Source Editor', -theme_code_wordwrap : 'Word wrap', -theme_sub_desc : 'Subscript', -theme_sup_desc : 'Superscript', -theme_hr_desc : 'Insert horizontal ruler', -theme_removeformat_desc : 'Remove formatting', -theme_custom1_desc : 'Your custom description here', -insert_image_border : 'Border', -insert_image_dimensions : 'Dimensions', -insert_image_vspace : 'Vertical space', -insert_image_hspace : 'Horizontal space', -insert_image_align : 'Alignment', -insert_image_align_default : '-- Not set --', -insert_image_align_baseline : 'Baseline', -insert_image_align_top : 'Top', -insert_image_align_middle : 'Middle', -insert_image_align_bottom : 'Bottom', -insert_image_align_texttop : 'TextTop', -insert_image_align_absmiddle : 'Absolute Middle', -insert_image_align_absbottom : 'Absolute Bottom', -insert_image_align_left : 'Left', -insert_image_align_right : 'Right', -theme_font_size : '-- Font size --', -theme_fontdefault : '-- Font family --', -theme_block : '-- Format --', -theme_paragraph : 'Paragraph', -theme_div : 'Div', -theme_address : 'Address', -theme_pre : 'Preformatted', -theme_h1 : 'Heading 1', -theme_h2 : 'Heading 2', -theme_h3 : 'Heading 3', -theme_h4 : 'Heading 4', -theme_h5 : 'Heading 5', -theme_h6 : 'Heading 6', -theme_blockquote : 'Blockquote', -theme_code : 'Code', -theme_samp : 'Code sample', -theme_dt : 'Definition term ', -theme_dd : 'Definition description', -theme_colorpicker_title : 'Select a color', -theme_colorpicker_apply : 'Apply', -theme_forecolor_desc : 'Select text color', -theme_backcolor_desc : 'Select background color', -theme_charmap_title : 'Select custom character', -theme_charmap_desc : 'Insert custom character', -theme_visualaid_desc : 'Toggle guidelines/invisible elements', -insert_anchor_title : 'Insert/edit anchor', -insert_anchor_name : 'Anchor name', -theme_anchor_desc : 'Insert/edit anchor', -theme_insert_link_titlefield : 'Title', -theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?', -theme_path : 'Path', -cut_desc : 'Cut', -copy_desc : 'Copy', -paste_desc : 'Paste', -link_list : 'Link list', -image_list : 'Image list', -browse : 'Browse', -image_props_desc : 'Image properties', -newdocument_desc : 'New document', -class_name : 'Class', -newdocument : 'Are you sure you want clear all contents?', -about_title : 'About TinyMCE', -about : 'About', -license : 'License', -plugins : 'Plugins', -plugin : 'Plugin', -author : 'Author', -version : 'Version', -loaded_plugins : 'Loaded plugins', -help : 'Help', -not_set : '-- Not set --', -close : 'Close', -toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X', -invalid_data : 'Error: Invalid values entered, these are marked in red.', -more_colors : 'More colors', -color_picker_tab : 'Picker', -color_picker : 'Color picker', -web_colors_tab : 'Palette', -web_colors : 'Palette colors', -named_colors_tab : 'Named', -named_colors : 'Named colors', -color : 'Color:', -color_name : 'Name:', -is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?', -is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?' -}); +tinyMCE.addI18n('en.advanced',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/langs/en_dlg.js b/wp-includes/js/tinymce/themes/advanced/langs/en_dlg.js new file mode 100644 index 0000000000..80e49419c6 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.advanced_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/link.htm b/wp-includes/js/tinymce/themes/advanced/link.htm index 54220b7db3..308c3ba1d5 100644 --- a/wp-includes/js/tinymce/themes/advanced/link.htm +++ b/wp-includes/js/tinymce/themes/advanced/link.htm @@ -1,19 +1,19 @@ + - {$lang_insert_link_title} - - - - - + {#advanced_dlg.link_title} + + + + + - - -
    + + @@ -22,80 +22,41 @@ - + - - - + + + + + + + + - - - - - - - - - - + + + + + +
    - +
     
    -
    -
    - +
    - +
    diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/content.css b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css new file mode 100644 index 0000000000..ae43854386 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css @@ -0,0 +1,18 @@ +body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +body {background:#FFF;} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;} +img {border:0;} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css new file mode 100644 index 0000000000..ed1510029c --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css @@ -0,0 +1,111 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(img/buttons.png) 0 -52px;} +#cancel {background:url(img/buttons.png) 0 0;} + +/* Browse */ +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border-style:solid; border-width:1px; border-color:#AAA;} +td.charmap, td.charmapOver {color:#000; border-color:#AAA; border-style:solid; border-width:1px; text-align:center; font-size:12px;} +td.charmapOver {background:#CCC; cursor:default;} +a.charmap {color:#000; text-decoration:none} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:18px;} +.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png b/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png new file mode 100644 index 0000000000..7dd58418ba Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif new file mode 100644 index 0000000000..2eafd7954e Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000000..85e31dfb2d Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif new file mode 100644 index 0000000000..adfdddccd7 Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif new file mode 100644 index 0000000000..5bb90fd6a4 Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif b/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif new file mode 100644 index 0000000000..ce4be63558 Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css new file mode 100644 index 0000000000..9af795458c --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css @@ -0,0 +1,193 @@ +/* Reset */ +.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline} +.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.defaultSkin table td {vertical-align:middle} + +/* Containers */ +.defaultSkin table {background:#F0F0EE} +.defaultSkin iframe {display:block; background:#FFF} +.defaultSkin .mceToolbar {height:26px} +.defaultSkin .left {text-align:left} +.defaultSkin .right {text-align:right} + +/* External */ +.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;} +.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC} +.defaultSkin table.mceLayout tr.first td {border-top:1px solid #CCC} +.defaultSkin table.mceLayout tr.last td {border-bottom:1px solid #CCC} +.defaultSkin table.mceToolbar, .defaultSkin tr.first .mceToolbar tr td, .defaultSkin tr.last .mceToolbar tr td {border:0; margin:0; padding:0;} +.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top} +.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} +.defaultSkin .mceStatusbar {position:relative; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; padding:2px; color:#000; display:block} +.defaultSkin .mceStatusbar a.resize {display:block; position:absolute; top:0; right:0; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px} +.defaultSkin .mceStatusbar a:hover {text-decoration:underline} +.defaultSkin table.mceToolbar {margin-left:3px} +.defaultSkin span.icon, .defaultSkin img.icon {display:block; width:20px; height:20px} +.defaultSkin .icon {background:url(../../img/icons.gif) no-repeat 20px 20px} + +/* Button */ +.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px;} +.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} +.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceButtonDisabled .icon {opacity:0.3; filter:alpha(opacity=30)} + +/* Separator */ +.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px} + +/* ListBox */ +.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block} +.defaultSkin .mceListBox .text {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.defaultSkin .mceListBox .open {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;} +.defaultSkin table.mceListBoxEnabled:hover .text, .defaultSkin .mceListBoxHover .text, .defaultSkin .mceListBoxSelected .text {border:1px solid #A2ABC0; border-right:0; background:#FFF} +.defaultSkin table.mceListBoxEnabled:hover .open, .defaultSkin .mceListBoxHover .open, .defaultSkin .mceListBoxSelected .open {background-color:#FFF; border:1px solid #A2ABC0} +.defaultSkin .mceListBoxDisabled a.text {color:gray; background-color:transparent;} +.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.defaultSkin .mceOldBoxModel .mceListBox .text {height:22px} +.defaultSkin .mceOldBoxModel .mceListBox .open {width:11px; height:22px;} +.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;} + +/* SplitButton */ +.defaultSkin .mceSplitButton {width:32px; height:20px} +.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block} +.defaultSkin .mceSplitButton a.action {width:20px; border:1px solid #F0F0EE; border-right:0;} +.defaultSkin .mceSplitButton span.action {width:20px; background:url(../../img/icons.gif) 20px 20px;} +.defaultSkin .mceSplitButton a.open {width:9px; border:1px solid #F0F0EE;} +.defaultSkin .mceSplitButton span.open {width:9px; background:url(../../img/icons.gif) -741px 0;} +.defaultSkin table.mceSplitButtonEnabled:hover a.action, .defaultSkin .mceSplitButtonHover a.action, .defaultSkin .mceSplitButtonSelected a.action {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0} +.defaultSkin table.mceSplitButtonEnabled:hover a.open, .defaultSkin .mceSplitButtonHover a.open, .defaultSkin .mceSplitButtonSelected a.open {border:1px solid #0A246A;} +.defaultSkin table.mceSplitButtonEnabled:hover span.open, .defaultSkin .mceSplitButtonHover span.open, .defaultSkin .mceSplitButtonSelected span.open {background-color:#B2BBD0} +.defaultSkin .mceSplitButtonDisabled .action, .defaultSkin .mceSplitButtonDisabled span.open {opacity:0.3; filter:alpha(opacity=30)} +.defaultSkin .mceSplitButtonActive a.action {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceSplitButtonActive a.open {border-left:0;} + +/* ColorSplitButton */ +.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.defaultSkin .mceColorSplitMenu td {padding:2px} +.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.defaultSkin .mceColorSplitMenu td.morecolors {padding:1px 3px 1px 1px} +.defaultSkin .mceColorSplitMenu a.morecolors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.defaultSkin .mceColorSplitMenu a.morecolors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} +.defaultSkin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden} + +/* Menu */ +.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} +.defaultSkin .noIcons span.icon {width:0;} +.defaultSkin .noIcons a .text {padding-left:10px} +.defaultSkin .mceMenu table {background:#FFF} +.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block} +.defaultSkin .mceMenu td {height:20px} +.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0} +.defaultSkin .mceMenu .text {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.defaultSkin .mceMenu span.text, .defaultSkin .mceMenu .preview {font-size:11px} +.defaultSkin .mceMenu pre.text {font-family:Monospace} +.defaultSkin .mceMenu .icon {position:absolute; top:0; left:0; width:22px;} +.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px} +.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD} +.defaultSkin .mceMenuItemTitle span.text {color:#000; font-weight:bold; padding-left:4px} +.defaultSkin .mceMenuItemDisabled .text {color:#888} +.defaultSkin .mceMenuItemSelected .icon {background:url(img/menu_check.gif)} +.defaultSkin .noIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center} +.defaultSkin .mceMenu span.mceMenuLine {display:none} +.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF} +.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.defaultSkin .mcePlaceHolder {border:1px dotted gray} + +/* Theme */ +.defaultSkin span.bold {background-position:0 0} +.defaultSkin span.italic {background-position:-60px 0} +.defaultSkin span.underline {background-position:-140px 0} +.defaultSkin span.strikethrough {background-position:-120px 0} +.defaultSkin span.undo {background-position:-160px 0} +.defaultSkin span.redo {background-position:-100px 0} +.defaultSkin span.cleanup {background-position:-40px 0} +.defaultSkin span.bullist {background-position:-20px 0} +.defaultSkin span.numlist {background-position:-80px 0} +.defaultSkin span.justifyleft {background-position:-460px 0} +.defaultSkin span.justifyright {background-position:-480px 0} +.defaultSkin span.justifycenter {background-position:-420px 0} +.defaultSkin span.justifyfull {background-position:-440px 0} +.defaultSkin span.anchor {background-position:-200px 0} +.defaultSkin span.indent {background-position:-400px 0} +.defaultSkin span.outdent {background-position:-540px 0} +.defaultSkin span.link {background-position:-500px 0} +.defaultSkin span.unlink {background-position:-640px 0} +.defaultSkin span.sub {background-position:-600px 0} +.defaultSkin span.sup {background-position:-620px 0} +.defaultSkin span.removeformat {background-position:-580px 0} +.defaultSkin span.newdocument {background-position:-520px 0} +.defaultSkin span.image {background-position:-380px 0} +.defaultSkin span.help {background-position:-340px 0} +.defaultSkin span.code {background-position:-260px 0} +.defaultSkin span.hr {background-position:-360px 0} +.defaultSkin span.visualaid {background-position:-660px 0} +.defaultSkin span.charmap {background-position:-240px 0} +.defaultSkin span.paste {background-position:-560px 0} +.defaultSkin span.copy {background-position:-700px 0} +.defaultSkin span.cut {background-position:-680px 0} +.defaultSkin span.blockquote {background-position:-220px 0} +.defaultSkin .forecolor span.action {background-position:-720px 0} +.defaultSkin .backcolor span.action {background-position:-760px 0} +.defaultSkin .forecolorpicker {background-position:-720px 0} +.defaultSkin .backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.defaultSkin span.advhr {background-position:-0px -20px} +.defaultSkin span.ltr {background-position:-20px -20px} +.defaultSkin span.rtl {background-position:-40px -20px} +.defaultSkin span.emotions {background-position:-60px -20px} +.defaultSkin span.fullpage {background-position:-80px -20px} +.defaultSkin span.fullscreen {background-position:-100px -20px} +.defaultSkin span.iespell {background-position:-120px -20px} +.defaultSkin span.insertdate {background-position:-140px -20px} +.defaultSkin span.inserttime {background-position:-160px -20px} +.defaultSkin span.absolute {background-position:-180px -20px} +.defaultSkin span.backward {background-position:-200px -20px} +.defaultSkin span.forward {background-position:-220px -20px} +.defaultSkin span.insert_layer {background-position:-240px -20px} +.defaultSkin span.insertlayer {background-position:-260px -20px} +.defaultSkin span.movebackward {background-position:-280px -20px} +.defaultSkin span.moveforward {background-position:-300px -20px} +.defaultSkin span.media {background-position:-320px -20px} +.defaultSkin span.nonbreaking {background-position:-340px -20px} +.defaultSkin span.pastetext {background-position:-360px -20px} +.defaultSkin span.pasteword {background-position:-380px -20px} +.defaultSkin span.selectall {background-position:-400px -20px} +.defaultSkin span.preview {background-position:-420px -20px} +.defaultSkin span.print {background-position:-440px -20px} +.defaultSkin span.cancel {background-position:-460px -20px} +.defaultSkin span.save {background-position:-480px -20px} +.defaultSkin span.replace {background-position:-500px -20px} +.defaultSkin span.search {background-position:-520px -20px} +.defaultSkin span.styleprops {background-position:-560px -20px} +.defaultSkin span.table {background-position:-580px -20px} +.defaultSkin span.cell_props {background-position:-600px -20px} +.defaultSkin span.delete_table {background-position:-620px -20px} +.defaultSkin span.delete_col {background-position:-640px -20px} +.defaultSkin span.delete_row {background-position:-660px -20px} +.defaultSkin span.col_after {background-position:-680px -20px} +.defaultSkin span.col_before {background-position:-700px -20px} +.defaultSkin span.row_after {background-position:-720px -20px} +.defaultSkin span.row_before {background-position:-740px -20px} +.defaultSkin span.merge_cells {background-position:-760px -20px} +.defaultSkin span.table_props {background-position:-980px -20px} +.defaultSkin span.row_props {background-position:-780px -20px} +.defaultSkin span.split_cells {background-position:-800px -20px} +.defaultSkin span.template {background-position:-820px -20px} +.defaultSkin span.visualchars {background-position:-840px -20px} +.defaultSkin span.abbr {background-position:-860px -20px} +.defaultSkin span.acronym {background-position:-880px -20px} +.defaultSkin span.attribs {background-position:-900px -20px} +.defaultSkin span.cite {background-position:-920px -20px} +.defaultSkin span.del {background-position:-940px -20px} +.defaultSkin span.ins {background-position:-960px -20px} +.defaultSkin span.pagebreak {background-position:0 -40px} +.defaultSkin .spellchecker span.action {background-position:-540px -20px} diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css new file mode 100644 index 0000000000..0704ea1e4c --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css @@ -0,0 +1,18 @@ +body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +body {background:#FFF;} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;} +img {border:0;} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css new file mode 100644 index 0000000000..52ab0c1fbc --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css @@ -0,0 +1,111 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDDDDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(../default/img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +} + +#insert {background:url(../default/img/buttons.png) 0 -52px;} +#cancel {background:url(../default/img/buttons.png) 0 0;} + +/* Browse */ +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border-style:solid; border-width:1px; border-color:#AAA;} +td.charmap, td.charmapOver {color:#000; border-color:#AAA; border-style:solid; border-width:1px; text-align:center; font-size:12px;} +td.charmapOver {background:#CCC; cursor:default;} +a.charmap {color:#000; text-decoration:none} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:18px;} +.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png new file mode 100644 index 0000000000..12cfb419bb Binary files /dev/null and b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png differ diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css new file mode 100644 index 0000000000..27efc25984 --- /dev/null +++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css @@ -0,0 +1,193 @@ +/* Reset */ +.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline} +.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.o2k7Skin table td {vertical-align:middle} + +/* Containers */ +.o2k7Skin table {background:#E5EFFD} +.o2k7Skin iframe {display:block; background:#FFF} +.o2k7Skin .mceToolbar {height:26px} + +/* External */ +.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none} +.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.first td {border-top:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.last td {border-bottom:1px solid #ABC6DD} +.o2k7Skin table.mceToolbar, .o2k7Skin tr.first .mceToolbar tr td, .o2k7Skin tr.last .mceToolbar tr td {border:0; margin:0; padding:0} +.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px;} +.o2k7Skin .mceStatusbar div {float:left; padding:2px;} +.o2k7Skin .mceStatusbar a.resize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px} +.o2k7Skin .mceStatusbar a:hover {text-decoration:underline} +.o2k7Skin table.mceToolbar {margin-left:3px} +.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; } +.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} +.o2k7Skin .mceToolbar .mceToolbarEndListBox span {display:none} +.o2k7Skin span.icon, .o2k7Skin img.icon {display:block; width:20px; height:20px} +.o2k7Skin .icon {background:url(../../img/icons.gif) no-repeat 20px 20px} + +/* Button */ +.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} +.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px} +.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} +.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} +.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px} +.o2k7Skin .mceButtonDisabled .icon {opacity:0.3; filter:alpha(opacity=30)} + +/* Separator */ +.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} + +/* ListBox */ +.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block} +.o2k7Skin .mceListBox .text {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.o2k7Skin .mceListBox .open {width:14px; height:22px; background:url(img/button_bg.png) -66px 0; margin-right:2px} +.o2k7Skin table.mceListBoxEnabled:hover .text, .o2k7Skin .mceListBoxHover .text, .o2k7Skin .mceListBoxSelected .text {background:#FFF} +.o2k7Skin table.mceListBoxEnabled:hover .open, .o2k7Skin .mceListBoxHover .open, .o2k7Skin .mceListBoxSelected .open {background-position:-66px -22px} +.o2k7Skin .mceListBoxDisabled .text {color:gray} +.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.o2k7Skin .mceOldBoxModel .mceListBox .text {height:22px} +.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;} + +/* SplitButton */ +.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px} +.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)} +.o2k7Skin .mceSplitButton a.action {width:22px} +.o2k7Skin .mceSplitButton span.action {width:22px; background:url(../../img/icons.gif) 20px 20px} +.o2k7Skin .mceSplitButton a.open {width:10px} +.o2k7Skin .mceSplitButton span.open {width:10px; background:url(img/button_bg.png) -44px 0} +.o2k7Skin table.mceSplitButtonEnabled:hover a.action, .o2k7Skin .mceSplitButtonHover a.action, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px} +.o2k7Skin table.mceSplitButtonEnabled:hover span.open, .o2k7Skin .mceSplitButtonHover span.open, .o2k7Skin .mceSplitButtonSelected span.open {background-position:-44px -44px} +.o2k7Skin .mceSplitButtonDisabled .action {opacity:0.3; filter:alpha(opacity=30)} +.o2k7Skin .mceSplitButtonActive {background-position:0 -44px} + +/* ColorSplitButton */ +.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.o2k7Skin .mceColorSplitMenu td {padding:2px} +.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.o2k7Skin .mceColorSplitMenu td.morecolors {padding:1px 3px 1px 1px} +.o2k7Skin .mceColorSplitMenu a.morecolors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.o2k7Skin .mceColorSplitMenu a.morecolors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} +.o2k7Skin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden} + +/* Menu */ +.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} +.o2k7Skin .noIcons span.icon {width:0;} +.o2k7Skin .noIcons a .text {padding-left:10px} +.o2k7Skin .mceMenu table {background:#FFF} +.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block} +.o2k7Skin .mceMenu td {height:20px} +.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0} +.o2k7Skin .mceMenu .text {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.o2k7Skin .mceMenu span.text, .o2k7Skin .mceMenu .preview {font-size:11px} +.o2k7Skin .mceMenu pre.text {font-family:Monospace} +.o2k7Skin .mceMenu .icon {position:absolute; top:0; left:0; width:22px;} +.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px} +.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceMenuItemTitle span.text {color:#000; font-weight:bold; padding-left:4px} +.o2k7Skin .mceMenuItemDisabled .text {color:#888} +.o2k7Skin .mceMenuItemSelected .icon {background:url(../default/img/menu_check.gif)} +.o2k7Skin .noIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} +.o2k7Skin .mceMenu span.mceMenuLine {display:none} +.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF} +.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.o2k7Skin .mcePlaceHolder {border:1px dotted gray} + +/* Theme */ +.o2k7Skin span.bold {background-position:0 0} +.o2k7Skin span.italic {background-position:-60px 0} +.o2k7Skin span.underline {background-position:-140px 0} +.o2k7Skin span.strikethrough {background-position:-120px 0} +.o2k7Skin span.undo {background-position:-160px 0} +.o2k7Skin span.redo {background-position:-100px 0} +.o2k7Skin span.cleanup {background-position:-40px 0} +.o2k7Skin span.bullist {background-position:-20px 0} +.o2k7Skin span.numlist {background-position:-80px 0} +.o2k7Skin span.justifyleft {background-position:-460px 0} +.o2k7Skin span.justifyright {background-position:-480px 0} +.o2k7Skin span.justifycenter {background-position:-420px 0} +.o2k7Skin span.justifyfull {background-position:-440px 0} +.o2k7Skin span.anchor {background-position:-200px 0} +.o2k7Skin span.indent {background-position:-400px 0} +.o2k7Skin span.outdent {background-position:-540px 0} +.o2k7Skin span.link {background-position:-500px 0} +.o2k7Skin span.unlink {background-position:-640px 0} +.o2k7Skin span.sub {background-position:-600px 0} +.o2k7Skin span.sup {background-position:-620px 0} +.o2k7Skin span.removeformat {background-position:-580px 0} +.o2k7Skin span.newdocument {background-position:-520px 0} +.o2k7Skin span.image {background-position:-380px 0} +.o2k7Skin span.help {background-position:-340px 0} +.o2k7Skin span.code {background-position:-260px 0} +.o2k7Skin span.hr {background-position:-360px 0} +.o2k7Skin span.visualaid {background-position:-660px 0} +.o2k7Skin span.charmap {background-position:-240px 0} +.o2k7Skin span.paste {background-position:-560px 0} +.o2k7Skin span.copy {background-position:-700px 0} +.o2k7Skin span.cut {background-position:-680px 0} +.o2k7Skin span.blockquote {background-position:-220px 0} +.o2k7Skin .forecolor span.action {background-position:-720px 0} +.o2k7Skin .backcolor span.action {background-position:-760px 0} +.o2k7Skin .forecolorpicker {background-position:-720px 0} +.o2k7Skin .backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.o2k7Skin span.advhr {background-position:-0px -20px} +.o2k7Skin span.ltr {background-position:-20px -20px} +.o2k7Skin span.rtl {background-position:-40px -20px} +.o2k7Skin span.emotions {background-position:-60px -20px} +.o2k7Skin span.fullpage {background-position:-80px -20px} +.o2k7Skin span.fullscreen {background-position:-100px -20px} +.o2k7Skin span.iespell {background-position:-120px -20px} +.o2k7Skin span.insertdate {background-position:-140px -20px} +.o2k7Skin span.inserttime {background-position:-160px -20px} +.o2k7Skin span.absolute {background-position:-180px -20px} +.o2k7Skin span.backward {background-position:-200px -20px} +.o2k7Skin span.forward {background-position:-220px -20px} +.o2k7Skin span.insert_layer {background-position:-240px -20px} +.o2k7Skin span.insertlayer {background-position:-260px -20px} +.o2k7Skin span.movebackward {background-position:-280px -20px} +.o2k7Skin span.moveforward {background-position:-300px -20px} +.o2k7Skin span.media {background-position:-320px -20px} +.o2k7Skin span.nonbreaking {background-position:-340px -20px} +.o2k7Skin span.pastetext {background-position:-360px -20px} +.o2k7Skin span.pasteword {background-position:-380px -20px} +.o2k7Skin span.selectall {background-position:-400px -20px} +.o2k7Skin span.preview {background-position:-420px -20px} +.o2k7Skin span.print {background-position:-440px -20px} +.o2k7Skin span.cancel {background-position:-460px -20px} +.o2k7Skin span.save {background-position:-480px -20px} +.o2k7Skin span.replace {background-position:-500px -20px} +.o2k7Skin span.search {background-position:-520px -20px} +.o2k7Skin span.styleprops {background-position:-560px -20px} +.o2k7Skin span.table {background-position:-580px -20px} +.o2k7Skin span.cell_props {background-position:-600px -20px} +.o2k7Skin span.delete_table {background-position:-620px -20px} +.o2k7Skin span.delete_col {background-position:-640px -20px} +.o2k7Skin span.delete_row {background-position:-660px -20px} +.o2k7Skin span.col_after {background-position:-680px -20px} +.o2k7Skin span.col_before {background-position:-700px -20px} +.o2k7Skin span.row_after {background-position:-720px -20px} +.o2k7Skin span.row_before {background-position:-740px -20px} +.o2k7Skin span.merge_cells {background-position:-760px -20px} +.o2k7Skin span.table_props {background-position:-980px -20px} +.o2k7Skin span.row_props {background-position:-780px -20px} +.o2k7Skin span.split_cells {background-position:-800px -20px} +.o2k7Skin span.template {background-position:-820px -20px} +.o2k7Skin span.visualchars {background-position:-840px -20px} +.o2k7Skin span.abbr {background-position:-860px -20px} +.o2k7Skin span.acronym {background-position:-880px -20px} +.o2k7Skin span.attribs {background-position:-900px -20px} +.o2k7Skin span.cite {background-position:-920px -20px} +.o2k7Skin span.del {background-position:-940px -20px} +.o2k7Skin span.ins {background-position:-960px -20px} +.o2k7Skin span.pagebreak {background-position:0 -40px} +.o2k7Skin .spellchecker span.action {background-position:-540px -20px} diff --git a/wp-includes/js/tinymce/themes/advanced/source_editor.htm b/wp-includes/js/tinymce/themes/advanced/source_editor.htm index bb3a79b007..b86cea27ec 100644 --- a/wp-includes/js/tinymce/themes/advanced/source_editor.htm +++ b/wp-includes/js/tinymce/themes/advanced/source_editor.htm @@ -1,32 +1,30 @@ - {$lang_theme_code_title} - - + {#advanced_dlg.code_title} + + - - +
    -
    {$lang_theme_code_title}
    +
    {#advanced_dlg.code_title}
    - +

    - +
    -
    - +
    - +
    diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js index ab4aba7bf2..cb2f5fd17b 100644 --- a/wp-includes/js/tinymce/tiny_mce.js +++ b/wp-includes/js/tinymce/tiny_mce.js @@ -1,6383 +1,2587 @@ -/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */ - -function TinyMCE_Engine() { - var ua; - - this.majorVersion = "2"; - this.minorVersion = "1.1.1"; - this.releaseDate = "2007-05-14"; - - this.instances = []; - this.switchClassCache = []; - this.windowArgs = []; - this.loadedFiles = []; - this.pendingFiles = []; - this.loadingIndex = 0; - this.configs = []; - this.currentConfig = 0; - this.eventHandlers = []; - this.log = []; - this.undoLevels = []; - this.undoIndex = 0; - this.typingUndoIndex = -1; - this.settings = []; - - // Browser check - ua = navigator.userAgent; - this.isMSIE = (navigator.appName == "Microsoft Internet Explorer"); - this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1); - this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1); - this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1); - this.isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari - this.isSafari = ua.indexOf('Safari') != -1; - this.isOpera = window['opera'] && opera.buildNumber ? true : false; - this.isMac = ua.indexOf('Mac') != -1; - this.isNS7 = ua.indexOf('Netscape/7') != -1; - this.isNS71 = ua.indexOf('Netscape/7.1') != -1; - this.dialogCounter = 0; - this.plugins = []; - this.themes = []; - this.menus = []; - this.loadedPlugins = []; - this.buttonMap = []; - this.isLoaded = false; - - // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those - if (this.isOpera) { - this.isMSIE = true; - this.isGecko = false; - this.isSafari = false; - } - - this.isIE = this.isMSIE; - this.isRealIE = this.isMSIE && !this.isOpera; - - // TinyMCE editor id instance counter - this.idCounter = 0; -}; - -TinyMCE_Engine.prototype = { - init : function(settings) { - var theme, nl, baseHREF = "", i, cssPath, entities, h, p, src, elements = [], head; - - // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry. - if (this.isMSIE5_0) - return; - - this.settings = settings; - - // Check if valid browser has execcommand support - if (typeof(document.execCommand) == 'undefined') - return; - - // Get script base path - if (!tinyMCE.baseURL) { - // Search through head - head = document.getElementsByTagName('head')[0]; - - if (head) { - for (i=0, nl = head.getElementsByTagName('script'); i'); - this._def("font_size_classes", ''); - this._def("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large', true); - this._def("event_elements", 'a,img', true); - this._def("convert_urls", true); - this._def("table_inline_editing", false); - this._def("object_resizing", true); - this._def("custom_shortcuts", true); - this._def("convert_on_click", false); - this._def("content_css", ''); - this._def("fix_list_elements", true); - 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", ''); - this._def("gecko_spellcheck", false); - this._def("hide_selects_on_submit", true); - this._def("forced_root_block", false); - this._def("remove_trailing_nbsp", false); - - // 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) - return; - - // Browser check Gecko - if (this.isGecko && this.settings.browsers.indexOf('gecko') == -1) - return; - - // Browser check Safari - if (this.isSafari && this.settings.browsers.indexOf('safari') == -1) - return; - - // Browser check Opera - if (this.isOpera && this.settings.browsers.indexOf('opera') == -1) - return; - - // If not super absolute make it so - baseHREF = tinyMCE.settings.document_base_url; - h = document.location.href; - p = h.indexOf('://'); - if (p > 0 && document.location.protocol != "file:") { - p = h.indexOf('/', p + 3); - h = h.substring(0, p); - - if (baseHREF.indexOf('://') == -1) - baseHREF = h + baseHREF; - - tinyMCE.settings.document_base_url = baseHREF; - tinyMCE.settings.document_base_prefix = h; - } - - // Trim away query part - if (baseHREF.indexOf('?') != -1) - baseHREF = baseHREF.substring(0, baseHREF.indexOf('?')); - - this.settings.base_href = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; - - theme = this.settings.theme; - this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; - this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; - this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; - this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); - this.posKeyCodes = [13,45,36,35,33,34,37,38,39,40]; - this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL - this.uniqueTag = ''; - this.callbacks = ['onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance']; - - // Theme url - this.settings.theme_href = tinyMCE.baseURL + "/themes/" + theme; - - if (!tinyMCE.isIE || tinyMCE.isOpera) - this.settings.force_br_newlines = false; - - if (tinyMCE.getParam("popups_css", false)) { - cssPath = tinyMCE.getParam("popups_css", ""); - - // Is relative - if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings.popups_css = this.documentBasePath + "/" + cssPath; - else - this.settings.popups_css = cssPath; - } else - this.settings.popups_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css"; - - if (tinyMCE.getParam("editor_css", false)) { - cssPath = tinyMCE.getParam("editor_css", ""); - - // Is relative - if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings.editor_css = this.documentBasePath + "/" + cssPath; - else - this.settings.editor_css = cssPath; - } else { - if (this.settings.editor_css !== '') - this.settings.editor_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; - } - - // Only do this once - if (this.configs.length == 0) { - if (typeof(TinyMCECompressed) == "undefined") { - tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad); - - if (tinyMCE.isRealIE) { - if (document.body) - tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad); - else - tinyMCE.addEvent(document, "readystatechange", TinyMCE_Engine.prototype.onLoad); - } - - tinyMCE.addEvent(window, "load", TinyMCE_Engine.prototype.onLoad); - tinyMCE._addUnloadEvents(); - } - } - - this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings.theme + '/editor_template' + tinyMCE.srcMode + '.js'); - this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings.language + '.js'); - this.loadCSS(this.settings.editor_css); - - // Add plugins - p = tinyMCE.getParam('plugins', '', true, ','); - if (p.length > 0) { - for (i=0; i&"]', 'g'); - }, - - _addUnloadEvents : function() { - var st = tinyMCE.settings.add_unload_trigger; - - if (tinyMCE.isIE) { - if (st) { - tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler); - tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler); - } - } else { - if (st) - tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);}); - } - }, - - _def : function(key, def_val, t) { - var v = tinyMCE.getParam(key, def_val); - - v = t ? v.replace(/\s+/g, "") : v; - - this.settings[key] = v; - }, - - hasPlugin : function(n) { - return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null; - }, - - addPlugin : function(n, p) { - var op = this.plugins[n]; - - // 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) { - var op = this.plugins[n]; - - if (op) - op.baseURL = u; - else - this.plugins[n] = {baseURL : u}; - }, - - loadPlugin : function(n, u) { - u = u.indexOf('.js') != -1 ? u.substring(0, u.lastIndexOf('/')) : u; - u = u.charAt(u.length-1) == '/' ? u.substring(0, u.length-1) : u; - this.plugins[n] = {baseURL : u}; - this.loadScript(u + "/editor_plugin" + (tinyMCE.srcMode ? '_src' : '') + ".js"); - }, - - hasTheme : function(n) { - return typeof(this.themes[n]) != "undefined" && this.themes[n] != null; - }, - - addTheme : function(n, t) { - this.themes[n] = t; - - this.loadNextScript(); - }, - - addMenu : function(n, m) { - this.menus[n] = m; - }, - - hasMenu : function(n) { - return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null; - }, - - loadScript : function(url) { - var i; - - for (i=0; i'); - - 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, skip = false; - var x = 0, i = 0, nl, le; - - for (x = 0,csslen = ar.length; x 0) { - /* Make sure it doesn't exist. */ - for (i=0, lflen=this.loadedFiles.length; i'); - - this.loadedFiles[this.loadedFiles.length] = ar[x]; - } - } - } - }, - - importCSS : function(doc, css) { - var css_ary = css.replace(/\s+/, '').split(','); - var csslen, elm, headArr, x, css_file; - - for (x = 0, csslen = css_ary.length; x 0) { - // Is relative, make absolute - if (css_file.indexOf('://') == -1 && css_file.charAt(0) != '/') - css_file = this.documentBasePath + "/" + css_file; - - if (typeof(doc.createStyleSheet) == "undefined") { - elm = doc.createElement("link"); - - elm.rel = "stylesheet"; - elm.href = css_file; - - if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0) - headArr[0].appendChild(elm); - } else - doc.createStyleSheet(css_file); - } - } - }, - - confirmAdd : function(e, settings) { - var elm = tinyMCE.isIE ? event.srcElement : e.target; - var elementId = elm.name ? elm.name : elm.id; - - tinyMCE.settings = settings; - - if (tinyMCE.settings.convert_on_click || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang.lang_edit_confirm))) - tinyMCE.addMCEControl(elm, elementId); - - elm.setAttribute('mce_noask', 'true'); - }, - - updateContent : function(form_element_name) { - var formElement, n, inst, doc; - - // Find MCE instance linked to given form element and copy it's value - formElement = document.getElementById(form_element_name); - for (n in tinyMCE.instances) { - inst = tinyMCE.instances[n]; - - if (!tinyMCE.isInstance(inst)) - continue; - - inst.switchSettings(); - - if (inst.formElement == formElement) { - doc = inst.getDoc(); - - tinyMCE._setHTML(doc, inst.formElement.value); - - if (!tinyMCE.isIE) - doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid); - } - } - }, - - addMCEControl : function(replace_element, form_element_name, target_document) { - var id = "mce_editor_" + tinyMCE.idCounter++; - var inst = new TinyMCE_Control(tinyMCE.settings); - - inst.editorId = id; - this.instances[id] = inst; - - inst._onAdd(replace_element, form_element_name, target_document); - }, - - removeInstance : function(ti) { - var t = [], n, i; - - // Remove from instances - for (n in tinyMCE.instances) { - i = tinyMCE.instances[n]; - - if (tinyMCE.isInstance(i) && ti != i) - t[n] = i; - } - - tinyMCE.instances = t; - - // Remove from global undo/redo - n = []; - t = tinyMCE.undoLevels; - - for (i=0; i 0) { - tinyMCE.nextUndoRedoAction = 'Undo'; - inst = this.undoLevels[--this.undoIndex]; - inst.select(); - - if (!tinyMCE.nextUndoRedoInstanceId) - inst.execCommand('Undo'); - } - } else - inst.execCommand('Undo'); - return true; - - case "Redo": - if (this.getParam('custom_undo_redo_global')) { - if (this.undoIndex <= this.undoLevels.length - 1) { - tinyMCE.nextUndoRedoAction = 'Redo'; - inst = this.undoLevels[this.undoIndex++]; - inst.select(); - - if (!tinyMCE.nextUndoRedoInstanceId) - inst.execCommand('Redo'); - } - } else - inst.execCommand('Redo'); - - return true; - - case 'mceFocus': - inst = tinyMCE.getInstanceById(value); - - if (inst) - inst.getWin().focus(); - return; - - case "mceAddControl": - case "mceAddEditor": - tinyMCE.addMCEControl(tinyMCE._getElementById(value), value); - return; - - case "mceAddFrameControl": - tinyMCE.addMCEControl(tinyMCE._getElementById(value.element, value.document), value.element, value.document); - return; - - case "mceRemoveControl": - case "mceRemoveEditor": - tinyMCE.removeMCEControl(value); - return; - - case "mceToggleEditor": - inst = tinyMCE.getInstanceById(value); - - if (inst) { - pe = document.getElementById(inst.editorId + '_parent'); - te = inst.oldTargetElement; - - if (typeof(inst.enabled) == 'undefined') - inst.enabled = true; - - inst.enabled = !inst.enabled; - - if (!inst.enabled) { - pe.style.display = 'none'; - - if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT') - te.value = inst.getHTML(); - else - te.innerHTML = inst.getHTML(); - - te.style.display = inst.oldTargetDisplay; - tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst); - } else { - pe.style.display = 'block'; - te.style.display = 'none'; - - if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT') - inst.setHTML(te.value); - else - inst.setHTML(te.innerHTML); - - inst.useCSS = false; - tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst); - } - } else - tinyMCE.addMCEControl(tinyMCE._getElementById(value), value); - - return; - - case "mceResetDesignMode": - // Resets the designmode state of the editors in Gecko - if (tinyMCE.isGecko) { - for (n in tinyMCE.instances) { - if (!tinyMCE.isInstance(tinyMCE.instances[n])) - continue; - - try { - tinyMCE.instances[n].getDoc().designMode = "off"; - tinyMCE.instances[n].getDoc().designMode = "on"; - tinyMCE.instances[n].useCSS = false; - } catch (e) { - // Ignore any errors - } - } - } - - return; - } - - if (inst) { - inst.execCommand(command, user_interface, value); - } else if (tinyMCE.settings.focus_alert) - alert(tinyMCELang.lang_focus_alert); - }, - - _createIFrame : function(replace_element, doc, win) { - var iframe, id = replace_element.getAttribute("id"); - var aw, ah; - - if (typeof(doc) == "undefined") - doc = document; - - if (typeof(win) == "undefined") - win = window; - - iframe = doc.createElement("iframe"); - - aw = "" + tinyMCE.settings.area_width; - ah = "" + tinyMCE.settings.area_height; - - if (aw.indexOf('%') == -1) { - aw = parseInt(aw); - aw = (isNaN(aw) || aw < 0) ? 300 : aw; - aw = aw + "px"; - } - - if (ah.indexOf('%') == -1) { - ah = parseInt(ah); - ah = (isNaN(ah) || ah < 0) ? 240 : ah; - ah = ah + "px"; - } - - iframe.setAttribute("id", id); - iframe.setAttribute("name", id); - iframe.setAttribute("class", "mceEditorIframe"); - iframe.setAttribute("border", "0"); - iframe.setAttribute("frameBorder", "0"); - iframe.setAttribute("marginWidth", "0"); - iframe.setAttribute("marginHeight", "0"); - iframe.setAttribute("leftMargin", "0"); - iframe.setAttribute("topMargin", "0"); - iframe.setAttribute("width", aw); - iframe.setAttribute("height", ah); - iframe.setAttribute("allowtransparency", "true"); - iframe.className = 'mceEditorIframe'; - - if (tinyMCE.settings.auto_resize) - iframe.setAttribute("scrolling", "no"); - - // Must have a src element in MSIE HTTPs breaks aswell as absoute URLs - if (tinyMCE.isRealIE) - iframe.setAttribute("src", this.settings.default_document); - - 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.isRealIE) - replace_element.outerHTML = iframe.outerHTML; - else - replace_element.parentNode.replaceChild(iframe, replace_element); - - if (tinyMCE.isRealIE) - return win.frames[id]; - else - return iframe; - }, - - setupContent : function(editor_id) { - var inst = tinyMCE.instances[editor_id], i, doc = inst.getDoc(), head = doc.getElementsByTagName('head').item(0); - var content = inst.startContent, contentElement, body; - - // 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, '&'); - } - - tinyMCE.selectedInstance = inst; - inst.switchSettings(); - - // Not loaded correctly hit it again, Mozilla bug #997860 - if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") { - // This part will remove the designMode status - // Failes first time in Firefox 1.5b2 on Mac - try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {} - window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000); +/* file:jscripts/tiny_mce/classes/tinymce.js */ + +var tinymce = { + majorVersion : '3', + minorVersion : '0rc2', + releaseDate : '2008-01-xx', + + _init : function() { + var t = this, ua = navigator.userAgent, i, nl, n, base; + + // Browser checks + t.isOpera = window.opera && opera.buildNumber; + t.isWebKit = /WebKit/.test(ua); + t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt; + t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName); + t.isIE6 = t.isIE && /MSIE [56]/.test(ua); + t.isGecko = !t.isWebKit && /Gecko/.test(ua); +// t.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua); + t.isMac = ua.indexOf('Mac') != -1; + + // TinyMCE .NET webcontrol might be setting the values for TinyMCE + if (window.tinyMCEPreInit) { + t.suffix = tinyMCEPreInit.suffix; + t.baseURL = tinyMCEPreInit.base; return; } - // Wait for it to load - if (!head || !doc.body) { - window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10); - return; + // Get suffix and base + t.suffix = ''; + + // If base element found, add that infront of baseURL + nl = document.getElementsByTagName('base'); + for (i=0; i'); + // If path to script is relative and a base href was found add that one infront + if (base && t.baseURL.indexOf('://') == -1) + t.baseURL = base + t.baseURL; - inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '

    '); - inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '

    '); - inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '
    '); - - // Add default shortcuts for gecko - if (tinyMCE.isGecko) { - inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold'); - inst.addShortcut('ctrl', 'i', 'lang_italic_desc', 'Italic'); - inst.addShortcut('ctrl', 'u', 'lang_underline_desc', 'Underline'); - } - - // Setup span styles - if (tinyMCE.getParam("convert_fonts_to_spans")) - inst.getBody().setAttribute('id', 'mceSpanFonts'); - - if (tinyMCE.settings.nowrap) - doc.body.style.whiteSpace = "nowrap"; - - doc.body.dir = this.settings.directionality; - doc.editorId = editor_id; - - // Add on document element in Mozilla - if (!tinyMCE.isIE) - doc.documentElement.editorId = editor_id; - - inst.setBaseHREF(tinyMCE.settings.base_href); - - // Replace new line characters to BRs - if (tinyMCE.settings.convert_newlines_to_brs) { - content = tinyMCE.regexpReplace(content, "\r\n", "
    ", "gi"); - content = tinyMCE.regexpReplace(content, "\r", "
    ", "gi"); - content = tinyMCE.regexpReplace(content, "\n", "
    ", "gi"); - } - - // Open closed anchors - // content = content.replace(new RegExp('', 'gi'), ''); - - // Call custom cleanup code - content = tinyMCE.storeAwayURLs(content); - content = tinyMCE._customCleanup(inst, "insert_to_editor", content); - - if (tinyMCE.isIE) { - // Ugly!!! - window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500); - - if (tinyMCE.settings.force_br_newlines) - doc.styleSheets[0].addRule("p", "margin: 0;"); - - body = inst.getBody(); - body.editorId = editor_id; - } - - content = tinyMCE.cleanupHTMLCode(content); - - // Fix for bug #958637 - if (!tinyMCE.isIE) { - contentElement = inst.getDoc().createElement("body"); - doc = inst.getDoc(); - - contentElement.innerHTML = content; - - if (tinyMCE.settings.cleanup_on_startup) - tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement)); - else - tinyMCE.setInnerHTML(inst.getBody(), content); - - tinyMCE.convertAllRelativeURLs(inst.getBody()); - } else { - if (tinyMCE.settings.cleanup_on_startup) { - tinyMCE._setHTML(inst.getDoc(), content); - - // Produces permission denied error in MSIE 5.5 - try { - tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody())); - } catch(e) { - // Ignore - } - } else - tinyMCE._setHTML(inst.getDoc(), content); - } - - // Fix for bug #957681 - //inst.getDoc().designMode = inst.getDoc().designMode; - - tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings.visual, inst); - tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc()); - - // Re-add design mode on mozilla - if (!tinyMCE.isIE) - tinyMCE.addEventHandlers(inst); - - // Add blur handler - if (tinyMCE.isIE) { - tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch); - tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953 - - // Workaround for drag drop/copy paste base href bug - if (!tinyMCE.isOpera) { - tinyMCE.addEvent(doc.body, "mousemove", TinyMCE_Engine.prototype.onMouseMove); - tinyMCE.addEvent(doc.body, "beforepaste", TinyMCE_Engine.prototype._eventPatch); - tinyMCE.addEvent(doc.body, "drop", TinyMCE_Engine.prototype._eventPatch); - } - } - - // Trigger node change, this call locks buttons for tables and so forth - inst.select(); - tinyMCE.selectedElement = inst.contentWindow.document.body; - - // Call custom DOM cleanup - tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody()); - tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody()); - tinyMCE._setEventsEnabled(inst.getBody(), false); - tinyMCE.cleanupAnchors(inst.getDoc()); - - if (tinyMCE.getParam("convert_fonts_to_spans")) - tinyMCE.convertSpansToFonts(inst.getDoc()); - - 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('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); - - return false; - }); - } - - // Remove Gecko spellchecking - if (tinyMCE.isGecko) - inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck"); - - // Cleanup any mess left from storyAwayURLs - tinyMCE._removeInternal(inst.getBody()); - - inst.select(); - tinyMCE.triggerNodeChange(false, true); - }, - - storeAwayURLs : function(s) { - // Remove all mce_src, mce_href and replace them with new ones - // s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - // s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - - if (!s.match(/(mce_src|mce_href)/gi, s)) { - s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"'); - s = s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'href="$1" mce_href="$1"'); - } - - 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('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); - - return false; - }); - } - }, - - removeTinyMCEFormElements : function(form_obj) { - var i, elementId; - - // Skip form element removal - if (!tinyMCE.getParam('hide_selects_on_submit')) - return; - - // Check if form is valid - if (typeof(form_obj) == "undefined" || form_obj == null) - return; - - // If not a form, find the form - if (form_obj.nodeName != "FORM") { - if (form_obj.form) - form_obj = form_obj.form; - else - form_obj = tinyMCE.getParentElement(form_obj, "form"); - } - - // Still nothing - if (form_obj == null) - return; - - // Disable all UI form elements that TinyMCE created - for (i=0; i"); - rng.collapse(false); - rng.select(); - - tinyMCE.execCommand("mceAddUndoLevel"); - tinyMCE.triggerNodeChange(false); - return false; - } - } - - // Backspace or delete - if (e.keyCode == 8 || e.keyCode == 46) { - tinyMCE.selectedElement = e.target; - tinyMCE.linkElement = tinyMCE.getParentElement(e.target, "a"); - tinyMCE.imgElement = tinyMCE.getParentElement(e.target, "img"); - tinyMCE.triggerNodeChange(false); - } - - return false; - - case "keyup": - case "keydown": - tinyMCE.hideMenus(); - tinyMCE.hasMouseMoved = false; - - if (inst && inst.handleShortcut(e)) - return false; - - inst._fixRootBlocks(); - - if (inst.settings.remove_trailing_nbsp) - inst._fixTrailingNbsp(); - - if (e.target.editorId) - tinyMCE.instances[e.target.editorId].select(); - - if (tinyMCE.selectedInstance) - tinyMCE.selectedInstance.switchSettings(); - - inst = tinyMCE.selectedInstance; - - // Handle backspace - if (tinyMCE.isGecko && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) { - // Insert P element instead of BR - if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) { - // Cancel event - tinyMCE.execCommand("mceAddUndoLevel"); - e.preventDefault(); - return false; - } - } - - tinyMCE.selectedElement = null; - tinyMCE.selectedNode = null; - elm = tinyMCE.selectedInstance.getFocusElement(); - tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a"); - tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img"); - tinyMCE.selectedElement = elm; - - // Update visualaids on tabs - if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9) - tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings.visual, tinyMCE.selectedInstance); - - // Fix empty elements on return/enter, check where enter occured - if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13) - tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement(); - - // Fix empty elements on return/enter - if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) { - elm = tinyMCE.enterKeyElement; - if (elm) { - var re = new RegExp('^HR|IMG|BR$','g'); // Skip these - var dre = new RegExp('^H[1-6]$','g'); // Add double on these - - if (!elm.hasChildNodes() && !re.test(elm.nodeName)) { - if (dre.test(elm.nodeName)) - elm.innerHTML = "  "; - else - elm.innerHTML = " "; - } - } - } - - // Check if it's a position key - keys = tinyMCE.posKeyCodes; - var posKey = false; - for (i=0; i'; - h += '{$'+lang+'}'; - h += ''; - } else { - // Normal button - h += ''; - h += '{$'+lang+'}'; - h += ''; - } - - return h; - }, - - getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) { - var h = '', m, x; - - mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');'; - cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\''; - - if (typeof(ui) != "undefined" && ui != null) - cmd += ',' + ui; - - if (typeof(val) != "undefined" && val != null) - cmd += ",'" + val + "'"; - - cmd += ');'; - - // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled - if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) { - x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20); - - if (tinyMCE.isRealIE) - h += ''; - else - h += ''; - - h += ''; - h += ''; - h += ''; - h += ''; - } else { - if (tinyMCE.isRealIE) - h += ''; - else - h += ''; - - h += ''; - h += ''; - h += ''; - h += ''; - } - - return h; - }, - - _menuButtonEvent : function(e, o) { - if (o.className == 'mceMenuButtonFocus') - return; - - if (e == 'over') - o.className = o.className + ' mceMenuHover'; - else - o.className = o.className.replace(/\s.*$/, ''); - }, - - addButtonMap : function(m) { - var i, a = m.replace(/\s+/, '').split(','); - - for (i=0; i 0); - - if (tinyMCE.settings.custom_undo_redo) { - undoIndex = inst.undoRedo.undoIndex; - undoLevels = inst.undoRedo.undoLevels.length; - } - - tinyMCE.dispatchCallback(inst, 'handle_node_change_callback', 'handleNodeChange', editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content); - } - - if (this.selectedInstance && (typeof(focus) == "undefined" || focus)) - this.selectedInstance.contentWindow.focus(); - }, - - _customCleanup : function(inst, type, content) { - var pl, po, i, customCleanup; - - // Call custom cleanup - customCleanup = tinyMCE.settings.cleanup_callback; - if (customCleanup != '') - content = tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback, window)(type, content, inst); - - // Trigger theme cleanup - po = tinyMCE.themes[tinyMCE.settings.theme]; - if (po && po.cleanup) - content = po.cleanup(type, content, inst); - - // Trigger plugin cleanups - pl = inst.plugins; - for (i=0; i 0) - className += " "; - - className += classNames[i]; - } - - return className; - }, - - handleVisualAid : function(el, deep, state, inst, skip_dispatch) { - var i, x, y, tableElement, anchorName, oldW, oldH, bo, cn; - - if (!el) - return; - - if (!skip_dispatch) - tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst); - - tableElement = null; - - switch (el.nodeName) { - case "TABLE": - oldW = el.style.width; - oldH = el.style.height; - bo = tinyMCE.getAttrib(el, "border"); - - bo = bo == '' || bo == "0" ? true : false; - - tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo)); - - el.style.width = oldW; - el.style.height = oldH; - - for (y=0; y 0) - return inst.cssClasses; - - if (!doc) - return; - - styles = doc.styleSheets; - - if (styles && styles.length > 0) { - for (x=0; x : + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name - l = tinyMCE.plugins; - for (n in l) { - o = l[n]; + // Create namespace for new class + ns = t.createNS(s[3].replace(/\.\w+$/, '')); - if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') { - if (rtl) - return '' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + ''; + // Class already exists + if (ns[cn]) + return; - return tinyMCE.replaceVar(v, "pluginurl", o.baseURL); + // Make pure static class + if (s[2] == 'static') { + ns[cn] = p; + + if (this.onCreate) + this.onCreate(s[2], s[3], ns[cn]); + + return; + } + + // Create default constructor + if (!p[cn]) { + p[cn] = function() {}; + de = 1; + } + + // Add constructor and methods + ns[cn] = p[cn]; + t.extend(ns[cn].prototype, p); + + // Extend + if (s[5]) { + sp = t.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; // Class name + + // Extend constructor + c = ns[cn]; + if (de) { + // Add passthrough constructor + ns[cn] = function() { + return sp[scn].apply(this, arguments); + }; + } else { + // Add inherit constructor + ns[cn] = function() { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; } + ns[cn].prototype[cn] = ns[cn]; + + // Add super methods + t.each(sp, function(f, n) { + if (n != scn) + ns[cn].prototype[n] = sp[n]; + }); + + // Add overridden methods + t.each(p, function(f, n) { + // Extend methods if needed + if (sp[n]) { + ns[cn].prototype[n] = function() { + this.parent = sp[n]; + return f.apply(this, arguments); + }; + } else { + if (n != cn) + ns[cn].prototype[n] = f; + } + }); } - o = tinyMCE.themes[tinyMCE.settings.theme]; - if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') { - if (rtl) - return '' + v + ''; + // Add static methods + t.each(p['static'], function(f, n) { + ns[cn][n] = f; + }); - return v; + if (this.onCreate) + this.onCreate(s[2], s[3], ns[cn].prototype); + }, + + walk : function(o, f, n, s) { + s = s || this; + + if (o) { + if (n) + o = o[n]; + + tinymce.each(o, function(o, i) { + if (f.call(s, o, i, n) === false) + return false; + + tinymce.walk(o, f, n, s); + }); + } + }, + + createNS : function(n, o) { + var i, v; + + o = o || window; + + n = n.split('.'); + for (i=0; i 0) - return true; - - if (ins != null) { - for (i=0, l = ins.plugins; i 0) - return true; - } + if (!o) + break; } - l = tinyMCE.themes; - for (on in l) { - o = l[on]; - - if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0) - return true; - } - - return false; + return o; }, - resolveDots : function(s, o) { - var i; + addUnload : function(f, s) { + var t = this, w = window, unload; - if (typeof(s) == 'string') { - for (i=0, s=s.split('.'); i': - return '>'; + tinymce.each(u, function(o, i) { + if (o && o.func == f) { + u.splice(i, 1); + r = f; + return false; } + }); - return c; - }) : s; - }, - - add : function(c, m) { - var n; - - for (n in m) - c.prototype[n] = m[n]; - }, - - extend : function(p, np) { - var o = {}, n; - - o.parent = p; - - for (n in p) - o[n] = p[n]; - - for (n in np) - o[n] = np[n]; - - return o; - }, - - hideMenus : function() { - var e = tinyMCE.lastSelectedMenuBtn; - - if (tinyMCE.lastMenu) { - tinyMCE.lastMenu.hide(); - tinyMCE.lastMenu = null; - } - - if (e) { - tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass); - tinyMCE.lastSelectedMenuBtn = null; - } + return r; } }; -// Global instances -var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors -var tinyMCE = new TinyMCE_Engine(); -var tinyMCELang = {}; +// Required for GZip AJAX loading +window.tinymce = tinymce; -/* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */ +// Initialize the API +tinymce._init(); -function TinyMCE_Control(settings) { - var t, i, tos, fu, p, x, fn, fu, pn, s = settings; +/* file:jscripts/tiny_mce/classes/adapter/jquery/adapter.js */ - this.undoRedoLevel = true; - this.isTinyMCE_Control = true; - // Default settings - this.enabled = true; - this.settings = s; - this.settings.theme = tinyMCE.getParam("theme", "default"); - this.settings.width = tinyMCE.getParam("width", -1); - this.settings.height = tinyMCE.getParam("height", -1); - this.selection = new TinyMCE_Selection(this); - this.undoRedo = new TinyMCE_UndoRedo(this); - this.cleanup = new TinyMCE_Cleanup(); - this.shortcuts = []; - this.hasMouseMoved = false; - this.foreColor = this.backColor = "#999999"; - this.data = {}; - this.cssClasses = []; +/* file:jscripts/tiny_mce/classes/adapter/prototype/adapter.js */ - this.cleanup.init({ - valid_elements : s.valid_elements, - extended_valid_elements : s.extended_valid_elements, - valid_child_elements : s.valid_child_elements, - entities : s.entities, - entity_encoding : s.entity_encoding, - debug : s.cleanup_debug, - indent : s.apply_source_formatting, - invalid_elements : s.invalid_elements, - verify_html : s.verify_html, - fix_content_duplication : s.fix_content_duplication, - convert_fonts_to_spans : s.convert_fonts_to_spans - }); - // Wrap old theme - t = this.settings.theme; - if (!tinyMCE.hasTheme(t)) { - fn = tinyMCE.callbacks; - tos = {}; +/* file:jscripts/tiny_mce/classes/util/Dispatcher.js */ - for (i=0; i 0) { - for (i=0; i= items.length) { + for (i = 0; i < base.length; i++) { + if (i >= items.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (base.length < items.length) { + for (i = 0; i < items.length; i++) { + if (i >= base.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (bp == 1) + return path; + + for (i = 0; i < base.length - (bp - 1); i++) + out += "../"; + + for (i = bp - 1; i < items.length; i++) { + if (i != bp - 1) + out += "/" + items[i]; + else + out += items[i]; + } + + return out; + }, + + toAbsPath : function(base, path) { + var i, nb = 0, o = []; + + // Split paths + base = base.split('/'); + path = path.split('/'); + + // Remove empty chunks + each(base, function(k) { + if (k) + o.push(k); + }); + + base = o; + + // Merge relURLParts chunks + for (i = path.length - 1, o = []; i >= 0; i--) { + // Ignore empty or . + if (path[i].length == 0 || path[i] == ".") + continue; + + // Is parent + if (path[i] == '..') { + nb++; + continue; + } + + // Move up + if (nb > 0) { + nb--; + continue; + } + + o.push(path[i]); + } + + i = base.length - nb; + + // If /a/b/c or / + if (i <= 0) + return '/' + o.reverse().join('/'); + + return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/'); + }, + + getURI : function(nh) { + var s, t = this; + + // Rebuild source + if (!t.source || nh) { + s = ''; + + if (!nh) { + if (t.protocol) + s += t.protocol + '://'; + + if (t.userInfo) + s += t.userInfo + '@'; + + if (t.host) + s += t.host; + + if (t.port) + s += ':' + t.port; + } + + if (t.path) + s += t.path; + + if (t.query) + s += '?' + t.query; + + if (t.anchor) + s += '#' + t.anchor; + + t.source = s; + } + + return t.source; } - return false; - }, + }); +})(); - addPlugin : function(n, p) { - if (!this.hasPlugin(n)) { - tinyMCE.addPlugin(n, p); - this.plugins[this.plugins.length] = n; +/* file:jscripts/tiny_mce/classes/util/Cookie.js */ + +(function() { + var each = tinymce.each; + + tinymce.create('static tinymce.util.Cookie', { + getHash : function(n) { + var v = this.get(n), h; + + if (v) { + each(v.split('&'), function(v) { + v = v.split('='); + h = h || {}; + h[unescape(v[0])] = unescape(v[1]); + }); + } + + return h; + }, + + setHash : function(n, v, e, p, d, s) { + var o = ''; + + each(v, function(v, k) { + o += (!o ? '' : '&') + escape(k) + '=' + escape(v); + }); + + this.set(n, o, e, p, d, s); + }, + + get : function(n) { + var c = document.cookie, e, p = n + "=", b; + + // Strict mode + if (!c) + return; + + b = c.indexOf("; " + p); + + if (b == -1) { + b = c.indexOf(p); + + if (b != 0) + return null; + } else + b += 2; + + e = c.indexOf(";", b); + + if (e == -1) + e = c.length; + + return unescape(c.substring(b + p.length, e)); + }, + + set : function(n, v, e, p, d, s) { + document.cookie = n + "=" + escape(v) + + ((e) ? "; expires=" + e.toGMTString() : "") + + ((p) ? "; path=" + escape(p) : "") + + ((d) ? "; domain=" + d : "") + + ((s) ? "; secure" : ""); + }, + + remove : function(n, p) { + var d = new Date(); + + d.setTime(d.getTime() - 1000); + + this.set(n, '', d, p, d); } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/util/JSON.js */ + +tinymce.create('static tinymce.util.JSON', { + serialize : function(o) { + var i, v, s = tinymce.util.JSON.serialize, t; + + if (o == null) + return 'null'; + + t = typeof o; + + if (t == 'string') { + v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; + + return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) { + i = v.indexOf(b); + + if (i + 1) + return '\\' + v.charAt(i + 1); + + a = b.charCodeAt().toString(16); + + return '\\u' + '0000'.substring(a.length) + a; + }) + '"'; + } + + if (t == 'object') { + if (o instanceof Array) { + for (i=0, v = '['; i 0 ? ',' : '') + s(o[i]); + + return v + ']'; + } + + v = '{'; + + for (i in o) + v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : ''; + + return v + '}'; + } + + return '' + o; }, - repaint : function() { - var s, b, ex; - - if (tinyMCE.isRealIE) - return; - + parse : function(s) { try { - s = this.selection; - b = s.getBookmark(true); - this.getBody().style.display = 'none'; - this.getDoc().execCommand('selectall', false, null); - this.getSel().collapseToStart(); - this.getBody().style.display = 'block'; - s.moveToBookmark(b); + return eval('(' + s + ')'); } catch (ex) { // Ignore } - }, - - switchSettings : function() { - if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings.index) { - tinyMCE.settings = this.settings; - tinyMCE.currentConfig = this.settings.index; - } - }, - - select : function() { - var oldInst = tinyMCE.selectedInstance; - - if (oldInst != this) { - if (oldInst) - oldInst.execCommand('mceEndTyping'); - - tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst); - tinyMCE.selectedInstance = this; - } - }, - - getBody : function() { - return this.contentBody ? this.contentBody : this.getDoc().body; - }, - - getDoc : function() { -// return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ? - return this.contentWindow.document; - }, - - getWin : function() { - return this.contentWindow; - }, - - getContainerWin : function() { - return this.containerWindow ? this.containerWindow : window; - }, - - getViewPort : function() { - return tinyMCE.getViewPort(this.getWin()); - }, - - getParentNode : function(n, f) { - return tinyMCE.getParentNode(n, f, this.getBody()); - }, - - getParentElement : function(n, na, f) { - return tinyMCE.getParentElement(n, na, f, this.getBody()); - }, - - getParentBlockElement : function(n) { - return tinyMCE.getParentBlockElement(n, this.getBody()); - }, - - resizeToContent : function() { - var d = this.getDoc(), b = d.body, de = d.documentElement; - - this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px'; - }, - - addShortcut : function(m, k, d, cmd, ui, va) { - var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts; - - if (!tinyMCE.getParam('custom_shortcuts')) - return false; - - m = m.toLowerCase(); - k = ie && !n ? k.toUpperCase() : k; - c = n ? null : k.charCodeAt(0); - d = d && d.indexOf('lang_') == 0 ? tinyMCE.getLang(d) : d; - - sc = { - alt : m.indexOf('alt') != -1, - ctrl : m.indexOf('ctrl') != -1, - shift : m.indexOf('shift') != -1, - charCode : c, - keyCode : n ? k : (ie ? c : null), - desc : d, - cmd : cmd, - ui : ui, - val : va - }; - - for (i=0; i 1 && /(^\u00a0|\u00a0$)/.test(v)) { - e.firstChild.nodeValue = v.replace(/(^\u00a0|\u00a0$)/, ''); - s.selectNode(e.firstChild, true, false, false); // Select and collapse - } - } - }, - - _setUseCSS : function(b) { - var d = this.getDoc(); - - try {d.execCommand("useCSS", false, !b);} catch (ex) {} - try {d.execCommand("styleWithCSS", false, b);} catch (ex) {} - - if (!tinyMCE.getParam("table_inline_editing")) - try {d.execCommand('enableInlineTableEditing', false, "false");} catch (ex) {} - - if (!tinyMCE.getParam("object_resizing")) - try {d.execCommand('enableObjectResizing', false, "false");} catch (ex) {} - }, - - execCommand : function(command, user_interface, value) { - var i, x, z, align, img, div, doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); - - // Is not a undo specific command - if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) - this.undoBookmark = null; - - // Mozilla issue - if (!tinyMCE.isIE && !this.useCSS) { - this._setUseCSS(false); - this.useCSS = true; - } - - //debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value); - this.contentDocument = doc; // <-- Strange, unless this is applied Mozilla 1.3 breaks - - // Don't dispatch key commands - if (!/mceStartTyping|mceEndTyping/.test(command)) { - if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value)) - return; - } - - // Fix align on images - if (focusElm && focusElm.nodeName == "IMG") { - align = focusElm.getAttribute('align'); - img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm; - - switch (command) { - case "JustifyLeft": - if (align == 'left') - img.removeAttribute('align'); - else - img.setAttribute('align', 'left'); - - // Remove the div - div = focusElm.parentNode; - if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - - case "JustifyCenter": - img.removeAttribute('align'); - - // Is centered - div = tinyMCE.getParentElement(focusElm, "div"); - if (div && div.style.textAlign == "center") { - // Remove div - if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - } else { - // Add div - div = this.getDoc().createElement("div"); - div.style.textAlign = 'center'; - div.appendChild(img); - focusElm.parentNode.replaceChild(div, focusElm); - } - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - - case "JustifyRight": - if (align == 'right') - img.removeAttribute('align'); - else - img.setAttribute('align', 'right'); - - // Remove the div - div = focusElm.parentNode; - if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - } - } - - if (tinyMCE.settings.force_br_newlines) { - var alignValue = ""; - - if (doc.selection.type != "Control") { - switch (command) { - case "JustifyLeft": - alignValue = "left"; - break; - - case "JustifyCenter": - alignValue = "center"; - break; - - case "JustifyFull": - alignValue = "justify"; - break; - - case "JustifyRight": - alignValue = "right"; - break; - } - - if (alignValue !== '') { - var rng = doc.selection.createRange(); - - if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null) - divElm.setAttribute("align", alignValue); - else if (rng.pasteHTML && rng.htmlText.length > 0) - rng.pasteHTML('
    ' + rng.htmlText + "
    "); - - tinyMCE.triggerNodeChange(); - return; - } - } - } - - switch (command) { - case "mceRepaint": - this.repaint(); - return true; - - case "unlink": - // Unlink if caret is inside link - if (tinyMCE.isGecko && this.getSel().isCollapsed) { - focusElm = tinyMCE.getParentElement(focusElm, 'A'); - - if (focusElm) - this.selection.selectNode(focusElm, false); - } - - this.getDoc().execCommand(command, user_interface, value); - - tinyMCE.isGecko && this.getSel().collapseToEnd(); - - tinyMCE.triggerNodeChange(); - - return true; - - case "InsertUnorderedList": - case "InsertOrderedList": - this.getDoc().execCommand(command, user_interface, value); - tinyMCE.triggerNodeChange(); - break; - - case "Strikethrough": - this.getDoc().execCommand(command, user_interface, value); - tinyMCE.triggerNodeChange(); - break; - - case "mceSelectNode": - this.selection.selectNode(value); - tinyMCE.triggerNodeChange(); - tinyMCE.selectedNode = value; - break; - - case "FormatBlock": - if (value == null || value == '') { - 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 (!this.cleanup.isValid(value)) - return true; - - if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value)) - value = value.replace(/[^a-z]/gi, ''); - - if (tinyMCE.isIE && 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(); - - break; - - case "mceRemoveNode": - if (!value) - value = tinyMCE.getParentElement(this.getFocusElement()); - - if (tinyMCE.isIE) { - value.outerHTML = value.innerHTML; - } else { - var rng = value.ownerDocument.createRange(); - rng.setStartBefore(value); - rng.setEndAfter(value); - rng.deleteContents(); - rng.insertNode(rng.createContextualFragment(value.innerHTML)); - } - - tinyMCE.triggerNodeChange(); - - break; - - case "mceSelectNodeDepth": - var parentNode = this.getFocusElement(); - for (i=0; parentNode; i++) { - if (parentNode.nodeName.toLowerCase() == "body") - break; - - if (parentNode.nodeName.toLowerCase() == "#text") { - i--; - parentNode = parentNode.parentNode; - continue; - } - - if (i == value) { - this.selection.selectNode(parentNode, false); - tinyMCE.triggerNodeChange(); - tinyMCE.selectedNode = parentNode; - return; - } - - parentNode = parentNode.parentNode; - } - - break; - - case "mceSetStyleInfo": - case "SetStyleInfo": - var rng = this.getRng(); - var sel = this.getSel(); - var scmd = value.command; - var sname = value.name; - var svalue = value.value == null ? '' : value.value; - //var svalue = value['value'] == null ? '' : value['value']; - var wrapper = value.wrapper ? value.wrapper : "span"; - var parentElm = null; - var invalidRe = new RegExp("^BODY|HTML$", "g"); - var invalidParentsRe = tinyMCE.settings.merge_styles_invalid_parents !== '' ? new RegExp(tinyMCE.settings.merge_styles_invalid_parents, "gi") : null; - - // Whole element selected check - if (tinyMCE.isIE) { - // Control range - if (rng.item) - parentElm = rng.item(0); - else { - var pelm = rng.parentElement(); - var prng = doc.selection.createRange(); - prng.moveToElementText(pelm); - - if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) { - if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName)) - parentElm = pelm; - } - } - } else { - var felm = this.getFocusElement(); - if (sel.isCollapsed || (new RegExp('td|tr|tbody|table|img', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode)) - parentElm = felm; - } - - // Whole element selected - if (parentElm && !invalidRe.test(parentElm.nodeName)) { - if (scmd == "setstyle") - tinyMCE.setStyleAttrib(parentElm, sname, svalue); - - if (scmd == "setattrib") - tinyMCE.setAttrib(parentElm, sname, svalue); - - if (scmd == "removeformat") { - parentElm.style.cssText = ''; - tinyMCE.setAttrib(parentElm, 'class', ''); - } - - // Remove style/attribs from all children - var ch = tinyMCE.getNodeTree(parentElm, [], 1); - for (z=0; z=0; i--) { - var elm = nodes[i]; - var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true"; - - elm.removeAttribute("mce_new"); - - // Is only child a element - if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) { - //tinyMCE.debug("merge1" + isNew); - this._mergeElements(scmd, elm, elm.childNodes[0], isNew); - continue; - } - - // Is I the only child - if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) { - //tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName); - if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName)) - this._mergeElements(scmd, elm.parentNode, elm, false); - } - } - - // Remove empty wrappers - var nodes = doc.getElementsByTagName(wrapper); - for (i=nodes.length-1; i>=0; i--) { - var elm = nodes[i], isEmpty = true; - - // Check if it has any attribs - var tmp = doc.createElement("body"); - tmp.appendChild(elm.cloneNode(false)); - - // Is empty span, remove it - tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), ''); - //tinyMCE.debug(tmp.innerHTML); - if (new RegExp('', 'gi').test(tmp.innerHTML)) { - for (x=0; x 0) { - value = tinyMCE.replaceVar(value, "selection", selectedText); - tinyMCE.execCommand('mceInsertContent', false, value); - } - - this._addBogusBR(); - tinyMCE.triggerNodeChange(); - break; - - case "mceSetAttribute": - if (typeof(value) == 'object') { - var targetElms = (typeof(value.targets) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value.targets; - var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms); - - if (targetNode) { - targetNode.setAttribute(value.name, value.value); - tinyMCE.triggerNodeChange(); - } - } - break; - - case "mceSetCSSClass": - this.execCommand("mceSetStyleInfo", false, {command : "setattrib", name : "class", value : value}); - break; - - case "mceInsertRawHTML": - var key = 'tiny_mce_marker'; - - this.execCommand('mceBeginUndoLevel'); - - // Insert marker key - this.execCommand('mceInsertContent', false, key); - - // Store away scroll pos - var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft; - var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop; - - // Find marker and replace with RAW HTML - var html = this.getBody().innerHTML; - if ((pos = html.indexOf(key)) != -1) - tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length)); - - // Restore scoll pos - this.contentWindow.scrollTo(scrollX, scrollY); - - this.execCommand('mceEndUndoLevel'); - - break; - - case "mceInsertContent": - // Force empty string - if (!value) - value = ''; - - var insertHTMLFailed = false; - - // Removed since it produced problems in IE - // this.getWin().focus(); - - if (tinyMCE.isGecko || tinyMCE.isOpera) { - try { - // Is plain text or HTML, &,   etc will be encoded wrong in FF - if (value.indexOf('<') == -1 && !value.match(/(&| |<|>)/g)) { - var r = this.getRng(); - var n = this.getDoc().createTextNode(tinyMCE.entityDecode(value)); - var s = this.getSel(); - var r2 = r.cloneRange(); - - // Insert text at cursor position - s.removeAllRanges(); - r.deleteContents(); - r.insertNode(n); - - // Move the cursor to the end of text - r2.selectNode(n); - r2.collapse(false); - s.removeAllRanges(); - s.addRange(r2); - } else { - value = tinyMCE.fixGeckoBaseHREFBug(1, this.getDoc(), value); - this.getDoc().execCommand('inserthtml', false, value); - tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value); - } - } catch (ex) { - insertHTMLFailed = true; - } - - if (!insertHTMLFailed) { - tinyMCE.triggerNodeChange(); - return; - } - } - - if (!tinyMCE.isIE) { - var isHTML = value.indexOf('<') != -1; - var sel = this.getSel(); - var rng = this.getRng(); - - if (isHTML) { - if (tinyMCE.isSafari) { - var tmpRng = this.getDoc().createRange(); - - tmpRng.setStart(this.getBody(), 0); - tmpRng.setEnd(this.getBody(), 0); - - value = tmpRng.createContextualFragment(value); - } else - value = rng.createContextualFragment(value); - } else { - // Setup text node - value = doc.createTextNode(tinyMCE.entityDecode(value)); - } - - // Insert plain text in Safari - if (tinyMCE.isSafari && !isHTML) { - this.execCommand('InsertText', false, value.nodeValue); - tinyMCE.triggerNodeChange(); - return true; - } else if (tinyMCE.isSafari && isHTML) { - rng.deleteContents(); - rng.insertNode(value); - tinyMCE.triggerNodeChange(); - return true; - } - - rng.deleteContents(); - - // If target node is text do special treatment, (Mozilla 1.3 fix) - if (rng.startContainer.nodeType == 3) { - var node = rng.startContainer.splitText(rng.startOffset); - node.parentNode.insertBefore(value, node); - } else - rng.insertNode(value); - - if (!isHTML) { - // Removes weird selection trails - sel.selectAllChildren(doc.body); - sel.removeAllRanges(); - - // Move cursor to end of content - var rng = doc.createRange(); - - rng.selectNode(value); - rng.collapse(false); - - sel.addRange(rng); - } else - rng.collapse(false); - - tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value); - } else { - var rng = doc.selection.createRange(), tmpRng = null; - var c = value.indexOf('"; - } - - if (hc) { - cn = n.childNodes; - - for (i=0, l=cn.length; i'; - - return h; - }, - - _serializeAttribute : function(n, r, an) { - var av = '', t, os = this.settings.on_save; - - if (os && (an.indexOf('mce_') == 0 || an.indexOf('_moz') == 0)) - return ''; - - if (os && this.mceAttribs[an]) - av = this._getAttrib(n, this.mceAttribs[an]); - - if (av.length == 0) - av = this._getAttrib(n, an); - - if (av.length == 0 && r.defaultAttribs && (t = r.defaultAttribs[an])) { - av = t; - - if (av == "mce_empty") - return " " + an + '=""'; - } - - if (r.forceAttribs && (t = r.forceAttribs[an])) - av = t; - - if (os && av.length != 0 && /^(src|href|longdesc)$/.test(an)) - av = this._urlConverter(this, n, av); - - if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) - return ""; - - if (av.length != 0 && av == "{$uid}") - av = "uid_" + (this.idCount++); - - if (av.length != 0) { - if (an.indexOf('on') != 0) - av = this.xmlEncode(av, 1); - - return " " + an + "=" + '"' + av + '"'; - } - - return ""; - }, - - formatHTML : function(h) { - var s = this.settings, p = '', i = 0, li = 0, o = '', l; - - // Replace BR in pre elements to \n - h = h.replace(/]*)>(.*?)<\/pre>/gi, function (a, b, c) { - c = c.replace(//gi, '\n'); - return '' + c + ''; - }); - - h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :) - h = '\n' + h; - h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting - h = h.replace(this.nlBeforeRe, '\n<$1$2>'); - h = h.replace(this.nlAfterRe, '<$1$2>\n'); - h = h.replace(this.nlBeforeAfterRe, '\n<$1$2$3>\n'); - h += '\n'; - - //tinyMCE.debug(h); - - while ((i = h.indexOf('\n', i + 1)) != -1) { - if ((l = h.substring(li + 1, i)).length != 0) { - if (this.ouRe.test(l) && p.length >= s.indent_levels) - p = p.substring(s.indent_levels); - - o += p + l + '\n'; - - if (this.inRe.test(l)) - p += this.inStr; - } - - li = i; - } - - //tinyMCE.debug(h); - - return o; - }, - - xmlEncode : function(s) { - var cl = this, re = this.xmlEncodeRe; - - if (!this.entitiesDone) - this._setupEntities(); // Will intialize lookup table - - switch (this.settings.entity_encoding) { - case "raw": - return tinyMCE.xmlEncode(s); - - case "named": - return s.replace(re, function (c) { - var b = cl.entities[c.charCodeAt(0)]; - - return b ? '&' + b + ';' : c; - }); - - case "numeric": - return s.replace(re, function (c) { - return '&#' + c.charCodeAt(0) + ';'; - }); - } - - return s; - }, - - split : function(re, s) { - var i, l, o = [], c = s.split(re); - - for (i=0, l=c.length; i' : '>' + h + ''; - - return o; - }, - - createTag : function(d, tn, a, h) { - var o = d.createElement(tn), n; - - if (a) { - for (n in a) { - if (typeof(a[n]) != 'function' && a[n] != null) - tinyMCE.setAttrib(o, n, a[n]); - } - } - - if (h) - o.innerHTML = h; - - return o; - }, - - getElementByAttributeValue : function(n, e, a, v) { - return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0]; - }, - - getElementsByAttributeValue : function(n, e, a, v) { - var i, nl = n.getElementsByTagName(e), o = []; - - for (i=0; i]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/<\/strong>/gi, ''); - h = h.replace(/<\/em>/gi, ''); - } - - if (tinyMCE.isRealIE) { - // Since MSIE handles invalid HTML better that valid XHTML we - // need to make some things invalid.


    gets converted to
    . - h = h.replace(/\s\/>/g, '>'); - - // 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(/]*)>\s* \s*<\/p>/gi, ' 

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

    '); // Keep empty paragraphs - - // Remove first comment - e.innerHTML = tinyMCE.uniqueTag + h; - e.firstChild.removeNode(true); - - // Remove weird auto generated empty paragraphs unless it's supposed to be there - nl = e.getElementsByTagName("p"); - for (i=nl.length-1; i>=0; i--) { - n = nl[i]; - - if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) - n.parentNode.removeChild(n); - } - } else { - h = this.fixGeckoBaseHREFBug(1, e, h); - e.innerHTML = h; - this.fixGeckoBaseHREFBug(2, e, h); - } - }, - - getOuterHTML : function(e) { - var d; - - if (tinyMCE.isIE) - return e.outerHTML; - - d = e.ownerDocument.createElement("body"); - d.appendChild(e.cloneNode(true)); - - return d.innerHTML; - }, - - setOuterHTML : function(e, h, d) { - var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; - - if (tinyMCE.isIE && e.nodeType == 1) - e.outerHTML = h; - else { - t = d.createElement("body"); - t.innerHTML = h; - - for (i=0, nl=t.childNodes; 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 10000) { + w.clearInterval(t); - if (pos == -1) - pos = url_str.length; + if (o.success && c < 10000 && x.status == 200) + o.success.call(o.success_scope, '' + x.responseText, x, o); + else if (o.error) + o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o); - urlParts.path = url_str.substring(lastPos, pos); - - // Get query - lastPos = pos; - if (url_str.charAt(pos) == '?') { - pos = url_str.indexOf('#'); - pos = (pos == -1) ? url_str.length : pos; - urlParts.query = url_str.substring(lastPos+1, pos); - } - - // Get anchor - lastPos = pos; - if (url_str.charAt(pos) == '#') { - pos = url_str.length; - urlParts.anchor = url_str.substring(lastPos+1, pos); - } - } - - return urlParts; - }, - - serializeURL : function(up) { - var o = ""; - - if (up.protocol) - o += up.protocol + "://"; - - if (up.host) - o += up.host; - - if (up.port) - o += ":" + up.port; - - if (up.path) - o += up.path; - - if (up.query) - o += "?" + up.query; - - if (up.anchor) - o += "#" + up.anchor; - - return o; - }, - - convertAbsoluteURLToRelativeURL : function(base_url, url_to_relative) { - var baseURL = this.parseURL(base_url), targetURL = this.parseURL(url_to_relative); - var i, strTok1, strTok2, breakPoint = 0, outPath = "", forceSlash = false; - var fileName, pos; - - if (targetURL.path == '') - targetURL.path = "/"; - else - forceSlash = true; - - // Crop away last path part - base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/')); - strTok1 = base_url.split('/'); - strTok2 = targetURL.path.split('/'); - - if (strTok1.length >= strTok2.length) { - for (i=0; i= strTok2.length || strTok1[i] != strTok2[i]) { - breakPoint = i + 1; - break; + x = null; } - } + }, 10); } - if (strTok1.length < strTok2.length) { - for (i=0; i= strTok1.length || strTok1[i] != strTok2[i]) { - breakPoint = i + 1; - break; - } - } } - - if (breakPoint == 1) - return targetURL.path; - - for (i=0; i<(strTok1.length-(breakPoint-1)); i++) - outPath += "../"; - - for (i=breakPoint-1; i=0; i--) { - if (baseURLParts[i].length == 0) - continue; - - newBaseURLParts[newBaseURLParts.length] = baseURLParts[i]; - } - baseURLParts = newBaseURLParts.reverse(); - - // Merge relURLParts chunks - newRelURLParts = []; - numBack = 0; - for (i=relURLParts.length-1; i>=0; i--) { - if (relURLParts[i].length == 0 || relURLParts[i] == ".") - continue; - - if (relURLParts[i] == '..') { - numBack++; - continue; - } - - if (numBack > 0) { - numBack--; - continue; - } - - newRelURLParts[newRelURLParts.length] = relURLParts[i]; - } - - relURLParts = newRelURLParts.reverse(); - - // Remove end from absolute path - len = baseURLParts.length-numBack; - absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/'); - start = ""; - end = ""; - - // Build output URL - relURL.protocol = baseURL.protocol; - relURL.host = baseURL.host; - relURL.port = baseURL.port; - - // Re-add trailing slash if it's removed - if (relURL.path.charAt(relURL.path.length-1) == "/") - absPath += "/"; - - relURL.path = absPath; - - return this.serializeURL(relURL); - }, - - convertURL : function(url, node, on_save) { - var dl = document.location, start, portPart, urlParts, baseUrlParts, tmpUrlParts, curl; - var prot = dl.protocol, host = dl.hostname, port = dl.port; - - // Pass through file protocol - if (prot == "file:") - return url; - - // Something is wrong, remove weirdness - url = tinyMCE.regexpReplace(url, '(http|https):///', '/'); - - // Mailto link or anchor (Pass through) - if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || /^[ \t\r\n\+]*[#\?]/.test(url)) - return url; - - // Fix relative/Mozilla - if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') - return tinyMCE.settings.base_href + url; - - // Handle relative URLs - if (on_save && tinyMCE.getParam('relative_urls')) { - curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); - if (curl.charAt(0) == '/') - curl = tinyMCE.settings.document_base_prefix + curl; - - urlParts = tinyMCE.parseURL(curl); - tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings.document_base_url); - - // Force relative - if (urlParts.host == tmpUrlParts.host && (urlParts.port == tmpUrlParts.port)) - return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url, curl); - } - - // Handle absolute URLs - if (!tinyMCE.getParam('relative_urls')) { - urlParts = tinyMCE.parseURL(url); - baseUrlParts = tinyMCE.parseURL(tinyMCE.settings.base_href); - - // Force absolute URLs from relative URLs - url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); - - // If anchor and path is the same page - if (urlParts.anchor && urlParts.path == baseUrlParts.path) - return "#" + urlParts.anchor; - } - - // Remove current domain - if (tinyMCE.getParam('remove_script_host')) { - start = ""; - portPart = ""; - - if (port !== '') - portPart = ":" + port; - - start = prot + "//" + host + portPart + "/"; - - if (url.indexOf(start) == 0) - url = url.substring(start.length-1); - } - - return url; - }, - - convertAllRelativeURLs : function(body) { - var i, elms, src, href, mhref, msrc; - - // Convert all image URL:s to absolute URL - elms = body.getElementsByTagName("img"); - for (i=0; i= 0; i--) + cs += '}, ' + (i ? 'n' : 's') + ');'; + + cs += '})'; + + // Compile CSS pattern function + t.cache[pa] = cs = eval(cs); + } + + // Run selector function + cs(isIE ? collectIE : collect, s); + }); + + // Cleanup + each(o, function(n) { + if (isIE) + n.removeAttribute('mce_save'); + else + delete n.mce_save; + }); + + return o; + }, + + // #endif + + add : function(p, n, a, h, c) { + var t = this; + + return this.run(p, function(p) { + var e, k; + + e = is(n, 'string') ? t.doc.createElement(n) : n; + + if (a) { + for (k in a) { + if (a.hasOwnProperty(k) && !is(a[k], 'object')) + t.setAttrib(e, k, '' + a[k]); + } + + if (a.style && !is(a.style, 'string')) { + each(a.style, function(v, n) { + t.setStyle(e, n, v); + }); + } + } + + if (h) { + if (h.nodeType) + e.appendChild(h); + else + e.innerHTML = h; + } + + return !c ? p.appendChild(e) : e; + }); + }, + + create : function(n, a, h) { + return this.add(this.doc.createElement(n), n, a, h, 1); + }, + + createHTML : function(n, a, h) { + var o = '', t = this, k; + + o += '<' + n; + + for (k in a) { + if (a.hasOwnProperty(k)) + o += ' ' + k + '="' + t.encode(a[k]) + '"'; + } + + if (tinymce.is(h)) + return o + '>' + h + ''; + + return o + ' />'; + }, + + remove : function(n, k) { + return this.run(n, function(n) { + var p; + + p = n.parentNode; + + if (!p) + return null; + + if (k) { + each (n.childNodes, function(c) { + p.insertBefore(c.cloneNode(true), n); + }); + } + + return p.removeChild(n); + }); + }, + + // #if !jquery + + setStyle : function(n, na, v) { + var t = this; + + return t.run(n, function(e) { + var s, i; + + s = e.style; + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + // Default px suffix on these + if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v))) + v += 'px'; + + switch (na) { + case 'opacity': + // IE specific opacity + if (isIE) { + s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")"; + + if (!n.currentStyle || !n.currentStyle.hasLayout) + s.display = 'inline-block'; + } + + // Fix for older browsers + s['-moz-opacity'] = s['-khtml-opacity'] = v; + break; + + case 'float': + isIE ? s.styleFloat = v : s.cssFloat = v; + break; + } + + s[na] = v || ''; + + // Force update of the style data + if (t.settings.update_styles) + t.setAttrib(e, 'mce_style'); + }); + }, + + getStyle : function(n, na, c) { + n = this.get(n); + + if (!n) + return false; + + // Gecko + if (this.doc.defaultView && c) { + // Remove camelcase + na = na.replace(/[A-Z]/g, function(a){ + return '-' + a; + }); + + try { + return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na); + } catch (ex) { + // Old safari might fail + return null; + } + } + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + if (na == 'float') + na = isIE ? 'styleFloat' : 'cssFloat'; + + // IE & Opera + if (n.currentStyle && c) + return n.currentStyle[na]; + + return n.style[na]; + }, + + setStyles : function(e, o) { + var t = this, s = t.settings, ol; + + ol = s.update_styles; + s.update_styles = 0; + + each(o, function(v, n) { + t.setStyle(e, n, v); + }); + + // Update style info + s.update_styles = ol; + if (s.update_styles) + t.setAttrib(e, s.cssText); + }, + + setAttrib : function(e, n, v) { + var t = this; + + // Strict XML mode + if (t.settings.strict) + n = n.toLowerCase(); + + return this.run(e, function(e) { + var s = t.settings; + + switch (n) { + case "style": + if (s.keep_values) { + if (v) + e.setAttribute('mce_style', v, 2); + else + e.removeAttribute('mce_style', 2); + } + + e.style.cssText = v; + break; + + case "class": + e.className = v; + break; + + case "src": + case "href": + if (s.keep_values) { + if (s.url_converter) + v = s.url_converter.call(s.url_converter_scope || t, v, n, e); + + t.setAttrib(e, 'mce_' + n, v, 2); + } + + break; + } + + if (is(v) && v !== null && v.length !== 0) + e.setAttribute(n, '' + v, 2); + else + e.removeAttribute(n, 2); + }); + }, + + setAttribs : function(e, o) { + var t = this; + + return this.run(e, function(e) { + each(o, function(v, n) { + t.setAttrib(e, n, v); + }); + }); + }, + + // #endif + + getAttrib : function(e, n, dv) { + var v, t = this; + + e = t.get(e); + + if (!e) + return false; + + if (!is(dv)) + dv = ""; + + // Try the mce variant for these + if (/^(src|href|style)$/.test(n)) { + v = e.getAttribute("mce_" + n); + + if (v) + return v; + } + + v = e.getAttribute(n, 2); + + if (!v) { + switch (n) { + case 'class': + v = e.className; + break; + + default: + v = e.attributes[n]; + v = v && is(v.nodeValue) ? v.nodeValue : v; + } + } + + switch (n) { + case 'style': + v = v || e.style.cssText; + + if (v) { + v = t.serializeStyle(t.parseStyle(v)); + + if (t.settings.keep_values) + e.setAttribute('mce_style', v); + } + + break; + } + + // Remove Apple and WebKit stuff + if (isWebKit && n === "class" && v) + v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, ''); + + // Handle IE issues + if (isIE) { + switch (n) { + case 'rowspan': + case 'colspan': + // IE returns 1 as default value + if (v === 1) + v = ''; + + break; + + case 'size': + // IE returns +0 as default value for size + if (v === '+0') + v = ''; + + break; + + case 'hspace': + // IE returns -1 as default value + if (v === -1) + v = ''; + + break; + + case 'tabindex': + // IE returns 32768 as default value + if (v === 32768) + v = ''; + + break; + + default: + // IE has odd anonymous function for event attributes + if (n.indexOf('on') === 0 && v) + v = ('' + v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/, '$1'); + } + } + + return (v && v != '') ? '' + v : dv; + }, + + getPos : function(n) { + var t = this, x = 0, y = 0, e, d = t.doc; + + n = t.get(n); + + // Use getBoundingClientRect on IE, Opera has it but it's not perfect + if (n && isIE) { + n = n.getBoundingClientRect(); + e = t.boxModel ? d.documentElement : d.body; + x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border + x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x; + n.top += window.self != window.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset + + return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x}; + } + + while (n) { + x += n.offsetLeft || 0; + y += n.offsetTop || 0; + x -= n.scrollLeft || 0; + y -= n.scrollTop || 0; + n = n.offsetParent; + } + + return {x : x, y : y}; + }, + + parseStyle : function(st) { + var t = this, s = t.settings, o = {}; + + if (!st) + return o; + + function compress(p, s, ot) { + var t, r, b, l; + + // Get values and check it it needs compressing + t = o[p + '-top' + s]; + if (!t) + return; + + r = o[p + '-right' + s]; + if (t != r) + return; + + b = o[p + '-bottom' + s]; + if (r != b) + return; + + l = o[p + '-left' + s]; + if (b != l) + return; + + // Compress + o[ot] = l; + delete o[p + '-top' + s]; + delete o[p + '-right' + s]; + delete o[p + '-bottom' + s]; + delete o[p + '-left' + s]; + }; + + function compress2(ta, a, b, c) { + var t; + + t = o[a]; + if (!t) + return; + + t = o[b]; + if (!t) + return; + + t = o[c]; + if (!t) + return; + + // Compress + o[ta] = o[a] + ' ' + o[b] + ' ' + o[c]; + delete o[a]; + delete o[b]; + delete o[c]; + }; + + each(st.split(';'), function(v) { + var sv, ur = []; + + if (v) { + v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';}); + v = v.split(':'); + sv = tinymce.trim(v[1]); + sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];}); + + sv = sv.replace(/rgb\([^\)]+\)/g, function(v) { + return t.toHex(v); + }); + + if (s.url_converter) { + sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) { + return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null)) + ')'; + }); + } + + o[tinymce.trim(v[0]).toLowerCase()] = sv; + } + }); + + compress("border", "", "border"); + compress("border", "-width", "border-width"); + compress("border", "-color", "border-color"); + compress("border", "-style", "border-style"); + compress("padding", "", "padding"); + compress("margin", "", "margin"); + compress2('border', 'border-width', 'border-style', 'border-color'); + + return o; + }, + + serializeStyle : function(o) { + var s = ''; + + each(o, function(v, k) { + if (k && v) { + switch (k) { + case 'color': + case 'background-color': + v = v.toLowerCase(); + break; + } + + s += (s ? ' ' : '') + k + ': ' + v + ';'; + } + }); + + return s; + }, + + loadCSS : function(u) { + var t = this, d = this.doc; + + if (!u) + u = ''; + + each(u.split(','), function(u) { + if (t.files[u]) + return; + + t.files[u] = true; + + if (!d.createStyleSheet) + t.add(t.select('head')[0], 'link', {rel : 'stylesheet', href : u}); + else + d.createStyleSheet(u); + }); + }, + + // #if !jquery + + addClass : function(e, c) { + return this.run(e, function(e) { + var o; + + if (!c) + return 0; + + if (this.hasClass(e, c)) + return e.className; + + o = this.removeClass(e, c); + + return e.className = (o != '' ? (o + ' ') : '') + c; + }); + }, + + removeClass : function(e, c) { + var t = this, re; + + return t.run(e, function(e) { + var v; + + if (t.hasClass(e, c)) { + if (!re) + re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g"); + + v = e.className.replace(re, ' '); + + return e.className = tinymce.trim(v != ' ' ? v : ''); + } + + return e.className; + }); + }, + + hasClass : function(n, c) { + n = this.get(n); + + if (!n || !c) + return false; + + return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1; + }, + + show : function(e) { + return this.setStyle(e, 'display', 'block'); + }, + + hide : function(e) { + return this.setStyle(e, 'display', 'none'); + }, + + isHidden : function(e) { + e = this.get(e); + + return e.style.display == 'none' || this.getStyle(e, 'display') == 'none'; + }, + + // #endif + + uniqueId : function(p) { + return (!p ? 'mce_' : p) + (this.counter++); + }, + + setHTML : function(e, h) { + var t = this; + + return this.run(e, function(e) { + var r; + + h = t.processHTML(h); + + if (isIE) { + e.innerHTML = '
    ' + h; + e.removeChild(e.firstChild); + } else + e.innerHTML = h; + + return h; + }); + }, + + processHTML : function(h) { + var t = this, s = t.settings; + + // Convert strong and em to b and i in FF since it can't handle them + if (tinymce.isGecko) { + h = h.replace(/<(\/?)strong>|]+)>/gi, '<$1b$2>'); + h = h.replace(/<(\/?)em>|]+)>/gi, '<$1i$2>'); + } + + // Fix some issues + h = h.replace(/<(a)([^>]*)\/>/gi, '<$1$2>'); // Force open + + // Store away src and href in mce_src and mce_href since browsers mess them up + if (s.keep_values) { + // Wrap scripts in comments for serialization purposes + if (h.indexOf('/g, ''); +'); - - if (tinyMCE.getParam("popups_css_add")) { - c = tinyMCE.getParam("popups_css_add"); - - // Is relative - if (c.indexOf('://') == -1 && c.charAt(0) != '/') - c = tinyMCE.documentBasePath + "/" + c; - - document.write(''); - } - - tinyMCE.addEvent(window, "load", this.onLoad); - }, - - onLoad : function() { - var dir, i, elms, body = document.body; - - if (tinyMCE.getWindowArg('mce_replacevariables', true)) - body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs); - - dir = tinyMCE.selectedInstance.settings.directionality; - if (dir == "rtl" && document.forms && document.forms.length > 0) { - elms = document.forms[0].elements; - for (i=0; i=0; i--) { - if (wrapper.hasChildNodes()) - wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); - else - wrapper.appendChild(nodes[i].cloneNode(true)); - - nodes[i].parentNode.removeChild(nodes[i]); - } - - // Add wrapper - doc.body.appendChild(wrapper); - - // Create iframe - iframe = document.createElement("iframe"); - iframe.id = "mcWinIframe"; - iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document; - iframe.width = "100%"; - iframe.height = "100%"; - iframe.style.margin = '0'; - - // Add iframe - doc.body.appendChild(iframe); - - // Measure iframe - iframe = document.getElementById('mcWinIframe'); - dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth; - dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight; - - // Resize window - // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy); - window.resizeBy(dx, dy); - - // Hide iframe and show wrapper - body.style.margin = oldMargin; - iframe.style.display = 'none'; - wrapper.style.display = 'block'; - } + if (t.isWindow) + window.resizeBy(dw, dh); + else + t.editor.windowManager.resizeBy(dw, dh, t.id); }, - resizeToContent : function() { - var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); - var isOpera = (navigator.userAgent.indexOf("Opera") != -1); - var elm, width, height, x, y, dx, dy; - - if (isOpera) - return; - - if (isMSIE) { - try { window.resizeTo(10, 10); } catch (e) {} - - elm = document.body; - width = elm.offsetWidth; - height = elm.offsetHeight; - dx = (elm.scrollWidth - width) + 4; - dy = elm.scrollHeight - height; - - try { window.resizeBy(dx, dy); } catch (e) {} - } else { - window.scrollBy(1000, 1000); - if (window.scrollX > 0 || window.scrollY > 0) { - window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); - window.sizeToContent(); - window.scrollTo(0, 0); - x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); - y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); - window.moveTo(x, y); - } - } + executeOnLoad : function(s) { + this.onInit.add(function() { + eval(s); + }); }, - getWindowArg : function(name, default_value) { - return tinyMCE.getWindowArg(name, default_value); + storeSelection : function() { + this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple'); }, restoreSelection : function() { - var inst; + var t = tinyMCEPopup; - if (this.storeSelection) { - inst = tinyMCE.selectedInstance; - - inst.getWin().focus(); - - if (inst.selectionBookmark) - inst.selection.moveToBookmark(inst.selectionBookmark); - } + if (!t.isWindow && tinymce.isIE) + t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark); }, - execCommand : function(command, user_interface, value) { - var inst = tinyMCE.selectedInstance; + requireLangPack : function() { + var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url'); - this.restoreSelection(); - inst.execCommand(command, user_interface, value); - - // Store selection - if (this.storeSelection) - inst.selectionBookmark = inst.selection.getBookmark(true); - }, - - close : function() { - tinyMCE.closeWindow(window); + if (u) + document.write(''); }, pickColor : function(e, element_id) { - tinyMCE.selectedInstance.execCommand('mceColorPicker', true, { - element_id : element_id, - document : document, - window : window, - store_selection : false + this.execCommand('mceColorPicker', true, { + color : document.getElementById(element_id).value, + func : function(c) { + document.getElementById(element_id).value = c; + + if (tinymce.is(document.getElementById(element_id).onchange, 'function')) + document.getElementById(element_id).onchange(); + } }); }, openBrowser : function(element_id, type, option) { - var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); - var url = document.getElementById(element_id).value; - - tinyMCE.setWindowArg("window", window); - tinyMCE.setWindowArg("document", document); - - // Call to external callback - if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined") - alert("Callback function: " + cb + " could not be found."); - else - eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);"); + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); }, - importClass : function(c) { - var n; + close : function() { + var t = this; - window[c] = function() {}; + t.dom = t.dom.doc = null; // Cleanup + t.editor.windowManager.close(window, t.id); + }, - for (n in window.opener[c].prototype) - window[c].prototype[n] = window.opener[c].prototype[n]; + // Internal functions - window[c].constructor = window.opener[c].constructor; + _restoreSelection : function() { + var e = window.event.srcElement; + + if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) + tinyMCEPopup.restoreSelection(); + }, + +/* _restoreSelection : function() { + var e = window.event.srcElement; + + // If user focus a non text input or textarea + if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') + tinyMCEPopup.restoreSelection(); + },*/ + + _onDOMLoaded : function() { + var t = this, ti = document.title, bm, h; + + // Translate page + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^\s>]+)/gi, ' $1="$2"'); + + document.body.innerHTML = t.editor.translate(h); + document.title = ti = t.editor.translate(ti); + document.body.style.display = ''; + + // Restore selection in IE when focus is placed on a non textarea or input element of the type text + if (tinymce.isIE) + document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); + + t.restoreSelection(); + + // Call onInit + tinymce.each(t.listeners, function(o) { + o.func.call(o.scope, t.editor); + }); + + t.resizeToInnerSize(); + + if (t.isWindow) + window.focus(); + else + t.editor.windowManager.setTitle(ti, t.id); + + if (!tinymce.isIE && !t.isWindow) { + tinymce.dom.Event._add(document, 'focus', function() { + t.editor.windowManager.focus(t.id) + }); + } + + // Patch for accessibility + tinymce.each(t.dom.select('select'), function(e) { + e.onkeydown = tinyMCEPopup._accessHandler; + }); + + // Move focus to window + window.focus(); + }, + + _accessHandler : function(e) { + var e = e || window.event; + + if (e.keyCode == 13 || e.keyCode == 32) { + e = e.target || e.srcElement; + + if (e.onchange) + e.onchange(); + + return tinymce.dom.Event.cancel(e); + } + }, + + _wait : function() { + var t = this, ti; + + if (tinymce.isIE && document.location.protocol != 'https:') { + // Fake DOMContentLoaded on IE + document.write('