Return to Bug report

graphene_get_content_width() broken on WP 4.7.5

Home Forums Graphene WordPress theme Bug report graphene_get_content_width() broken on WP 4.7.5

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10702
    Anonymous

    After updating to Graphene theme 1.9.4.2 (from 1.6.x) on WordPress 4.7.5 my Visual Editor (WYSIWYG) was broken, words were wrapping after 1 letter making it hard to editor posts.

    Narrowed it down to an inject style in #content_ifr.body width style being 0px.

    The buggy code is in options-init.php, function graphene_editor_width, where $content_width is 0;

    I patched by commenting out the “add action” below.

    - Can you explain the intent of this snippet of code?
    - Can you explain why graphene_get_content_width() may be 0 in my case?
    - Our of curiousity, why was setTimeout used here, seems very hack-ish.

    /**
    * Add content width parameter to the WordPress editor
    */
    function graphene_editor_width(){
    global $content_width, $graphene_settings;
    $content_width = graphene_get_content_width();
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    setTimeout( function(){
    $('#content_ifr').contents().find('#tinymce').css( 'width', '<?php echo $content_width; ?>' );
    }, 2000 );
    });
    </script>
    <?php
    }
    //add_action( 'after_wp_tiny_mce', 'graphene_editor_width' ); //BUG

    #46658
    Syahir Hakim
    Keymaster

    In Graphene, the width of the content area of a page may vary due to the following settings:

    – columns layout

    – individual column width

    – overall wrapper width

    All of the above may be modified by the user via the Graphene Options page. As such, we cannot specify a fixed width for the editor since it will likely not reflect the actual width of the content area when displayed on the front end. This is the reason for the dynamic width. The graphene_get_content_width() function is responsible for determining the actual content area width of the current page/post.

    setTimeout is used in order to make sure TinyMCE is fully loaded before we modify the width of the content area. This is to ensure consistency and eliminate the editor loading time causing inconsistent behaviour.

    The graphene_get_content_width() should not return 0, however. If there is a bug, it’s likely that that’s where it is.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.