Editor API enhancement, first run (still needs some work), see #17144

git-svn-id: https://develop.svn.wordpress.org/trunk@18498 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2011-08-03 10:19:00 +00:00
parent d5a6cf3dfd
commit 461ceba60d
47 changed files with 2697 additions and 2082 deletions
+2 -3
View File
@@ -1110,8 +1110,6 @@ case 'menu-quick-search':
exit;
break;
case 'wp-link-ajax':
require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
$args = array();
@@ -1120,7 +1118,8 @@ case 'wp-link-ajax':
$args['s'] = stripslashes( $_POST['search'] );
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
$results = wp_link_query( $args );
require(ABSPATH . WPINC . '/class-wp-editor.php');
$results = WP_Editor::wp_link_query( $args );
if ( ! isset( $results ) )
die( '0' );
-4
View File
@@ -66,10 +66,6 @@ var userSettings = {
</script>
<?php
if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
wp_enqueue_script('quicktags');
}
do_action('admin_enqueue_scripts', $hook_suffix);
do_action("admin_print_styles-$hook_suffix");
do_action('admin_print_styles');
File diff suppressed because one or more lines are too long
+1 -329
View File
@@ -532,8 +532,6 @@ h3.dashboard-widget-title small a:hover {
a,
#adminmenu a,
#poststuff #edButtonPreview,
#poststuff #edButtonHTML,
#the-comment-list p.comment-author strong a,
#media-upload a.del-link,
#media-items a.delete,
@@ -586,11 +584,6 @@ input.readonly, textarea.readonly {
background-color: #ddd;
}
#ed_toolbar input,
#ed_reply_toolbar input {
background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
}
#editable-post-name {
background-color: #fffbcc;
}
@@ -865,334 +858,13 @@ table.widefat .spam a:hover,
border-color: #8dff1c !important;
}
/* editors */
#quicktags {
border-color: #ccc;
background-color: #dfdfdf;
background-image: url("../images/ed-bg.gif");
}
#ed_toolbar input {
border-color: #C3C3C3;
}
#ed_toolbar input:hover {
border-color: #aaa;
background: #ddd;
}
#poststuff .wp_themeSkin .mceStatusbar {
border-color: #dfdfdf;
}
#poststuff .wp_themeSkin .mceStatusbar * {
color: #555;
}
#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
background-color: #f1f1f1;
border-color: #dfdfdf #dfdfdf #ccc;
color: #999;
}
#poststuff #editor-toolbar .active {
border-color: #ccc #ccc #e9e9e9;
background-color: #e9e9e9;
color: #333;
}
/* TinyMCE */
#post-status-info {
background-color: #EDEDED;
}
.wp_themeSkin *,
.wp_themeSkin a:hover,
.wp_themeSkin a:link,
.wp_themeSkin a:visited,
.wp_themeSkin a:active {
color: #000;
}
/* Containers */
.wp_themeSkin table.mceLayout {
border-color: #ccc #ccc #dfdfdf;
}
#editorcontainer #content,
#editorcontainer .wp_themeSkin .mceIframeContainer {
-moz-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 );
-webkit-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 );
box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 );
}
.wp_themeSkin iframe {
background: transparent;
}
/* Layout */
.wp_themeSkin .mceStatusbar {
color: #000;
background-color: #f5f5f5;
}
/* Button */
.wp_themeSkin .mceButton {
border-color: #ccc;
background-color: #eee; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */
}
.wp_themeSkin a.mceButtonEnabled:hover {
border-color: #a0a0a0;
background: #ddd; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */
}
.wp_themeSkin a.mceButton:active,
.wp_themeSkin a.mceButtonEnabled:active,
.wp_themeSkin a.mceButtonSelected:active,
.wp_themeSkin a.mceButtonActive,
.wp_themeSkin a.mceButtonActive:active,
.wp_themeSkin a.mceButtonActive:hover {
background-color: #ddd; /* Fallback */
background-image: -ms-linear-gradient(bottom, #eee, #bbb); /* IE10 */
background-image: -moz-linear-gradient(bottom, #eee, #bbb); /* Firefox */
background-image: -o-linear-gradient(bottom, #eee, #bbb); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#eee), to(#bbb)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #eee, #bbb); /* new Webkit */
background-image: linear-gradient(bottom, #eee, #bbb); /* proposed W3C Markup */
border-color: #909090;
}
.wp_themeSkin .mceButtonDisabled {
border-color: #ccc !important;
}
/* ListBox */
.wp_themeSkin .mceListBox .mceText,
.wp_themeSkin .mceListBox .mceOpen {
border-color: #ccc;
background-color: #eee; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */
}
.wp_themeSkin .mceListBox .mceOpen {
border-left: 0 !important;
}
.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
.wp_themeSkin .mceListBoxHover .mceOpen,
.wp_themeSkin .mceListBoxHover:active .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceText,
.wp_themeSkin table.mceListBoxEnabled:active .mceText {
background: #ccc;
border-color: #999;
}
/* List Box Hover */
.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
.wp_themeSkin .mceListBoxHover .mceText,
.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
.wp_themeSkin .mceListBoxHover .mceOpen {
border-color: #909090;
background-color: #eee; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */
}
.wp_themeSkin select.mceListBox {
border-color: #B2B2B2;
background-color: #fff;
}
/* SplitButton */
.wp_themeSkin .mceSplitButton a.mceAction,
.wp_themeSkin .mceSplitButton a.mceOpen {
border-color: #ccc;
}
.wp_themeSkin .mceSplitButton a.mceOpen:hover,
.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
.wp_themeSkin .mceSplitButton a.mceAction:hover {
border-color: #909090;
}
.wp_themeSkin table.mceSplitButton td {
background-color: #eee; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */
}
.wp_themeSkin table.mceSplitButton:hover td {
background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */
background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */
background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */
}
.wp_themeSkin .mceSplitButtonActive {
background-color: #B2B2B2;
}
/* ColorSplitButton */
.wp_themeSkin div.mceColorSplitMenu table {
background-color: #ebebeb;
border-color: #B2B2B2;
}
.wp_themeSkin .mceColorSplitMenu a {
border-color: #B2B2B2;
}
.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
border-color: #fff;
}
.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
border-color: #0A246A;
background-color: #B6BDD2;
}
.wp_themeSkin a.mceMoreColors:hover {
border-color: #0A246A;
}
/* Menu */
.wp_themeSkin .mceMenu {
border-color: #ddd;
}
.wp_themeSkin .mceMenu table {
background-color: #ebeaeb;
}
.wp_themeSkin .mceMenu .mceText {
color: #000;
}
.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
.wp_themeSkin .mceMenu .mceMenuItemActive {
background-color: #f5f5f5;
}
.wp_themeSkin td.mceMenuItemSeparator {
background-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle a {
background-color: #ccc;
border-bottom-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle span.mceText {
color: #000;
}
.wp_themeSkin .mceMenuItemDisabled .mceText {
color: #888;
}
.wp_themeSkin tr.mceFirst td.mceToolbar {
background: #dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top;
border-color: #ccc;
}
.wp-admin #mceModalBlocker {
background: #000;
}
.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
background: #444444;
border-left: 1px solid #999;
border-top: 1px solid #999;
-moz-border-radius: 3px 0 0 0;
-webkit-border-top-left-radius: 3px;
-khtml-border-top-left-radius: 3px;
border-top-left-radius: 3px;
}
.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
background: #444444;
border-right: 1px solid #999;
border-top: 1px solid #999;
border-top-right-radius: 3px;
-khtml-border-top-right-radius: 3px;
-webkit-border-top-right-radius: 3px;
-moz-border-radius: 0 3px 0 0;
}
.wp-admin .clearlooks2 .mceMiddle .mceLeft {
background: #f1f1f1;
border-left: 1px solid #999;
}
.wp-admin .clearlooks2 .mceMiddle .mceRight {
background: #f1f1f1;
border-right: 1px solid #999;
}
.wp-admin .clearlooks2 .mceBottom {
background: #f1f1f1;
border-bottom: 1px solid #999;
}
.wp-admin .clearlooks2 .mceBottom .mceLeft {
background: #f1f1f1;
border-bottom: 1px solid #999;
border-left: 1px solid #999;
}
.wp-admin .clearlooks2 .mceBottom .mceCenter {
background: #f1f1f1;
border-bottom: 1px solid #999;
}
.wp-admin .clearlooks2 .mceBottom .mceRight {
background: #f1f1f1;
border-bottom: 1px solid #999;
border-right: 1px solid #999;
}
.wp-admin .clearlooks2 .mceFocus .mceTop span {
color: #e5e5e5;
}
/* end TinyMCE */
#titlediv #title {
border-color: #ccc;
}
#editorcontainer {
border-color: #ccc #ccc #dfdfdf;
}
#post-status-info {
border-color: #dfdfdf #ccc #ccc;
background-color: #eaeaea;
}
.editwidget .widget-inside {
File diff suppressed because one or more lines are too long
+2 -142
View File
@@ -472,101 +472,6 @@ form.upgrade .hint {
}
/*------------------------------------------------------------------------------
5.0 - TinyMCE
------------------------------------------------------------------------------*/
#editorcontainer #content {
font-family: Consolas, Monaco, monospace;
padding: 6px;
line-height: 150%;
border: 0 none;
outline: none;
resize: vertical;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-khtml-box-sizing: border-box;
box-sizing: border-box;
}
#editorcontainer,
#quicktags {
border-style: solid;
border-width: 1px;
border-collapse: separate;
-moz-border-radius: 3px 3px 0 0;
-webkit-border-top-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-khtml-border-top-right-radius: 3px;
-khtml-border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
#quicktags {
padding: 0;
margin-bottom: -3px;
border-bottom-width: 3px;
background-image: url("../images/ed-bg.gif");
background-position: left top;
background-repeat: repeat-x;
}
#quicktags #ed_toolbar {
padding: 2px 4px 0;
}
#ed_toolbar input,
#ed_reply_toolbar input {
margin: 3px 1px 4px;
line-height: 18px;
display: inline-block;
min-width: 26px;
padding: 2px 4px;
font-size: 12px;
}
#ed_reply_toolbar input {
margin: 1px 2px 1px 1px;
}
#quicktags #ed_link,
#ed_reply_toolbar #ed_reply_link {
text-decoration: underline;
}
#quicktags #ed_del,
#ed_reply_toolbar #ed_reply_del {
text-decoration: line-through;
}
#quicktags #ed_em,
#ed_reply_toolbar #ed_reply_em {
font-style: italic;
}
#wp_editbtns,
#wp_gallerybtns {
padding: 2px;
position: absolute;
display: none;
z-index: 999998;
}
#wp_editimgbtn,
#wp_delimgbtn,
#wp_editgallery,
#wp_delgallery {
margin: 2px;
padding: 2px;
border-width: 1px;
border-style: solid;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
/* Distraction Free Writing mode
* =Overlay Styles
-------------------------------------------------------------- */
@@ -2289,52 +2194,7 @@ input#link_url {
right: 10px;
}
#poststuff #editor-toolbar {
height: 30px;
}
.wp_themeSkin tr.mceFirst td.mceToolbar {
border-width: 0 0 1px;
border-style: none none solid;
}
#edButtonPreview,
#edButtonHTML {
height: 18px;
margin: 5px 5px 0 0;
padding: 4px 5px 2px;
float: right;
cursor: pointer;
border-width: 1px;
border-style: solid;
-moz-border-radius: 3px 3px 0 0;
-webkit-border-top-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-khtml-border-top-right-radius: 3px;
-khtml-border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
.js .theEditor {
color: white;
}
#poststuff #edButtonHTML {
margin-right: 15px;
}
#media-buttons {
cursor: default;
padding: 8px 8px 0;
}
#media-buttons a {
cursor: pointer;
padding: 0 0 5px 10px;
}
#media-buttons img,
.wp-media-buttons img,
#submitpost #ajax-loading,
#submitpost .ajax-loading {
vertical-align: middle;
@@ -3743,7 +3603,7 @@ span.imgedit-scale-warn {
padding: 2px;
}
#replyrow #editorcontainer {
#replyrow .wp-editor-container {
border: 0 none;
}
+2 -2
View File
@@ -264,9 +264,9 @@ wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
<?php } ?>
<?php if ( post_type_supports($post_type, 'editor') ) { ?>
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
<div id="postdivrich" class="postarea">
<?php the_editor($post->post_content); ?>
<?php wp_editor($post->post_content, 'content'); ?>
<table id="post-status-info" cellspacing="0"><tbody><tr>
<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
+4 -2
View File
@@ -120,8 +120,10 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
</div>
<div id="postdiv" class="postarea">
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4, false); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php
$quicktags_settings = array( 'quicktags_buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
</div>
<?php
+34 -4
View File
@@ -15,13 +15,13 @@
/**
* @since 2.1
* @deprecated 2.1
* @deprecated Use wp_tiny_mce().
* @see wp_tiny_mce()
* @deprecated Use wp_editor().
* @see wp_editor()
*/
function tinymce_include() {
_deprecated_function( __FUNCTION__, '2.1', 'wp_tiny_mce()' );
_deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' );
wp_tiny_mce();
wp_editor('', 'content');
}
/**
@@ -701,3 +701,33 @@ function wp_dashboard_quick_press_output() {
_deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
wp_dashboard_quick_press();
}
/**
* @since 2.7
* @deprecated 3.3
* @deprecated Use wp_editor().
* @see wp_editor()
*/
function wp_tiny_mce() {
_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
wp_editor('', 'content');
}
// see WP_Editor for the next 4
function wp_preload_dialogs() {
_deprecated_function( __FUNCTION__, '3.3' );
}
function wp_print_editor_js() {
_deprecated_function( __FUNCTION__, '3.3' );
}
function wp_quicktags() {
_deprecated_function( __FUNCTION__, '3.3' );
}
function wp_fullscreen_html() {
_deprecated_function( __FUNCTION__, '3.3' );
}
-124
View File
@@ -1,124 +0,0 @@
<?php
/**
* Internal linking functions.
*
* @package WordPress
* @subpackage Administration
* @since 3.1.0
*/
/**
* Performs post queries for internal linking.
*
* @since 3.1.0
*
* @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
* @return array Results.
*/
function wp_link_query( $args = array() ) {
$pts = get_post_types( array( 'public' => true ), 'objects' );
$pt_names = array_keys( $pts );
$query = array(
'post_type' => $pt_names,
'suppress_filters' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'post_date',
'posts_per_page' => 20,
);
$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
if ( isset( $args['s'] ) )
$query['s'] = $args['s'];
$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
// Do main query.
$get_posts = new WP_Query;
$posts = $get_posts->query( $query );
// Check if any posts were found.
if ( ! $get_posts->post_count )
return false;
// Build results.
$results = array();
foreach ( $posts as $post ) {
if ( 'post' == $post->post_type )
$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
else
$info = $pts[ $post->post_type ]->labels->singular_name;
$results[] = array(
'ID' => $post->ID,
'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
'permalink' => get_permalink( $post->ID ),
'info' => $info,
);
}
return $results;
}
/**
* Dialog for internal linking.
*
* @since 3.1.0
*/
function wp_link_dialog() {
?>
<form id="wp-link" tabindex="-1">
<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
<div id="link-selector">
<div id="link-options">
<p class="howto"><?php _e( 'Enter the destination URL' ); ?></p>
<div>
<label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" tabindex="10" name="href" /></label>
</div>
<div>
<label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" tabindex="20" name="linktitle" /></label>
</div>
<div class="link-target">
<label><input type="checkbox" id="link-target-checkbox" tabindex="30" /> <?php _e( 'Open link in a new window/tab' ); ?></label>
</div>
</div>
<?php $show_internal = '1' == get_user_setting( 'wplink', '0' ); ?>
<p class="howto toggle-arrow <?php if ( $show_internal ) echo 'toggle-arrow-active'; ?>" id="internal-toggle"><?php _e( 'Or link to existing content' ); ?></p>
<div id="search-panel"<?php if ( ! $show_internal ) echo ' style="display:none"'; ?>>
<div class="link-search-wrapper">
<label>
<span><?php _e( 'Search' ); ?></span>
<input type="text" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" />
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</label>
</div>
<div id="search-results" class="query-results">
<ul></ul>
<div class="river-waiting">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</div>
</div>
<div id="most-recent-results" class="query-results">
<div class="query-notice"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></div>
<ul></ul>
<div class="river-waiting">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</div>
</div>
</div>
</div>
<div class="submitbox">
<div id="wp-link-cancel">
<a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a>
</div>
<div id="wp-link-update">
<?php submit_button( __('Update'), 'primary', 'wp-link-submit', false, array('tabindex' => 100)); ?>
</div>
</div>
</form>
<?php
}
?>
+1 -2
View File
@@ -158,10 +158,9 @@ function &get_manifest() {
array('../wp-includes/js/tinymce/themes/advanced/img/fm.gif'),
array('../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png'),
array('../wp-includes/js/tinymce/themes/advanced/img/sflogo.png'),
array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png'),
array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png'),
array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif'),
array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif'),
array('../wp-includes/images/down_arrow.gif'),
array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif'),
array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif'),
array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif'),
+15 -20
View File
@@ -373,27 +373,22 @@ document.body.className = c;
*
* @since 2.5.0
*/
function media_buttons() {
$do_image = $do_audio = $do_video = true;
if ( is_multisite() ) {
$media_buttons = get_site_option( 'mu_media_buttons' );
if ( empty($media_buttons['image']) )
$do_image = false;
if ( empty($media_buttons['audio']) )
$do_audio = false;
if ( empty($media_buttons['video']) )
$do_video = false;
}
function media_buttons($editor_id = 'content') {
$out = '';
if ( $do_image )
$out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image');
if ( $do_video )
$out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video');
if ( $do_audio )
$out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio');
if ( is_multisite() )
$_buttons = get_site_option('mu_media_buttons');
else
$_buttons = array( 'image' => true, 'video' => true, 'audio' => true );
$out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media');
if ( !empty($_buttons['image']) )
$out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image', $editor_id);
if ( !empty($_buttons['video']) )
$out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video', $editor_id);
if ( !empty($_buttons['audio']) )
$out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio', $editor_id);
$out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media', $editor_id);
$context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
@@ -401,8 +396,8 @@ function media_buttons() {
}
add_action( 'media_buttons', 'media_buttons' );
function _media_button($title, $icon, $type) {
return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='add_$type' class='thickbox' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
function _media_button($title, $icon, $type, $id) {
return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='{$id}-add_{$type}' class='thickbox add_$type' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
}
function get_upload_iframe_src($type) {
-451
View File
@@ -1405,454 +1405,3 @@ function post_preview() {
return $url;
}
/**
* Adds the TinyMCE editor used on the Write and Edit screens.
*
* @package WordPress
* @since 2.7.0
*
* TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated
* and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded
* directly by TinyMCE using non-blocking method. Custom plugins can be refreshed by adding a query string
* to the URL when queueing them with the mce_external_plugins filter.
*
* @param bool $teeny optional Output a trimmed down version used in Press This.
* @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings.
*/
function wp_tiny_mce( $teeny = false, $settings = false ) {
global $concatenate_scripts, $compress_scripts, $tinymce_version, $editor_styles;
if ( ! user_can_richedit() )
return;
$baseurl = includes_url('js/tinymce');
$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
/*
The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
The + sign marks the default language. More information:
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
*/
$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
if ( $teeny ) {
$plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') );
$ext_plugins = '';
} else {
$plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
The url should be absolute and should include the js file name to be loaded. Example:
array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
*/
$mce_external_plugins = apply_filters('mce_external_plugins', array());
$ext_plugins = '';
if ( ! empty($mce_external_plugins) ) {
/*
The following filter loads external language files for TinyMCE plugins.
It takes an associative array 'plugin_name' => 'path', where path is the
include path to the file. The language file should follow the same format as
/tinymce/langs/wp-langs.php and should define a variable $strings that
holds all translated strings.
When this filter is not used, the function will try to load {mce_locale}.js.
If that is not found, en.js will be tried next.
*/
$mce_external_languages = apply_filters('mce_external_languages', array());
$loaded_langs = array();
$strings = '';
if ( ! empty($mce_external_languages) ) {
foreach ( $mce_external_languages as $name => $path ) {
if ( @is_file($path) && @is_readable($path) ) {
include_once($path);
$ext_plugins .= $strings . "\n";
$loaded_langs[] = $name;
}
}
}
foreach ( $mce_external_plugins as $name => $url ) {
if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
$plugins[] = '-' . $name;
$plugurl = dirname($url);
$strings = $str1 = $str2 = '';
if ( ! in_array($name, $loaded_langs) ) {
$path = str_replace( WP_PLUGIN_URL, '', $plugurl );
$path = WP_PLUGIN_DIR . $path . '/langs/';
if ( function_exists('realpath') )
$path = trailingslashit( realpath($path) );
if ( @is_file($path . $mce_locale . '.js') )
$strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";
if ( @is_file($path . $mce_locale . '_dlg.js') )
$strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";
if ( 'en' != $mce_locale && empty($strings) ) {
if ( @is_file($path . 'en.js') ) {
$str1 = @file_get_contents($path . 'en.js');
$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
}
if ( @is_file($path . 'en_dlg.js') ) {
$str2 = @file_get_contents($path . 'en_dlg.js');
$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
}
}
if ( ! empty($strings) )
$ext_plugins .= "\n" . $strings . "\n";
}
$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
}
}
}
if ( $teeny ) {
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = '';
} else {
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = array( 'formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );
$mce_buttons_2 = apply_filters('mce_buttons_2', $mce_buttons_2);
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
$mce_buttons_4 = implode($mce_buttons_4, ',');
}
$no_captions = (bool) apply_filters( 'disable_captions', '' );
// TinyMCE init settings
$initArray = array (
'mode' => 'specific_textareas',
'editor_selector' => 'theEditor',
'width' => '100%',
'theme' => 'advanced',
'skin' => 'wp_theme',
'theme_advanced_buttons1' => $mce_buttons,
'theme_advanced_buttons2' => $mce_buttons_2,
'theme_advanced_buttons3' => $mce_buttons_3,
'theme_advanced_buttons4' => $mce_buttons_4,
'language' => $mce_locale,
'spellchecker_languages' => $mce_spellchecker_languages,
'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left',
'theme_advanced_statusbar_location' => 'bottom',
'theme_advanced_resizing' => true,
'theme_advanced_resize_horizontal' => false,
'dialog_type' => 'modal',
'formats' => "{
alignleft : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
{selector : 'img,table', classes : 'alignleft'}
],
aligncenter : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
{selector : 'img,table', classes : 'aligncenter'}
],
alignright : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
{selector : 'img,table', classes : 'alignright'}
],
strikethrough : {inline : 'del'}
}",
'relative_urls' => false,
'remove_script_host' => false,
'convert_urls' => false,
'apply_source_formatting' => false,
'remove_linebreaks' => true,
'gecko_spellcheck' => true,
'keep_styles' => false,
'entities' => '38,amp,60,lt,62,gt',
'accessibility_focus' => true,
'tabfocus_elements' => 'major-publishing-actions',
'media_strict' => false,
'paste_remove_styles' => true,
'paste_remove_spans' => true,
'paste_strip_class_attributes' => 'all',
'paste_text_use_dialog' => true,
'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr',
'wpeditimage_disable_captions' => $no_captions,
'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/wp-fullscreen.css",
'plugins' => implode( ',', $plugins ),
);
if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
$mce_css = array();
$style_uri = get_stylesheet_directory_uri();
if ( ! is_child_theme() ) {
foreach ( $editor_styles as $file )
$mce_css[] = "$style_uri/$file";
} else {
$style_dir = get_stylesheet_directory();
$template_uri = get_template_directory_uri();
$template_dir = get_template_directory();
foreach ( $editor_styles as $file ) {
if ( file_exists( "$template_dir/$file" ) )
$mce_css[] = "$template_uri/$file";
if ( file_exists( "$style_dir/$file" ) )
$mce_css[] = "$style_uri/$file";
}
}
$mce_css = implode( ',', $mce_css );
} else {
$mce_css = '';
}
$mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
if ( ! empty($mce_css) )
$initArray['content_css'] = $mce_css;
if ( is_array($settings) )
$initArray = array_merge($initArray, $settings);
// For people who really REALLY know what they're doing with TinyMCE
// You can modify initArray to add, remove, change elements of the config before tinyMCE.init
// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
if ( $teeny ) {
$initArray = apply_filters('teeny_mce_before_init', $initArray);
} else {
$initArray = apply_filters('tiny_mce_before_init', $initArray);
}
if ( empty($initArray['theme_advanced_buttons3']) && !empty($initArray['theme_advanced_buttons4']) ) {
$initArray['theme_advanced_buttons3'] = $initArray['theme_advanced_buttons4'];
$initArray['theme_advanced_buttons4'] = '';
}
if ( ! isset($concatenate_scripts) )
script_concat_settings();
$language = $initArray['language'];
$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
/**
* Deprecated
*
* The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE.
* These plugins can be refreshed by appending query string to the URL passed to mce_external_plugins filter.
* If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code).
*/
$version = apply_filters('tiny_mce_version', '');
$version = 'ver=' . $tinymce_version . $version;
if ( 'en' != $language )
include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
$mce_options = '';
foreach ( $initArray as $k => $v ) {
if ( is_bool($v) ) {
$val = $v ? 'true' : 'false';
$mce_options .= $k . ':' . $val . ', ';
continue;
} elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
$mce_options .= $k . ':' . $v . ', ';
continue;
}
$mce_options .= $k . ':"' . $v . '", ';
}
$mce_options = rtrim( trim($mce_options), '\n\r,' );
do_action('before_wp_tiny_mce', $initArray); ?>
<script type="text/javascript">
/* <![CDATA[ */
tinyMCEPreInit = {
base : "<?php echo $baseurl; ?>",
suffix : "",
query : "<?php echo $version; ?>",
mceInit : {<?php echo $mce_options; ?>},
load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
};
/* ]]> */
</script>
<?php
if ( $compressed )
echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=1&amp;$version'></script>\n";
else
echo "<script type='text/javascript' src='$baseurl/tiny_mce.js?$version'></script>\n";
if ( 'en' != $language && isset($lang) )
echo "<script type='text/javascript'>\n$lang\n</script>\n";
else
echo "<script type='text/javascript' src='$baseurl/langs/wp-langs-en.js?$version'></script>\n";
?>
<script type="text/javascript">
/* <![CDATA[ */
<?php
if ( $ext_plugins )
echo "$ext_plugins\n";
if ( ! $compressed ) {
?>
(function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.mceInit.language,th=t.mceInit.theme,pl=t.mceInit.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
<?php } ?>
tinyMCE.init(tinyMCEPreInit.mceInit);
/* ]]> */
</script>
<?php
do_action('after_wp_tiny_mce', $initArray);
}
// Load additional inline scripts based on active plugins.
function wp_preload_dialogs($init) {
$plugins = preg_split('/[ ,-]+/', $init['plugins']);
if ( in_array( 'wpdialogs', $plugins, true ) ) {
wp_print_scripts('wpdialogs-popup');
wp_print_styles('wp-jquery-ui-dialog');
}
if ( in_array( 'wplink', $plugins, true ) ) {
require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
?><div style="display:none;"><?php wp_link_dialog(); ?></div><?php
wp_print_scripts('wplink');
wp_print_styles('wplink');
}
// Distraction Free Writing mode
if ( in_array( 'wpfullscreen', $plugins, true ) ) {
wp_fullscreen_html();
wp_print_scripts('wp-fullscreen');
}
wp_print_scripts('word-count');
}
function wp_quicktags() {
global $tinymce_version;
wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );
if ( !user_can_richedit() ) {
wp_enqueue_style( 'tinymce-buttons', includes_url('js/tinymce/themes/advanced/skins/wp_theme/ui.css'), array(), $tinymce_version );
wp_print_styles('tinymce-buttons');
}
}
function wp_print_editor_js() {
wp_print_scripts('editor');
}
function wp_fullscreen_html() {
global $content_width, $post;
$width = isset($content_width) && 800 > $content_width ? $content_width : 800;
$width = $width + 10; // compensate for the padding
$dfw_width = get_user_setting( 'dfw_width', $width );
$save = isset($post->post_status) && $post->post_status == 'publish' ? __('Update') : __('Save');
?>
<div id="wp-fullscreen-body">
<div id="fullscreen-topbar">
<div id="wp-fullscreen-toolbar">
<div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
<div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
<div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes">
<a href="#" onclick="fullscreen.switchmode('tinymce');return false;"><?php _e('Visual'); ?></a>
<a href="#" onclick="fullscreen.switchmode('html');return false;"><?php _e('HTML'); ?></a>
</div></div>
<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
<?php
$media_link_type = 'image';
if ( is_multisite() && ( ( ! $mu_media_buttons = get_site_option( 'mu_media_buttons' ) ) || empty( $mu_media_buttons['image'] ) ) )
$media_link_type = 'media';
$buttons = array(
// format: title, onclick, show in both editors
'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ),
'0' => 'separator',
'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ),
'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
'1' => 'separator',
'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "jQuery('#add_{$media_link_type}').click();", 'both' => true ),
'2' => 'separator',
'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),
'3' => 'separator',
'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
);
$buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
foreach ( $buttons as $button => $args ) {
if ( 'separator' == $args ) { ?>
<div><span aria-orientation="vertical" role="separator" class="mceSeparator"></span></div>
<?php continue;
} ?>
<div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>>
<a title="<?php echo $args['title']; ?>" onclick="<?php echo $args['onclick']; ?>return false;" class="mceButton mceButtonEnabled mce_<?php echo $button; ?>" href="#" id="wp_fs_<?php echo $button; ?>" role="button" aria-pressed="false">
<span class="mceIcon mce_<?php echo $button; ?>"></span>
</a>
</div>
<?php
} ?>
</div></div>
<div id="wp-fullscreen-save">
<span><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
<img src="images/wpspin_light.gif" alt="" />
<input type="button" class="button-primary" value="<?php echo $save; ?>" onclick="fullscreen.save();" />
</div>
</div>
</div>
</div>
<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
<label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
<input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
<div id="wp-fullscreen-container">
<textarea id="wp_mce_fullscreen"></textarea>
</div>
<div id="wp-fullscreen-status">
<div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
<div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
</div>
</div>
</div>
<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
<div class="fullscreen-overlay fullscreen-fader fade-600" id="fullscreen-fader"></div>
<?php
}
+53 -75
View File
@@ -1,27 +1,45 @@
jQuery(document).ready(function($){
var h = wpCookies.getHash('TinyMCE_content_size');
if ( getUserSetting( 'editor' ) == 'html' ) {
if ( h )
$('#content').css('height', h.ch - 15 + 'px');
} else {
if ( typeof tinyMCE != 'object' ) {
$('#content').css('color', '#000');
} else {
$('#quicktags').hide();
}
}
});
var switchEditors = {
go: function(a) {
var t = this, aid = a.id, l = aid.length, id = aid.substr(0, l - 5), mode = aid.substr(l - 4),
ed = tinyMCE.get(id), wrap_id = 'wp-'+id+'-wrap', dom = tinymce.DOM, txtarea_el = dom.get(id);
if ( 'tmce' == mode ) {
if ( ed && ! ed.isHidden() )
return false;
mode : '',
if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop )
txtarea_el.value = t.wpautop( txtarea_el.value );
if ( ed ) {
ed.show();
} else {
ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);
ed.render();
}
I : function(e) {
return document.getElementById(e);
dom.removeClass(wrap_id, 'html-active');
dom.addClass(wrap_id, 'tmce-active');
setUserSetting('editor', 'tinymce');
} else if ( 'html' == mode ) {
if ( ed && ed.isHidden() )
return false;
if ( ed ) {
txtarea_el.style.height = ed.getContentAreaContainer().offsetHeight + 20 + 'px';
ed.hide();
}
dom.removeClass(wrap_id, 'tmce-active');
dom.addClass(wrap_id, 'html-active');
setUserSetting('editor', 'html');
}
return false;
},
_wp_Nop : function(content) {
var blocklist1, blocklist2;
@@ -85,55 +103,6 @@ var switchEditors = {
return content;
},
go : function(id, mode) {
id = id || 'content';
mode = mode || this.mode || '';
var ed, qt = this.I('quicktags'), H = this.I('edButtonHTML'), P = this.I('edButtonPreview'), ta = this.I(id);
try { ed = tinyMCE.get(id); }
catch(e) { ed = false; }
if ( 'tinymce' == mode ) {
if ( ed && ! ed.isHidden() )
return false;
setUserSetting( 'editor', 'tinymce' );
this.mode = 'html';
P.className = 'active';
H.className = '';
edCloseAllTags(); // :-(
qt.style.display = 'none';
ta.style.color = '#FFF';
ta.value = this.wpautop(ta.value);
try {
if ( ed )
ed.show();
else
tinyMCE.execCommand("mceAddControl", false, id);
} catch(e) {}
ta.style.color = '#000';
} else {
setUserSetting( 'editor', 'html' );
ta.style.color = '#000';
this.mode = 'tinymce';
H.className = 'active';
P.className = '';
if ( ed && !ed.isHidden() ) {
ta.style.height = ed.getContentAreaContainer().offsetHeight + 24 + 'px';
ed.hide();
}
qt.style.display = 'block';
}
return false;
},
_wp_Autop : function(pee) {
var blocklist = 'table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary';
@@ -188,20 +157,29 @@ var switchEditors = {
},
pre_wpautop : function(content) {
var t = this, o = { o: t, data: content, unfiltered: content };
var t = this, o = { o: t, data: content, unfiltered: content },
q = typeof(jQuery) != 'undefined';
jQuery('body').trigger('beforePreWpautop', [o]);
if ( q )
jQuery('body').trigger('beforePreWpautop', [o]);
o.data = t._wp_Nop(o.data);
jQuery('body').trigger('afterPreWpautop', [o]);
if ( q )
jQuery('body').trigger('afterPreWpautop', [o]);
return o.data;
},
wpautop : function(pee) {
var t = this, o = { o: t, data: pee, unfiltered: pee };
var t = this, o = { o: t, data: pee, unfiltered: pee },
q = typeof(jQuery) != 'undefined';
jQuery('body').trigger('beforeWpautop', [o]);
if ( q )
jQuery('body').trigger('beforeWpautop', [o]);
o.data = t._wp_Autop(o.data);
jQuery('body').trigger('afterWpautop', [o]);
if ( q )
jQuery('body').trigger('afterWpautop', [o]);
return o.data;
}
};
}
+1 -1
View File
@@ -1 +1 @@
jQuery(document).ready(function(b){var a=wpCookies.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){b("#content").css("height",a.ch-15+"px")}}else{if(typeof tinyMCE!="object"){b("#content").css("color","#000")}else{b("#quicktags").hide()}}});var switchEditors={mode:"",I:function(a){return document.getElementById(a)},_wp_Nop:function(b){var c,a;if(b.indexOf("<pre")!=-1||b.indexOf("<script")!=-1){b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp_temp>")})}c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","g"),"</$1>\n");b=b.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>");b=b.replace(/(<p [^>]+>.*?)<\/p>/g,"$1</p#>");b=b.replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n");b=b.replace(/\s*<p>/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*<br ?\/?>\s*/gi,"\n");b=b.replace(/\s*<div/g,"\n<div");b=b.replace(/<\/div>\s*/g,"</div>\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset";b=b.replace(new RegExp("\\s*<((?:"+a+")(?: [^>]*)?)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","g"),"</$1>\n");b=b.replace(/<li([^>]*)>/g,"\t<li$1>");if(b.indexOf("<hr")!=-1){b=b.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")}if(b.indexOf("<object")!=-1){b=b.replace(/<object[\s\S]+?<\/object>/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"</p>\n");b=b.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(/<wp_temp>/g,"\n");return b},go:function(i,g){i=i||"content";g=g||this.mode||"";var b,h=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if("tinymce"==g){if(b&&!b.isHidden()){return false}setUserSetting("editor","tinymce");this.mode="html";d.className="active";c.className="";edCloseAllTags();h.style.display="none";a.style.color="#FFF";a.value=this.wpautop(a.value);try{if(b){b.show()}else{tinyMCE.execCommand("mceAddControl",false,i)}}catch(f){}a.style.color="#000"}else{setUserSetting("editor","html");a.style.color="#000";this.mode="tinymce";c.className="active";d.className="";if(b&&!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+"px";b.hide()}h.style.display="block"}return false},_wp_Autop:function(a){var b="table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary";if(a.indexOf("<object")!=-1){a=a.replace(/<object[\s\S]+?<\/object>/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});if(a.indexOf("<pre")!=-1||a.indexOf("<script")!=-1){a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){return c.replace(/(\r\n|\n)/g,"<wp_temp_br>")})}a=a+"\n\n";a=a.replace(/<br \/>\s*<br \/>/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")(?: [^>]*)?>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(/<hr( [^>]*)?>/gi,"<hr$1>\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"<p>$1</p>\n");a=a.replace(/<p>\s*?<\/p>/gi,"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")(?: [^>]*)?>)\\s*</p>","gi"),"$1");a=a.replace(/<p>(<li.+?)<\/p>/gi,"$1");a=a.replace(/<p>\s*<blockquote([^>]*)>/gi,"<blockquote$1><p>");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")(?: [^>]*)?>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")(?: [^>]*)?>)\\s*</p>","gi"),"$1");a=a.replace(/\s*\n/gi,"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi,"[caption$1[/caption]");a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,d,f){if(f.match(/<p( [^>]*)?>/)){return e}return d+"<p>"+f+"</p>"});a=a.replace(/<wp_temp_br>/g,"\n");return a},pre_wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforePreWpautop",[c]);c.data=a._wp_Nop(c.data);jQuery("body").trigger("afterPreWpautop",[c]);return c.data},wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforeWpautop",[c]);c.data=a._wp_Autop(c.data);jQuery("body").trigger("afterWpautop",[c]);return c.data}};
var switchEditors={go:function(j){var k=this,d=j.id,e=d.length,b=d.substr(0,e-5),g=d.substr(e-4),h=tinyMCE.get(b),i="wp-"+b+"-wrap",f=tinymce.DOM,c=f.get(b);if("tmce"==g){if(h&&!h.isHidden()){return false}if(tinyMCEPreInit.mceInit[b]&&tinyMCEPreInit.mceInit[b].wpautop){c.value=k.wpautop(c.value)}if(h){h.show()}else{h=new tinymce.Editor(b,tinyMCEPreInit.mceInit[b]);h.render()}f.removeClass(i,"html-active");f.addClass(i,"tmce-active");setUserSetting("editor","tinymce")}else{if("html"==g){if(h&&h.isHidden()){return false}if(h){c.style.height=h.getContentAreaContainer().offsetHeight+20+"px";h.hide()}f.removeClass(i,"tmce-active");f.addClass(i,"html-active");setUserSetting("editor","html")}}return false},_wp_Nop:function(b){var c,a;if(b.indexOf("<pre")!=-1||b.indexOf("<script")!=-1){b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp_temp>")})}c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","g"),"</$1>\n");b=b.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>");b=b.replace(/(<p [^>]+>.*?)<\/p>/g,"$1</p#>");b=b.replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n");b=b.replace(/\s*<p>/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*<br ?\/?>\s*/gi,"\n");b=b.replace(/\s*<div/g,"\n<div");b=b.replace(/<\/div>\s*/g,"</div>\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset";b=b.replace(new RegExp("\\s*<((?:"+a+")(?: [^>]*)?)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","g"),"</$1>\n");b=b.replace(/<li([^>]*)>/g,"\t<li$1>");if(b.indexOf("<hr")!=-1){b=b.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")}if(b.indexOf("<object")!=-1){b=b.replace(/<object[\s\S]+?<\/object>/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"</p>\n");b=b.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(/<wp_temp>/g,"\n");return b},_wp_Autop:function(a){var b="table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary";if(a.indexOf("<object")!=-1){a=a.replace(/<object[\s\S]+?<\/object>/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});if(a.indexOf("<pre")!=-1||a.indexOf("<script")!=-1){a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){return c.replace(/(\r\n|\n)/g,"<wp_temp_br>")})}a=a+"\n\n";a=a.replace(/<br \/>\s*<br \/>/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")(?: [^>]*)?>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(/<hr( [^>]*)?>/gi,"<hr$1>\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"<p>$1</p>\n");a=a.replace(/<p>\s*?<\/p>/gi,"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")(?: [^>]*)?>)\\s*</p>","gi"),"$1");a=a.replace(/<p>(<li.+?)<\/p>/gi,"$1");a=a.replace(/<p>\s*<blockquote([^>]*)>/gi,"<blockquote$1><p>");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")(?: [^>]*)?>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")(?: [^>]*)?>)\\s*</p>","gi"),"$1");a=a.replace(/\s*\n/gi,"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi,"[caption$1[/caption]");a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,d,f){if(f.match(/<p( [^>]*)?>/)){return e}return d+"<p>"+f+"</p>"});a=a.replace(/<wp_temp_br>/g,"\n");return a},pre_wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforePreWpautop",[d])}d.data=a._wp_Nop(d.data);if(c){jQuery("body").trigger("afterPreWpautop",[d])}return d.data},wpautop:function(b){var a=this,d={o:a,data:b,unfiltered:b},c=typeof(jQuery)!="undefined";if(c){jQuery("body").trigger("beforeWpautop",[d])}d.data=a._wp_Autop(d.data);if(c){jQuery("body").trigger("afterWpautop",[d])}return d.data}};
+2
View File
@@ -1,4 +1,5 @@
// send html to the post editor
/*
function send_to_editor(h) {
var ed;
@@ -28,6 +29,7 @@ function send_to_editor(h) {
tb_remove();
}
*/
// thickbox settings
var tb_position;
+1 -1
View File
@@ -1 +1 @@
function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){if(tinymce.isIE&&a.windowManager.insertimagebookmark){a.selection.moveToBookmark(a.windowManager.insertimagebookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf("[embed")===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.thickbox").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_position()});a(document).ready(function(b){b("a.thickbox").click(function(){var c;if(typeof tinyMCE!="undefined"&&tinymce.isIE&&(c=tinyMCE.activeEditor)&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}})})})(jQuery);
var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.thickbox").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_position()});a(document).ready(function(b){b("a.thickbox").click(function(){var c;if(typeof tinyMCE!="undefined"&&tinymce.isIE&&(c=tinyMCE.activeEditor)&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}})})})(jQuery);
+40 -17
View File
@@ -77,7 +77,7 @@ PubSub.prototype.publish = function( topic, args ) {
visible : false,
mode : 'tinymce',
editor_id : 'content',
title_id : 'title',
title_id : '',
timer : 0,
toolbar_shown : false
}
@@ -137,7 +137,28 @@ PubSub.prototype.publish = function( topic, args ) {
if ( s.visible )
return;
// Settings can be added or changed by defining "wp_fullscreen_settings" JS object.
// This can be done by defining it as PHP array and passing it to JS with:
// wp_add_script_data( 'wp-fullscreen', 'wp_fullscreen_settings', $settings_array )
if ( typeof(wp_fullscreen_settings) != 'undefined' )
$.extend( s, wp_fullscreen_settings );
// enable DFW only on the Add/Edit Post screens for now
/*
s.editor_id = wpActiveEditor || 'content';
if ( !s.title_id && $('input#title').length && s.editor_id == 'content' )
s.title_id = 'title';
if ( !s.title_id )
$('#wp-fullscreen-title').hide();
*/
s.editor_id = 'content';
s.title_id = 'title';
s.mode = $('#' + s.editor_id).is(':hidden') ? 'tinymce' : 'html';
s.qt_canvas = $('#' + s.editor_id).get(0);
if ( ! s.element )
api.ui.init();
@@ -218,7 +239,8 @@ PubSub.prototype.publish = function( topic, args ) {
api.savecontent = function() {
var ed, content;
$('#' + s.title_id).val( $('#wp-fullscreen-title').val() );
if ( s.title_id )
$('#' + s.title_id).val( $('#wp-fullscreen-title').val() );
if ( s.mode === 'tinymce' && (ed = tinyMCE.get('wp_mce_fullscreen')) ) {
content = ed.save();
@@ -278,19 +300,20 @@ PubSub.prototype.publish = function( topic, args ) {
});
ps.subscribe( 'show', function() { // This event occurs before the overlay blocks the UI.
var title = $('#wp-fullscreen-title').val( $('#' + s.title_id).val() );
var title;
if ( s.title_id ) {
title = $('#wp-fullscreen-title').val( $('#' + s.title_id).val() );
set_title_hint( title );
}
set_title_hint( title );
$('#wp-fullscreen-save input').attr( 'title', $('#last-edit').text() );
s.textarea_obj.value = edCanvas.value;
s.textarea_obj.value = s.qt_canvas.value;
if ( s.has_tinymce && s.mode === 'tinymce' )
tinyMCE.execCommand('wpFullScreenInit');
s._edCanvas = edCanvas;
edCanvas = s.textarea_obj;
s.orig_y = $(window).scrollTop();
});
@@ -328,7 +351,7 @@ PubSub.prototype.publish = function( topic, args ) {
});
}
tinyMCE.execCommand("mceAddControl", false, s.editor_id);
tinyMCE.init(tinyMCEPreInit.mceInit[s.editor_id]);
s.is_mce_on = true;
}
});
@@ -337,9 +360,9 @@ PubSub.prototype.publish = function( topic, args ) {
// Make sure the correct editor is displaying.
if ( s.has_tinymce && s.mode === 'tinymce' && $('#' + s.editor_id).is(':visible') ) {
switchEditors.go( s.editor_id, 'tinymce' );
switchEditors.go( $('#'+s.editor_id+'-tmce').get(0) );
} else if ( s.mode === 'html' && $('#' + s.editor_id).is(':hidden') ) {
switchEditors.go( s.editor_id, 'html' );
switchEditors.go( $('#'+s.editor_id+'-html').get(0) );
}
// Save content must be after switchEditors or content will be overwritten. See #17229.
@@ -351,11 +374,10 @@ PubSub.prototype.publish = function( topic, args ) {
if ( s.has_tinymce && s.mode === 'tinymce' )
tinyMCE.execCommand('wpFullScreenSave');
set_title_hint( $('#' + s.title_id) );
if ( s.title_id )
set_title_hint( $('#' + s.title_id) );
// Restore and update edCanvas.
edCanvas = s._edCanvas;
edCanvas.value = s.textarea_obj.value;
s.qt_canvas.value = s.textarea_obj.value;
});
ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI.
@@ -367,7 +389,7 @@ PubSub.prototype.publish = function( topic, args ) {
ps.subscribe( 'hidden', function() { // This event occurs after DFW is removed.
s.visible = false;
$('#wp_mce_fullscreen').removeAttr('style');
$('#wp_mce_fullscreen, #wp-fullscreen-title').removeAttr('style');
if ( s.has_tinymce && s.is_mce_on )
tinyMCE.execCommand('wpFullScreenClose');
@@ -488,10 +510,11 @@ PubSub.prototype.publish = function( topic, args ) {
api.ui = {
init: function() {
var topbar = $('#fullscreen-topbar'), txtarea = $('#wp_mce_fullscreen'), last = 0;
s.toolbars = topbar.add( $('#wp-fullscreen-status') );
s.element = $('#fullscreen-fader');
s.textarea_obj = txtarea[0];
s.has_tinymce = typeof(tinyMCE) != 'undefined';
s.has_tinymce = typeof(tinymce) != 'undefined';
if ( !s.has_tinymce )
$('#wp-fullscreen-mode-bar').hide();
File diff suppressed because one or more lines are too long