• Resolved Rasso Hilber

    (@nonverbla)


    Hi there!

    First of all: Using and loving your plugin ever since it’s release!

    In the newest release though, there is a bug: When re-ordering, the spinning wheel stays and I get a javascript error saying
    TypeError: i.querySelector(...) is null

    It happens on the normal posts edit screen, which I activated following your instructions. On the pages edit screen, it works fine.

    Testing it there, I just found another “bug”: When you use the translation plugin qtranslate, the title of posts / pages always has to go through the default post title filters, so that language brackets won’t get printed. After reordering, I think because the updated post title comes from your javascript, the title says something like this:

    <!--:en-->About<!--:--><!--:de-->über uns<!--:-->

    When I reload the page, the title is displayed correctly again.

    I both cases, actual re-ordering works fine, both errors just make the plugin ‘feel broken’.

    Hopefully, the hints will be helpful for you.

    https://www.ads-software.com/extend/plugins/simple-page-ordering/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jake Goldman

    (@jakemgold)

    Totally missed a bug in my testing where custom post types that had EITHER page-attributes or hierarchical support (but not both) would break. Fixed in 2.1.1!

    Not planning to add special support for qTranslate, which does some really janky stuff to accomplish its goal, but patches would be welcome…

    Thread Starter Rasso Hilber

    (@nonverbla)

    Hi Jake, thank you very much, the js-error is gone with the new version!

    Concerning the problems with qtranslate, I figured out what the problem is. Your script gets the updated post title from the hidden quick-edit field “.post_title”, which isn’t converted by qtranslate. Actually, I totally forgot about the quick-edit feature over the years, because in my setups, it is always deactivated ??

    I ‘fixed’ this by replacing this line in your code (line 25 in dev.js):

    var post_title = inline_key.querySelector('.post_title').innerHTML;

    …with this:

    var post_title = inline_key.parentNode.querySelector('.row-title').innerHTML;
    
    while(post_title.indexOf("— ") == 0){
        post_title = post_title.substr(2);
    }

    I can imagine, that this method is even more future-proof, because it is based on the field the user actually sees before re-ordering.

    What are your thoughts?

    Thread Starter Rasso Hilber

    (@nonverbla)

    Hi again,
    I have written a workaround. Load this js in the edit.php, it will fix the “error” with the qtranslate brackets:

    $(document).ready(function(){
        // Replace the .post_title with the .row-title, so that titles won't seem broken after re-ordering
        $(".edit-php .wp-list-table .column-title").each(function(){
            $(this).find(".post_title").text($(this).find(".row-title").text());
        })
    })

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘TypeError: i.querySelector(…) is null’ is closed to new replies.