From c82cc535bce9088ff97f3c64d3f007c503d2f92a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 22 Sep 2006 07:04:41 +0000 Subject: [PATCH] Tabbed editor from skeltoac. fixes #2829 git-svn-id: https://develop.svn.wordpress.org/trunk@4206 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 41 ------ wp-admin/inline-uploading.php | 3 +- wp-admin/wp-admin.css | 45 +++++- wp-includes/general-template.php | 73 ++++++++-- wp-includes/js/autosave.js.php | 5 +- .../plugins/wordpress/editor_plugin.js | 135 ++++++++++++++++-- wp-includes/js/tinymce/tiny_mce_config.php | 4 +- wp-includes/script-loader.php | 6 +- 8 files changed, 232 insertions(+), 80 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 9c065765e2..738b57b829 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1250,47 +1250,6 @@ function save_mod_rewrite_rules() { insert_with_markers($home_path.'.htaccess', 'WordPress', $rules); } -function the_quicktags() { - echo ' -
- '; - wp_print_scripts( 'quicktags' ); - echo ' -
-'; - echo ' - -'; -} - function get_broken_themes() { global $wp_broken_themes; diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php index 2258ce77ab..83b7e40e0f 100644 --- a/wp-admin/inline-uploading.php +++ b/wp-admin/inline-uploading.php @@ -410,7 +410,6 @@ function updateOtherIcon(n) { var win = window.opener ? window.opener : window.dialogArguments; if (!win) win = top; tinyMCE = win.tinyMCE; -richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 ); function sendToEditor(n) { o = document.getElementById('div'+n); h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim @@ -420,7 +419,7 @@ function sendToEditor(n) { h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames h = h.replace(new RegExp('', 'g'), '$1 />'); // XHTML - if ( richedit ) + if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) win.tinyMCE.execCommand('mceInsertContent', false, h); else win.edInsertContent(win.edCanvas, h); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b7efc50055..0725c2ed72 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1,4 +1,4 @@ -* html #poststuff { +z* html #poststuff { height: 100%; /* kill peekaboo bug in IE */ } @@ -490,10 +490,6 @@ table .vers { width: 100%; } -#quicktags { - margin-left: -1px; -} - #currenttheme img { float: left; border: 1px solid #666; @@ -512,6 +508,27 @@ table .vers { color: #fff; } +#postdivrich #quicktags { + background: #f0f0ee; + padding: 0px; + border: 1px solid #ccc; + border-bottom: none; +} +#postdiv #quicktags { + padding-right: 6px; +} +#postdivrich #quicktags { + display: none; +} +#quicktags #ed_toolbar { + padding: 0px 2px; +} + +#ed_toolbar input { + background: #fff url( images/fade-butt.png ) repeat-x 0px -2px; + margin: 3px 2px 2px; +} + #quicktags #ed_strong { font-weight: bold; } @@ -531,6 +548,7 @@ table .vers { #quicktags #ed_code { font-family: "Courier New", Courier, mono; + margin-bottom: 3px; } #title { @@ -1118,3 +1136,20 @@ input#catadd { background: #a4a4a4; #ajax-response.alignleft { margin-left: 2em; } +#postdivrich #edButtons { + padding-left: 3px; +} +#postdivrich #content, #postdivrich #content:active { + border: 1px solid #ccc; +} +#edButtons input, #edButtons input:active { + margin: 0px 2px -1px; +} +#edButtons input.edButtonFore, #edButtons input.edButtonFore:active { + background: #f0f0ee; + border-bottom: 1px solid #f0f0ee; +} +#edButtons input.edButtonBack, #edButtons input.edButtonBack:active { + background: #fff url( images/fade-butt.png ) repeat-x 0px 15px; + border-bottom: 1px solid #ccc; +} \ No newline at end of file diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index dcc408faf1..c4c2627e27 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -735,13 +735,6 @@ function noindex() { echo "\n"; } -/** - * Places a textarea according to the current user's preferences, filled with $content. - * Also places a script block that enables tabbing between Title and Content. - * - * @param string Editor contents - * @param string (optional) Previous form field's ID (for tabbing support) - */ function the_editor($content, $id = 'content', $prev_id = 'title') { $rows = get_option('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) @@ -749,11 +742,61 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { $rows = "rows='$rows'"; - the_quicktags(); - - if ( user_can_richedit() ) + if ( user_can_richedit() ) : add_filter('the_editor_content', 'wp_richedit_pre'); + // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. + ?> + + + + + +
+ + +
+ + \n"); $the_editor_content = apply_filters('the_editor_content', $content); @@ -763,17 +806,17 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {