Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- S:/home/wordpress/trunk/wp-content/plugins/preserve-editor-scroll-position/preserve-editor-scroll-position.old.php Mon Dec 1 20:31:38 2014
- +++ S:/home/wordpress/trunk/wp-content/plugins/preserve-editor-scroll-position/preserve-editor-scroll-position.php Mon Dec 1 20:44:12 2014
- @@ -47,7 +47,6 @@
- add_filter( 'redirect_post_location', array( __CLASS__, 'add_query_arg' ) );
- add_action( 'edit_form_advanced', array( __CLASS__, 'add_input_field' ) );
- add_action( 'edit_page_form', array( __CLASS__, 'add_input_field' ) );
- - add_filter( 'tiny_mce_before_init', array( __CLASS__, 'extend_tiny_mce' ) );
- add_action( 'after_wp_tiny_mce', array( __CLASS__, 'print_js' ) );
- }
- @@ -64,23 +63,6 @@
- /**
- - * Extend TinyMCE config with a setup function.
- - * See http://www.tinymce.com/wiki.php/API3:event.tinymce.Editor.onInit
- - *
- - * @since 0.1.0
- - *
- - * @param array $init
- - * @return array
- - */
- - public static function extend_tiny_mce( $init ) {
- - if ( wp_default_editor() == 'tinymce' )
- - $init['setup'] = 'rich_scroll';
- -
- - return $init;
- - }
- -
- -
- - /**
- * Returns redirect url with query arg for scroll position.
- *
- * @since 0.1.0
- @@ -107,30 +89,19 @@
- <script>
- ( function( $ ) {
- $( '#post' ).submit( function() {
- - // TinyMCE or HTML Editor?
- - scrollto =
- - $('#content' ).is(':hidden') ?
- - $('#content_ifr').contents().find( 'body' ).scrollTop() :
- - $('#content' ).scrollTop();
- + var scrollto = $( 'html' ).scrollTop();
- // Save scrollto value
- $( '#scrollto' ).val( scrollto );
- } );
- - // Only HTML editor: scroll to scrollto value
- - $( '#content' ).scrollTop( $( '#scrollto' ).val() );
- + // Scroll to scrollto value
- + function scroll() {
- + $( 'html' ).scrollTop( $( '#scrollto' ).val() );
- + }
- +
- + setTimeout( scroll, 1500 );
- } )( jQuery );
- -<?php if ( wp_default_editor() == 'tinymce' && ! empty( $mce_settings ) ) : ?>
- -/*
- - * Callback function for TinyMCE setup event
- - * See http://www.tinymce.com/wiki.php/API3:event.tinymce.Editor.onInit
- - */
- -function rich_scroll( ed ) {
- - ed.onInit.add( function() {
- - jQuery( '#content_ifr' ).contents().find( 'body' ).scrollTop( jQuery( '#scrollto' ).val() );
- - } );
- -};
- -<?php endif; ?>
- </script>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement