Changeset 6694

Show
Ignore:
Timestamp:
01/31/08 18:10:46 (8 months ago)
Author:
ryan
Message:

TinyMCE 3.0 Final from azaozz. see #5674

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/js/post.js

    r6675 r6694  
    179179    jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); 
    180180}); 
     181 
     182wpEditorInit = function() { 
     183    // Activate tinyMCE if it's the user's default editor 
     184    if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) { 
     185        document.getElementById('editorcontainer').style.padding = '0px'; 
     186        tinyMCE.execCommand("mceAddControl", true, "content"); 
     187    } else { 
     188        var H; 
     189        if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )  
     190            document.getElementById('content').style.height = H.ch - 30 + 'px'; 
     191    } 
     192}; 
     193 
     194switchEditors = { 
     195     
     196    saveCallback : function(el, content, body) { 
     197     
     198        document.getElementById(el).style.color = '#fff'; 
     199        if ( tinyMCE.activeEditor.isHidden() )  
     200            content = document.getElementById(el).value; 
     201        else 
     202            content = this.pre_wpautop(content); 
     203 
     204        return content; 
     205    }, 
     206 
     207    pre_wpautop : function(content) { 
     208       // We have a TON of cleanup to do. 
     209 
     210        // content = content.replace(/\n|\r/g, ' '); 
     211        // Remove anonymous, empty paragraphs. 
     212        content = content.replace(new RegExp('<p>(\\s|&nbsp;|<br>)*</p>', 'mg'), ''); 
     213 
     214        // Mark </p> if it has any attributes. 
     215        content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>'); 
     216 
     217        // Get it ready for wpautop. 
     218        content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 
     219        content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 
     220        content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 
     221        content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 
     222 
     223        // Fix some block element newline issues 
     224        var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre'; 
     225        content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 
     226        content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); 
     227        content = content.replace(new RegExp('<li>', 'g'), '\t<li>'); 
     228         
     229        if ( content.indexOf('<object') != -1 ) { 
     230            content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed 
     231            content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>'); 
     232        } 
     233         
     234        // Unmark special paragraph closing tags 
     235        content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 
     236        content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); 
     237 
     238        // Trim trailing whitespace 
     239        content = content.replace(new RegExp('\\s*$', ''), ''); 
     240 
     241        // Hope. 
     242        return content; 
     243    }, 
     244 
     245    go : function(id) { 
     246        var ed = tinyMCE.get(id); 
     247        var qt = document.getElementById('quicktags'); 
     248        var H = document.getElementById('edButtonHTML'); 
     249        var P = document.getElementById('edButtonPreview'); 
     250        var ta = document.getElementById(id); 
     251        var ec = document.getElementById('editorcontainer'); 
     252 
     253        if ( ! ed || ed.isHidden() ) { 
     254            ta.style.color = '#fff'; 
     255         
     256            this.edToggle(P, H); 
     257            edCloseAllTags(); // :-( 
     258 
     259            qt.style.display = 'none'; 
     260            ec.style.padding = '0px'; 
     261 
     262            ta.value = this.wpautop(ta.value); 
     263 
     264            if ( ed ) ed.show(); 
     265            else tinyMCE.execCommand("mceAddControl", false, id); 
     266         
     267            this.wpSetDefaultEditor( 'tinymce' ); 
     268        } else { 
     269            this.edToggle(H, P); 
     270            tinyMCE.triggerSave(); 
     271            ta.style.height = tinyMCE.activeEditor.contentAreaContainer.offsetHeight + 6 + 'px'; 
     272 
     273            if ( tinymce.isIE6 )  
     274                ta.style.width = tinyMCE.activeEditor.contentAreaContainer.offsetWidth - 12 + 'px'; 
     275 
     276            ed.hide(); 
     277            ta.value = this.pre_wpautop(ta.value); 
     278         
     279            qt.style.display = 'block'; 
     280            ec.style.padding = '6px'; 
     281            ta.style.color = ''; 
     282 
     283            this.wpSetDefaultEditor( 'html' ); 
     284        } 
     285    }, 
     286 
     287    edToggle : function(A, B) { 
     288        A.className = 'active'; 
     289        B.className = ''; 
     290 
     291        B.onclick = A.onclick; 
     292        A.onclick = null; 
     293    }, 
     294 
     295    wpSetDefaultEditor : function( editor ) { 
     296        try { 
     297            editor = escape( editor.toString() ); 
     298        } catch(err) { 
     299            editor = 'tinymce'; 
     300        } 
     301 
     302        var userID = document.getElementById('user-id'); 
     303        var date = new Date(); 
     304        date.setTime(date.getTime()+(10*365*24*60*60*1000)); 
     305        document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString(); 
     306    }, 
     307 
     308    wpautop : function(pee) { 
     309        var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]'; 
     310     
     311        pee = pee + "\n\n"; 
     312        pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 
     313        pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");  
     314        pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n"); 
     315        pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 
     316        pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 
     317        pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 
     318        pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 
     319        pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 
     320        pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 
     321        pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 
     322        pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>'); 
     323        pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1"); 
     324        pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");  
     325        pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 
     326        pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 
     327        pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 
     328        pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;'); 
     329        //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' "); // Hmm... 
     330        return pee; 
     331    } 
     332} 
  • trunk/wp-admin/wp-admin.css

    r6638 r6694  
    371371} 
    372372 
    373 #postdivrich #content { 
    374     padding: 5px; 
    375     line-height: 140%; 
     373#editorcontainer #content { 
     374    padding: 0; 
     375    line-height: 150%; 
     376    border: 0 none; 
     377
     378 
     379#editorcontainer { 
     380    padding: 6px; 
    376381} 
    377382 
     
    395400 
    396401#postdivrich #quicktags { 
    397     background: #f0f0ee; 
    398     padding: 0; 
    399     border: 1px solid #ccc; 
    400     border-bottom: none; 
     402    background: #cee1ef; 
     403    padding: 0; 
     404    border: 0 none; 
    401405} 
    402406 
     
    11791183} 
    11801184 
    1181 #poststuff .postbox, #titlediv
     1185#poststuff .postbox, #titlediv, #poststuff .postarea
    11821186    margin-left: 20px; 
    11831187    border: 1px solid #ebebeb; 
     
    11891193 
    11901194#poststuff .postarea { 
    1191     margin-left: 20px; 
    11921195    margin-right: 8px; 
    11931196} 
     
    12241227#poststuff #edButtonPreview, #poststuff #edButtonHTML { 
    12251228    display: block; 
    1226     height: 18px; 
     1229    height: 20px; 
    12271230    padding: 5px; 
    12281231    margin-right: 8px; 
     
    12361239    color: #333; 
    12371240    font-weight: bold; 
    1238     -moz-border-radius: 2px; 
     1241    -moz-border-radius-topright: 2px; 
     1242    -moz-border-radius-topleft: 2px; 
    12391243} 
    12401244 
  • trunk/wp-includes/general-template.php

    r6682 r6694  
    929929        $wp_default_editor = wp_default_editor(); 
    930930        $active = " class='active'"; 
    931         $inactive = " onclick='switchEditors(\"$id\");'"; 
     931        $inactive = " onclick='switchEditors.go(\"$id\");'"; 
    932932 
    933933        if ( 'tinymce' == $wp_default_editor ) 
    934934            add_filter('the_editor_content', 'wp_richedit_pre'); 
    935935 
    936         //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 
    937     ?> 
    938    <style type="text/css"> 
     936        //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.  
     937        ?>   
     938    <style type="text/css"> 
    939939        #postdivrich table, #postdivrich #quicktags {border-top: none;} 
    940940        #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} 
    941941    </style> 
     942     
    942943    <div id='editor-toolbar' style='display:none;'> 
    943         <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> 
     944        <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div> 
    944945        <a id='edButtonHTML'<?php echo 'html' == $wp_default_editor ? $active : $inactive; ?>><?php _e('HTML'); ?></a> 
    945946            <a id='edButtonPreview'<?php echo 'tinymce' == $wp_default_editor ? $active : $inactive; ?>><?php _e('Visual'); ?></a> 
     
    974975    <?php endif; // 'html' != $wp_default_editor 
    975976 
    976     $the_editor = apply_filters('the_editor', "<div><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); 
     977    $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); 
    977978    $the_editor_content = apply_filters('the_editor_content', $content); 
    978979 
     
    987988    if ( typeof tinyMCE != 'undefined' ) { 
    988989    // This code is meant to allow tabbing from Title to Post (TinyMCE). 
    989         if ( tinyMCE.isMSIE ) { 
    990             document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { 
    991                 if ( tinyMCE.idCounter == 0 ) 
    992                     return true; 
    993                 e = e ? e : window.event; 
    994                 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
    995                     var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 
    996                     if(typeof i ==  'undefined') 
    997                         return true; 
    998                     tinyMCE.execCommand("mceStartTyping"); 
    999                     this.blur(); 
    1000                     i.contentWindow.focus(); 
    1001                     e.returnValue = false; 
    1002                     return false; 
    1003                 } 
    1004             } 
    1005         } else { 
    1006             document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e) { 
    1007                 if ( tinyMCE.idCounter == 0 ) 
    1008                     return true; 
    1009                 e = e ? e : window.event; 
    1010                 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
    1011                     var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 
    1012                     if(typeof i ==  'undefined') 
    1013                         return true; 
    1014                     tinyMCE.execCommand("mceStartTyping"); 
    1015                     this.blur(); 
    1016                     i.contentWindow.focus(); 
    1017                     e.returnValue = false; 
    1018                     return false; 
    1019                 } 
    1020             } 
    1021         } 
     990        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { 
     991            e = e || window.event; 
     992            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
     993                if ( tinyMCE.activeEditor ) { 
     994                    e = null; 
     995                    if ( tinyMCE.activeEditor.isHidden() ) return true; 
     996                    tinyMCE.activeEditor.focus(); 
     997                    return false; 
     998                } 
     999                return true; 
     1000            } 
     1001        } 
    10221002    } 
    10231003    <?php endif; ?> 
  • trunk/wp-includes/js/autosave.js

    r6649 r6694  
    8383 
    8484function autosave() { 
    85     var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false; 
     85    var rich = ( (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() ) ? true : false; 
    8686    var post_data = { 
    8787            action: "autosave", 
     
    9494 
    9595    /* Gotta do this up here so we can check the length when tinyMCE is in use */ 
    96     if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 
    97         post_data["content"] = jQuery("#content").val(); 
    98     } else { 
     96    if ( rich ) { 
    9997        // Don't run while the TinyMCE spellcheck is on. 
    100         if(tinyMCE.selectedInstance.spellcheckerOn) return; 
    101         tinyMCE.wpTriggerSave(); 
    102         post_data["content"] = jQuery("#content").val(); 
    103     } 
     98        if ( tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) return; 
     99        tinyMCE.triggerSave(); 
     100    }  
     101     
     102    post_data["content"] = jQuery("#content").val(); 
    104103 
    105104    if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) { 
     
    123122        post_data["excerpt"] = jQuery("#excerpt").val(); 
    124123 
    125     if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 
    126         post_data["content"] = jQuery("#content").val(); 
    127     } else { 
    128         tinyMCE.wpTriggerSave(); 
    129         post_data["content"] = jQuery("#content").val(); 
    130     } 
     124    if ( rich )  
     125        tinyMCE.triggerSave(); 
     126     
     127    post_data["content"] = jQuery("#content").val(); 
    131128 
    132129    if(parseInt(post_data["post_ID"]) < 1) { 
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js

    r6632 r6694  
    1 /** 
    2  * $Id$ 
    3  * 
    4  * @author Moxiecode 
    5  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    6  */ 
    7  
    8 (function() { 
    9     tinymce.create('tinymce.plugins.AutoSavePlugin', { 
    10         init : function(ed, url) { 
    11             var t = this; 
    12  
    13             t.editor = ed; 
    14  
    15             window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; 
    16         }, 
    17  
    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         }, 
    27  
    28         // Private plugin internal methods 
    29  
    30         'static' : { 
    31             _beforeUnloadHandler : function() { 
    32                 var msg; 
    33  
    34                 tinymce.each(tinyMCE.editors, function(ed) { 
    35                     if (ed.getParam("fullscreen_is_enabled")) 
    36                         return; 
    37  
    38                     if (ed.isDirty()) { 
    39                         msg = ed.getLang("autosave.unload_msg"); 
    40                         return false; 
    41                     } 
    42                 }); 
    43  
    44                 return msg; 
    45             } 
    46         } 
    47     }); 
    48  
    49     // Register plugin 
    50     tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); 
    51 })(); 
     1(function(){tinymce.create('tinymce.plugins.AutoSavePlugin',{init:function(ed,url){var t=this;t.editor=ed;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;},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};},'static':{_beforeUnloadHandler:function(){var msg;tinymce.each(tinyMCE.editors,function(ed){if(ed.getParam("fullscreen_is_enabled"))return;if(ed.isDirty()){msg=ed.getLang("autosave.unload_msg");return false;}});return msg;}}});tinymce.PluginManager.add('autosave',tinymce.plugins.AutoSavePlugin);})(); 
  • trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js

    r6632 r6694  
    1 /** 
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 
    3  * 
    4  * @author Moxiecode 
    5  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    6  */ 
    7  
    8 (function() { 
    9     tinymce.create('tinymce.plugins.Directionality', { 
    10         init : function(ed, url) { 
    11             var t = this; 
    12  
    13             t.editor = ed; 
    14  
    15             ed.addCommand('mceDirectionLTR', function() { 
    16                 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); 
    17  
    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); 
    74         } 
    75     }); 
    76  
    77     // Register plugin 
    78     tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); 
    79 })(); 
     1(function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);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};},_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);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})(); 
  • trunk/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js

    r6689 r6694  
    1 /** 
    2  * $Id: editor_plugin_src.js 544 2008-01-17 13:07:00Z spocke $ 
    3  * 
    4  * @author Moxiecode 
    5  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    6  */ 
    7  
    8 (function() { 
    9     var DOM = tinymce.DOM; 
    10  
    11     tinymce.create('tinymce.plugins.FullScreenPlugin', { 
    12         init : function(ed, url) { 
    13             var t = this, s = {}, vp; 
    14  
    15             t.editor = ed; 
    16  
    17             // Register commands 
    18             ed.addCommand('mceFullScreen', function() { 
    19                 var win, de = document.documentElement; 
    20  
    21                 if (ed.getParam('fullscreen_is_enabled')) { 
    22                     if (ed.getParam('fullscreen_new_window')) 
    23                         closeFullscreen(); // Call to close in new window 
    24                     else { 
    25                         window.setTimeout(function() { 
    26                             tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); 
    27                             tinyMCE.remove(ed); 
    28                             DOM.remove('mce_fullscreen_container'); 
    29                             de.style.overflow = ed.getParam('fullscreen_html_overflow'); 
    30                             DOM.setStyle(document.body, 'overflow', ed.getParam('fullscreen_overflow')); 
    31                             window.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); 
    32                         }, 10); 
    33                     } 
    34  
    35                     return; 
    36                 } 
    37  
    38                 if (ed.getParam('fullscreen_new_window')) { 
    39                     win = window.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight); 
    40                     try { 
    41                         win.resizeTo(screen.availWidth, screen.availHeight); 
    42                     } catch (e) { 
    43                         // Ignore 
    44                     } 
    45                 } else { 
    46                     s.fullscreen_overflow = DOM.getStyle(document.body, 'overflow', 1) || 'auto'; 
    47                     s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); 
    48                     vp = DOM.getViewPort(); 
    49                     s.fullscreen_scrollx = vp.x; 
    50                     s.fullscreen_scrolly = vp.y; 
    51  
    52                     // Fixes an Opera bug where the scrollbars doesn't reappear 
    53                     if (tinymce.isOpera && s.fullscreen_overflow == 'visible') 
    54                         s.fullscreen_overflow = 'auto'; 
    55  
    56                     // Fixes an IE bug where horizontal scrollbars would appear 
    57                     if (tinymce.isIE && s.fullscreen_overflow == 'scroll') 
    58                         s.fullscreen_overflow = 'auto'; 
    59  
    60                     if (s.fullscreen_overflow == '0px') 
    61                         s.fullscreen_overflow = ''; 
    62  
    63                     DOM.setStyle(document.body, 'overflow', 'hidden'); 
    64                     de.style.overflow = 'hidden'; //Fix for IE6/7 
    65                     vp = DOM.getViewPort(); 
    66                     window.scrollTo(0, 0); 
    67  
    68                     if (tinymce.isIE) 
    69                         vp.h -= 1; 
    70  
    71                     n = DOM.add(document.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:150;'}); 
    72                     DOM.add(n, 'div', {id : 'mce_fullscreen'}); 
    73  
    74                     tinymce.each(ed.settings, function(v, n) { 
    75                         s[n] = v; 
    76                     }); 
    77  
    78                     s.id = 'mce_fullscreen'; 
    79                     s.width = n.clientWidth; 
    80                     s.height = n.clientHeight - 15; 
    81                     s.fullscreen_is_enabled = true; 
    82                     s.fullscreen_editor_id = ed.id; 
    83                     s.theme_advanced_resizing = false; 
    84  
    85                     tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) { 
    86                         s[k] = v; 
    87                     }); 
    88  
    89                     if (s.theme_advanced_toolbar_location === 'external') 
    90                         s.theme_advanced_toolbar_location = 'top'; 
    91  
    92                     t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); 
    93                     t.fullscreenEditor.onInit.add(function() { 
    94                         t.fullscreenEditor.setContent(ed.getContent({format : 'raw', no_events : 1}), {format : 'raw', no_events : 1}); 
    95                     }); 
    96  
    97                     t.fullscreenEditor.render(); 
    98                     tinyMCE.add(t.fullscreenEditor); 
    99  
    100                     t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); 
    101                     t.fullscreenElement.update(); 
    102                     //document.body.overflow = 'hidden'; 
    103                 } 
    104             }); 
    105  
    106             // Register buttons 
    107             ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'}); 
    108  
    109             ed.onNodeChange.add(function(ed, cm) { 
    110                 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); 
    111             }); 
    112         }, 
    113  
    114         getInfo : function() { 
    115             return { 
    116                 longname : 'Fullscreen', 
    117                 author : 'Moxiecode Systems AB', 
    118                 authorurl : 'http://tinymce.moxiecode.com', 
    119                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', 
    120                 version : tinymce.majorVersion + "." + tinymce.minorVersion 
    121             }; 
    122         } 
    123     }); 
    124  
    125     // Register plugin 
    126     tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin); 
    127 })(); 
     1(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=document.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{window.setTimeout(function(){tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(document.body,'overflow',ed.getParam('fullscreen_overflow'));window.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));},10);}return;}if(ed.getParam('fullscreen_new_window')){win=window.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{s.fullscreen_overflow=DOM.getStyle(document.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(document.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();window.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(document.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:150;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent({format:'raw',no_events:1}),{format:'raw',no_events:1});});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); 
  • trunk/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm

    r6689 r6694  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    12<html xmlns="http://www.w3.org/1999/xhtml"> 
    23<head> 
    3     <title>{$lang_fullscreen_title}</title> 
     4    <title></title> 
    45    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
    56    <script type="text/javascript" src="../../tiny_mce.js"></script> 
     
    7071            return false; 
    7172        } 
    72  
    73         function init() { 
    74             var e = document.getElementById('fullscreenarea'); 
    75             e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'}); 
    76             settings['width'] = e.clientWidth; 
    77             settings['height'] = e.clientHeight; 
    78             tinyMCE.init(settings); 
    79         } 
    8073    </script> 
    8174    <base target="_self" /> 
    8275</head> 
    83 <body onload="init();" style="margin:0; overflow:hidden; height:100%;" scrolling="no" scroll="no"> 
    84 <form onsubmit="doParentSubmit();" style="height: 100%"
     76<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no"> 
     77<form onsubmit="doParentSubmit();"
    8578<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea> 
    8679</form> 
     80 
     81<script type="text/javascript"> 
     82        var e = document.getElementById('fullscreenarea'); 
     83        e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'}); 
     84        settings['width'] = window.innerWidth || document.body.clientWidth; 
     85        settings['height'] = (window.innerHeight || document.body.clientHeight) - 18; 
     86        tinyMCE.init(settings); 
     87</script> 
     88 
    8789</body> 
    8890</html> 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r6632 r6694  
    1 /** 
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 
    3  * 
    4  * @author Moxiecode 
    5  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. 
    6  */ 
    7  
    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'}],