Changeset 6632

Show
Ignore:
Timestamp:
01/17/08 15:44:05 (8 months ago)
Author:
ryan
Message:

TinyMCE 3.0 RC1. First cut, eexpect regressions. Props azaozz. see #5674

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/formatting.php

    r6613 r6632  
    6868    $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 
    6969    $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 
     70    if ( strpos($pee, '<object') !== false ) { 
     71        $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed 
     72        $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee); 
     73    } 
    7074    $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 
    7175    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
  • trunk/wp-includes/general-template.php

    r6609 r6632  
    953953    <script type="text/javascript"> 
    954954    // <![CDATA[ 
    955         if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0
     955        if ( typeof tinyMCE != "undefined"
    956956            document.getElementById('editor-toolbar').style.display = 'block'; 
    957957    // ]]> 
     
    968968    <script type="text/javascript"> 
    969969    // <![CDATA[ 
    970         if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0
     970        if ( typeof tinyMCE != "undefined"
    971971            document.getElementById("quicktags").style.display="none"; 
    972972    // ]]> 
  • trunk/wp-includes/js/tinymce/langs/en.js

    r4747 r6632  
    1 // UK lang variables 
    2  
    3 tinyMCE.addToLang('',{ 
    4 bold_desc : 'Bold (Ctrl+B)', 
    5 italic_desc : 'Italic (Ctrl+I)', 
    6 underline_desc : 'Underline (Ctrl+U)', 
    7 striketrough_desc : 'Strikethrough', 
    8 justifyleft_desc : 'Align left', 
    9 justifycenter_desc : 'Align center', 
    10 justifyright_desc : 'Align right', 
    11 justifyfull_desc : 'Align full', 
    12 bullist_desc : 'Unordered list', 
    13 numlist_desc : 'Ordered list', 
    14 outdent_desc : 'Outdent', 
    15 indent_desc : 'Indent', 
    16 undo_desc : 'Undo (Ctrl+Z)', 
    17 redo_desc : 'Redo (Ctrl+Y)', 
    18 link_desc : 'Insert/edit link', 
    19 unlink_desc : 'Unlink', 
    20 image_desc : 'Insert/edit image', 
    21 cleanup_desc : 'Cleanup messy code', 
    22 focus_alert : 'A editor instance must be focused before using this command.', 
    23 edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?', 
    24 insert_link_title : 'Insert/edit link', 
    25 insert : 'Insert', 
    26 update : 'Update', 
    27 cancel : 'Cancel', 
    28 insert_link_url : 'Link URL', 
    29 insert_link_target : 'Target', 
    30 insert_link_target_same : 'Open link in the same window', 
    31 insert_link_target_blank : 'Open link in a new window', 
    32 insert_image_title : 'Insert/edit image', 
    33 insert_image_src : 'Image URL', 
    34 insert_image_alt : 'Image description', 
    35 help_desc : 'Help', 
    36 bold_img : "bold.gif", 
    37 italic_img : "italic.gif", 
    38 underline_img : "underline.gif", 
    39 clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?', 
    40 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.' 
    41 }); 
     1tinyMCE.addI18n({en:{ 
     2common:{ 
     3edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?", 
     4apply:"Apply", 
     5insert:"Insert", 
     6update:"Update", 
     7cancel:"Cancel", 
     8close:"Close", 
     9browse:"Browse", 
     10class_name:"Class", 
     11not_set:"-- Not set --", 
     12clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?", 
     13clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.", 
     14popup_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.", 
     15invalid_data:"Error: Invalid values entered, these are marked in red.", 
     16more_colors:"More colors" 
     17}, 
     18contextmenu:{ 
     19align:"Alignment", 
     20left:"Left", 
     21center:"Center", 
     22right:"Right", 
     23full:"Full" 
     24}, 
     25insertdatetime:{ 
     26date_fmt:"%Y-%m-%d", 
     27time_fmt:"%H:%M:%S", 
     28insertdate_desc:"Insert date", 
     29inserttime_desc:"Insert time", 
     30months_long:"January,February,March,April,May,June,July,August,September,October,November,December", 
     31months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", 
     32day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", 
     33day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" 
     34}, 
     35print:{ 
     36print_desc:"Print" 
     37}, 
     38preview:{ 
     39preview_desc:"Preview" 
     40}, 
     41directionality:{ 
     42ltr_desc:"Direction left to right", 
     43rtl_desc:"Direction right to left" 
     44}, 
     45layer:{ 
     46insertlayer_desc:"Insert new layer", 
     47forward_desc:"Move forward", 
     48backward_desc:"Move backward", 
     49absolute_desc:"Toggle absolute positioning", 
     50content:"New layer..." 
     51}, 
     52save:{ 
     53save_desc:"Save", 
     54cancel_desc:"Cancel all changes" 
     55}, 
     56nonbreaking:{ 
     57nonbreaking_desc:"Insert non-breaking space character" 
     58}, 
     59iespell:{ 
     60iespell_desc:"Run spell checking", 
     61download:"ieSpell not detected. Do you want to install it now?" 
     62}, 
     63advhr:{ 
     64advhr_desc:"Horizontale rule" 
     65}, 
     66emotions:{ 
     67emotions_desc:"Emotions" 
     68}, 
     69searchreplace:{ 
     70search_desc:"Find", 
     71replace_desc:"Find/Replace" 
     72}, 
     73advimage:{ 
     74image_desc:"Insert/edit image" 
     75}, 
     76advlink:{ 
     77link_desc:"Insert/edit link" 
     78}, 
     79xhtmlxtras:{ 
     80cite_desc:"Citation", 
     81abbr_desc:"Abbreviation", 
     82acronym_desc:"Acronym", 
     83del_desc:"Deletion", 
     84ins_desc:"Insertion", 
     85attribs_desc:"Insert/Edit Attributes" 
     86}, 
     87style:{ 
     88desc:"Edit CSS Style" 
     89}, 
     90paste:{ 
     91paste_text_desc:"Paste as Plain Text", 
     92paste_word_desc:"Paste from Word", 
     93selectall_desc:"Select All" 
     94}, 
     95paste_dlg:{ 
     96text_title:"Use CTRL+V on your keyboard to paste the text into the window.", 
     97text_linebreaks:"Keep linebreaks", 
     98word_title:"Use CTRL+V on your keyboard to paste the text into the window." 
     99}, 
     100table:{ 
     101desc:"Inserts a new table", 
     102row_before_desc:"Insert row before", 
     103row_after_desc:"Insert row after", 
     104delete_row_desc:"Delete row", 
     105col_before_desc:"Insert column before", 
     106col_after_desc:"Insert column after", 
     107delete_col_desc:"Remove column", 
     108split_cells_desc:"Split merged table cells", 
     109merge_cells_desc:"Merge table cells", 
     110row_desc:"Table row properties", 
     111cell_desc:"Table cell properties", 
     112props_desc:"Table properties", 
     113paste_row_before_desc:"Paste table row before", 
     114paste_row_after_desc:"Paste table row after", 
     115cut_row_desc:"Cut table row", 
     116copy_row_desc:"Copy table row", 
     117del:"Delete table", 
     118row:"Row", 
     119col:"Column", 
     120cell:"Cell" 
     121}, 
     122autosave:{ 
     123unload_msg:"The changes you made will be lost if you navigate away from this page." 
     124}, 
     125fullscreen:{ 
     126desc:"Toggle fullscreen mode" 
     127}, 
     128media:{ 
     129desc:"Insert / edit embedded media", 
     130edit:"Edit embedded media" 
     131}, 
     132fullpage:{ 
     133desc:"Document properties" 
     134}, 
     135template:{ 
     136desc:"Insert predefined template content" 
     137}, 
     138visualchars:{ 
     139desc:"Visual control characters on/off." 
     140}, 
     141spellchecker:{ 
     142desc:"Toggle spellchecker", 
     143menu:"Spellchecker settings", 
     144ignore_word:"Ignore word", 
     145ignore_words:"Ignore all", 
     146langs:"Languages", 
     147wait:"Please wait...", 
     148sug:"Suggestions", 
     149no_sug:"No suggestions", 
     150no_mpell:"No misspellings found." 
     151}, 
     152pagebreak:{ 
     153desc:"Insert page break." 
     154}}}); 
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js

    r5256 r6632  
    11/** 
    2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke
     2 * $Id
    33 * 
    44 * @author Moxiecode 
    5  * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. 
     5 * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    66 */ 
    77 
    8 /* Import plugin specific language pack */ 
    9 tinyMCE.importPluginLanguagePack('autosave'); 
     8(function() { 
     9    tinymce.create('tinymce.plugins.AutoSavePlugin', { 
     10        init : function(ed, url) { 
     11            var t = this; 
    1012 
    11 var TinyMCE_AutoSavePlugin = { 
    12     getInfo : function() { 
    13         return { 
    14             longname : 'Auto save', 
    15             author : 'Moxiecode Systems AB', 
    16             authorurl : 'http://tinymce.moxiecode.com', 
    17             infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', 
    18             version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    19         }; 
    20     }, 
     13            t.editor = ed; 
    2114 
    22     // Private plugin internal methods 
     15            window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; 
     16        }, 
    2317 
    24     _beforeUnloadHandler : function() { 
    25         var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg"); 
     18        getInfo : function() { 
     19            return { 
     20                longname : 'Auto save', 
     21                author : 'Moxiecode Systems AB', 
     22                authorurl : 'http://tinymce.moxiecode.com', 
     23                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', 
     24                version : tinymce.majorVersion + "." + tinymce.minorVersion 
     25            }; 
     26        }, 
    2627 
    27         if (tinyMCE.getParam("fullscreen_is_enabled")) 
    28             return; 
     28        // Private plugin internal methods 
    2929 
    30         for (n in tinyMCE.instances) { 
    31             inst = tinyMCE.instances[n]; 
     30        'static' : { 
     31            _beforeUnloadHandler : function() { 
     32                var msg; 
    3233 
    33             if (!tinyMCE.isInstance(inst)) 
    34                 continue; 
     34                tinymce.each(tinyMCE.editors, function(ed) { 
     35                    if (ed.getParam("fullscreen_is_enabled")) 
     36                        return; 
    3537 
    36             if (inst.isDirty()) 
     38                    if (ed.isDirty()) { 
     39                        msg = ed.getLang("autosave.unload_msg"); 
     40                        return false; 
     41                    } 
     42                }); 
     43 
    3744                return msg; 
     45            } 
    3846        } 
     47    }); 
    3948 
    40         return; 
    41     } 
    42 }; 
    43  
    44 window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler; 
    45  
    46 tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin); 
     49    // Register plugin 
     50    tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); 
     51})(); 
  • trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js

    r5256 r6632  
    11/** 
    2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 
     2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 
    33 * 
    44 * @author Moxiecode 
    5  * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. 
     5 * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    66 */ 
    77 
    8 /* Import plugin specific language pack */ 
    9 tinyMCE.importPluginLanguagePack('directionality'); 
     8(function() { 
     9    tinymce.create('tinymce.plugins.Directionality', { 
     10        init : function(ed, url) { 
     11            var t = this; 
    1012 
    11 var TinyMCE_DirectionalityPlugin = { 
    12     getInfo : function() { 
    13         return { 
    14             longname : 'Directionality', 
    15             author : 'Moxiecode Systems AB', 
    16             authorurl : 'http://tinymce.moxiecode.com', 
    17             infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', 
    18             version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    19         }; 
    20     }, 
     13            t.editor = ed; 
    2114 
    22     getControlHTML : function(cn) { 
    23         switch (cn) { 
    24             case "ltr": 
    25                 return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR'); 
     15            ed.addCommand('mceDirectionLTR', function() { 
     16                var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); 
    2617 
    27             case "rtl": 
    28                 return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL'); 
     18                if (e) { 
     19                    if (ed.dom.getAttrib(e, "dir") != "ltr") 
     20                        ed.dom.setAttrib(e, "dir", "ltr"); 
     21                    else 
     22                        ed.dom.setAttrib(e, "dir", ""); 
     23                } 
     24 
     25                ed.nodeChanged(); 
     26            }); 
     27 
     28            ed.addCommand('mceDirectionRTL', function() { 
     29                var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); 
     30 
     31                if (e) { 
     32                    if (ed.dom.getAttrib(e, "dir") != "rtl") 
     33                        ed.dom.setAttrib(e, "dir", "rtl"); 
     34                    else 
     35                        ed.dom.setAttrib(e, "dir", ""); 
     36                } 
     37 
     38                ed.nodeChanged(); 
     39            }); 
     40 
     41            ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); 
     42            ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); 
     43 
     44            ed.onNodeChange.add(t._nodeChange, t); 
     45        }, 
     46 
     47        getInfo : function() { 
     48            return { 
     49                longname : 'Directionality', 
     50                author : 'Moxiecode Systems AB', 
     51                authorurl : 'http://tinymce.moxiecode.com', 
     52                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', 
     53                version : tinymce.majorVersion + "." + tinymce.minorVersion 
     54            }; 
     55        }, 
     56 
     57        // Private methods 
     58 
     59        _nodeChange : function(ed, cm, n) { 
     60            var dom = ed.dom, dir; 
     61 
     62            n = dom.getParent(n, dom.isBlock); 
     63            if (!n) { 
     64                cm.setDisabled('ltr', 1); 
     65                cm.setDisabled('rtl', 1); 
     66                return; 
     67            } 
     68 
     69            dir = dom.getAttrib(n, 'dir'); 
     70            cm.setActive('ltr', dir == "ltr"); 
     71            cm.setDisabled('ltr', 0); 
     72            cm.setActive('rtl', dir == "rtl"); 
     73            cm.setDisabled('rtl', 0); 
    2974        } 
     75    }); 
    3076 
    31         return ""; 
    32     }, 
    33  
    34     execCommand : function(editor_id, element, command, user_interface, value) { 
    35         // Handle commands 
    36         switch (command) { 
    37             case "mceDirectionLTR": 
    38                 var inst = tinyMCE.getInstanceById(editor_id); 
    39                 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
    40  
    41                 if (elm) 
    42                     elm.setAttribute("dir", "ltr"); 
    43  
    44                 tinyMCE.triggerNodeChange(false); 
    45                 return true; 
    46  
    47             case "mceDirectionRTL": 
    48                 var inst = tinyMCE.getInstanceById(editor_id); 
    49                 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
    50  
    51                 if (elm) 
    52                     elm.setAttribute("dir", "rtl"); 
    53  
    54                 tinyMCE.triggerNodeChange(false); 
    55                 return true; 
    56         } 
    57  
    58         // Pass to next handler in chain 
    59         return false; 
    60     }, 
    61  
    62     handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 
    63         function getAttrib(elm, name) { 
    64             return elm.getAttribute(name) ? elm.getAttribute(name) : ""; 
    65         } 
    66  
    67         if (node == null) 
    68             return; 
    69  
    70         var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
    71         if (!elm) { 
    72             tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled'); 
    73             tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled'); 
    74             return true; 
    75         } 
    76  
    77         tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal'); 
    78         tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal'); 
    79  
    80         var dir = getAttrib(elm, "dir"); 
    81         if (dir == "ltr" || dir == "") 
    82             tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected'); 
    83         else 
    84             tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected'); 
    85  
    86         return true; 
    87     } 
    88 }; 
    89  
    90 tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin); 
     77    // Register plugin 
     78    tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); 
     79})(); 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css

    • Property svn:eol-style set to native
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r6568 r6632  
    11/** 
    2  * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $ 
    3  * 
    4  * Moxiecode DHTML Windows script. 
     2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 
    53 * 
    64 * @author Moxiecode 
    7  * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. 
     5 * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    86 */ 
    97 
    10 // Patch openWindow, closeWindow TinyMCE functions 
    11  
    12 var TinyMCE_InlinePopupsPlugin = { 
    13     getInfo : function() { 
    14         return { 
    15             longname : 'Inline Popups', 
    16             author : 'Moxiecode Systems AB', 
    17             authorurl : 'http://tinymce.moxiecode.com', 
    18             infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', 
    19             version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    20         }; 
    21     } 
    22 }; 
    23  
    24 tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin); 
    25  
    26 // Patch openWindow, closeWindow TinyMCE functions 
    27  
    28 TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow; 
    29 TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; 
    30  
    31 TinyMCE_Engine.prototype.openWindow = function(template, args) { 
    32     // Does the caller support inline 
    33     if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) { 
    34         mcWindows.selectedWindow = null; 
    35         args['mce_inside_iframe'] = false; 
    36         this.orgOpenWindow(template, args); 
    37         return; 
    38     } 
    39  
    40     var url, resizable, scrollbars; 
    41  
    42     args['mce_inside_iframe'] = true; 
    43     tinyMCE.windowArgs = args; 
    44  
    45     if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1) 
    46         url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file']; 
    47     else 
    48         url = template['file']; 
    49  
    50     if (!(width = parseInt(template['width']))) 
    51         width = 320; 
    52  
    53     if (!(height = parseInt(template['height']))) 
    54         height = 200; 
    55  
    56     if (!(minWidth = parseInt(template['minWidth']))) 
    57         minWidth = 100; 
    58  
    59     if (!(minHeight = parseInt(template['minHeight']))) 
    60         minHeight = 100; 
    61  
    62     resizable = (args && args['resizable']) ? args['resizable'] : "no"; 
    63     scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; 
    64  
    65     height += 18; 
    66  
    67     // Replace all args as variables in URL 
    68     for (var name in args) { 
    69         if (typeof(args[name]) == 'function') 
    70             continue; 
    71  
    72         url = tinyMCE.replaceVar(url, name, escape(args[name])); 
    73     } 
    74  
    75     var elm = document.getElementById(this.selectedInstance.editorId + '_parent'); 
    76  
    77     if (tinyMCE.hasPlugin('fullscreen') && this.selectedInstance.getData('fullscreen').enabled) 
    78         pos = { absLeft: 0, absTop: 0 }; 
    79     else 
    80         pos = tinyMCE.getAbsPosition(elm); 
    81  
    82     // Center div in editor area 
    83     pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2)); 
    84     pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2)); 
     8(function() { 
     9    var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; 
     10 
     11    tinymce.create('tinymce.plugins.InlinePopups', { 
     12        init : function(ed, url) { 
     13            // Replace window manager 
     14            ed.onBeforeRenderUI.add(function() { 
     15                ed.windowManager = new tinymce.InlineWindowManager(ed); 
     16                DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css"); 
     17            }); 
     18        }, 
     19 
     20        getInfo : function() { 
     21            return { 
     22                longname : 'InlinePopups', 
     23                author : 'Moxiecode Systems AB', 
     24                authorurl : 'http://tinymce.moxiecode.com', 
     25                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', 
     26                version : tinymce.majorVersion + "." + tinymce.minorVersion 
     27            }; 
     28        } 
     29    }); 
     30 
     31    tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', { 
     32        InlineWindowManager : function(ed) { 
     33            var t = this; 
     34 
     35            t.parent(ed); 
     36            t.zIndex = 1000; 
     37        }, 
     38 
     39        open : function(f, p) { 
     40            var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w; 
     41 
     42            f = f || {}; 
     43            p = p || {}; 
     44 
     45            // Run native windows 
     46            if (!f.inline) 
     47                return t.parent(f, p); 
     48 
     49            t.bookmark = ed.selection.getBookmark('simple'); 
     50            id = DOM.uniqueId(); 
     51            vp = DOM.getViewPort(); 
     52            f.width = parseInt(f.width || 320); 
     53            f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); 
     54            f.min_width = parseInt(f.min_width || 150); 
     55            f.min_height = parseInt(f.min_height || 100); 
     56            f.max_width = parseInt(f.max_width || 2000); 
     57            f.max_height = parseInt(f.max_height || 2000); 
     58            f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0))); 
     59            f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0))); 
     60            f.movable = f.resizable = true; 
     61            p.mce_width = f.width; 
     62            p.mce_height = f.height; 
     63            p.mce_inline = true; 
     64            p.mce_window_id = id; 
     65 
     66            // Transpose 
     67//          po = DOM.getPos(ed.getContainer()); 
     68//          f.left -= po.x; 
     69//          f.top -= po.y; 
     70 
     71            t.features = f; 
     72            t.params = p; 
     73            t.onOpen.dispatch(t, f, p); 
     74 
     75            if (f.type) { 
     76                opt += ' modal ' + f.type; 
     77                f.resizable = false; 
     78            } 
     79 
     80            if (f.statusbar) 
     81                opt += ' statusbar'; 
     82 
     83            if (f.resizable) 
     84                opt += ' resizable'; 
     85 
     86            if (f.minimizable) 
     87                opt += ' minimizable'; 
     88 
     89            if (f.maximizable) 
     90                opt += ' maximizable'; 
     91 
     92            if (f.movable) 
     93                opt += ' movable'; 
     94 
     95            // Create DOM objects 
     96            t._addAll(document.body,  
     97                ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'},  
     98                    ['div', {id : id + '_wrapper', 'class' : 'wrapper' + opt}, 
     99                        ['div', {id : id + '_top', 'class' : 'top'},  
     100                            ['div', {'class' : 'left'}], 
     101                            ['div', {'class' : 'center'}], 
     102                            ['div', {'class' : 'right'}], 
     103                            ['span', {id : id + '_title'}, f.title || ''] 
     104                        ], 
     105 
     106                        ['div', {id : id + '_middle', 'class' : 'middle'},  
     107                            ['div', {id : id + '_left', 'class' : 'left'}], 
     108                            ['span', {id : id + '_content'}], 
     109                            ['div', {id : id + '_right', 'class' : 'right'}] 
     110                        ], 
     111 
     112                        ['div', {id : id + '_bottom', 'class' : 'bottom'}, 
     113                            ['div', {'class' : 'left'}], 
     114                            ['div', {'class' : 'center'}], 
     115                            ['div', {'class' : 'right'}], 
     116                            ['span', {id : id + '_status'}, 'Content'] 
     117                        ], 
     118 
     119                        ['a', {'class' : 'move', href : 'javascript:;'}], 
     120                        ['a', {'class' : 'min', href : 'javascript:;', onmousedown : 'return false;'}], 
     121                        ['a', {'class' : 'max', href : 'javascript:;', onmousedown : 'return false;'}], 
     122                        ['a', {'class' : 'med', href : 'javascript:;', onmousedown : 'return false;'}], 
     123                        ['a', {'class' : 'close', href : 'javascript:;', onmousedown : 'return false;'}], 
     124                        ['a', {id : id + '_resize_n', 'class' : 'resize resize-n', href : 'javascript:;'}], 
     125                        ['a', {id : id + '_resize_s', 'class' : 'resize resize-s', href : 'javascript:;'}], 
     126                        ['a', {id : id + '_resize_w', 'class' : 'resize resize-w', href : 'javascript:;'}], 
     127                        ['a', {id : id + '_resize_e', 'class' : 'resize resize-e', href : 'javascript:;'}], 
     128                        ['a', {id : id + '_resize_nw', 'class' : 'resize resize-nw', href : 'javascript:;'}], 
     129                        ['a', {id : id + '_resize_ne', 'class' : 'resize resize-ne', href : 'javascript:;'}], 
     130                        ['a', {id : id + '_resize_sw', 'class' : 'resize resize-sw', href : 'javascript:;'}], 
     131                        ['a', {id : id + '_resize_se', 'class' : 'resize resize-se', href : 'javascript:;'}] 
     132                    ] 
     133                ] 
     134            ); 
     135 
     136            DOM.setStyles(id, {top : -10000, left : -10000}); 
     137 
     138            // Fix gecko rendering bug, where the editors iframe messed with window contents 
     139            if (tinymce.isGecko) 
     140                DOM.setStyle(id, 'overflow', 'auto'); 
     141 
     142            // Measure borders 
     143            if (!f.type) { 
     144                dw += DOM.get(id + '_left').clientWidth; 
     145                dw += DOM.get(id + '_right').clientWidth; 
     146                dh += DOM.get(id + '_top').clientHeight; 
     147                dh += DOM.get(id + '_bottom').clientHeight; 
     148            } 
     149 
     150            // Resize window 
     151            DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh}); 
     152 
     153            if (!f.type) { 
     154                DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'}); 
     155                DOM.setStyles(id + '_ifr', {width : f.width, height : f.height}); 
     156                DOM.setAttrib(id + '_ifr', 'src', f.url || f.file); 
     157            } else { 
     158                DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'button ok', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok'); 
     159 
     160                if (f.type == 'confirm') 
     161                    DOM.add(id + '_wrapper', 'a', {'class' : 'button cancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel'); 
     162 
     163                DOM.add(id + '_middle', 'div', {'class' : 'icon'}); 
     164                DOM.setHTML(id + '_content', f.content.replace('\n', '<br />')); 
     165            } 
     166 
     167            // Register events 
     168            mdf = Event.add(id, 'mousedown', function(e) { 
     169                var n = e.target, w, vp; 
     170 
     171                w = t.windows[id]; 
     172                t.focus(id); 
     173 
     174                if (n.nodeName == 'A' || n.nodeName == 'a') { 
     175                    if (n.className == 'max') { 
     176                        w.oldPos = w.element.getXY(); 
     177                        w.oldSize = w.element.getSize(); 
     178 
     179                        vp = DOM.getViewPort(); 
     180 
     181                        // Reduce viewport size to avoid scrollbars 
     182                        vp.w -= 2; 
     183