WordPress.org

Ready to get started?Download WordPress

Forums

"Dictionary" quicktag button not cancelling (15 posts)

  1. davincim
    Member
    Posted 9 years ago #

    So I'm testing my comment form, click on my dictionary button in my newly installed quicktags for comments. When I click on cancel in the pop-up though, I'm still taken to dictionary.com.

    What's up with that? I've tried it on another person's blog and the same thing happens.

  2. davincim
    Member
    Posted 9 years ago #

    Anyone else experience this sort of thing?

  3. vkaryl
    Member
    Posted 9 years ago #

    Must be a wrong redirect in a "die" statement?

  4. davincim
    Member
    Posted 9 years ago #

    Hmmm. I need help with translating that please. :)

  5. vkaryl
    Member
    Posted 9 years ago #

    Well, in some functions a "die" statement exists - happens if you cancel an action (like you are saying above) or in some circs if a function doesn't find what it's looking for. In the file will be a "die" statement which will output what should happen when the cancel or not found circumstance occurs.

    So a die statement for your cancel action in the popup isn't calling the proper redirect or close action it sounds like.

  6. davincim
    Member
    Posted 9 years ago #

    Thanks for clarifying, vkaryl. :)

    I guess what's confusing to me is that that the dictionary function is found in the wp-admin/quicktags.js file, so this would have to be happening to everybody, but I couldn't find a mention of it anywhere here.

    I have modified that file before to add some buttons, but I was careful to not touch anything else. I've been wrong before, but I'm stumped on this one. I suppose I could just hide that button, but that wouldn't solve the problem.

    I really do appreciate your help on this. Any more ideas?

  7. vkaryl
    Member
    Posted 9 years ago #

    Well, if you want to email me the relevant code, I'll look at it to see if there's anything wonky that hits me between the eyes [[keep FIRMLY in mind that I am NOT a code-jockey, much LESS any kind of programmer, okay?]]

    sylvermoon (at) gmail (dot) com - try to keep it under a half meg....

  8. davincim
    Member
    Posted 9 years ago #

    You're very kind to offer! Thanks!

  9. vkaryl
    Member
    Posted 9 years ago #

    Gmail's being stupid. I emailed you.

  10. h3h
    Member
    Posted 9 years ago #

    The notion of a "die" statement is somewhat lost in JavaScript.

    What needs to be happening is a check for null returned from the prompt function. Also, it would be smart to do a simple regex test on the string to make sure it's at least a bunch of letters. Without looking at the code I can tell you it has to look something like this:


    var strAnswer = '';
    if ((strAnswer = prompt("Enter the word that you wish to lookup.")) !== null
    && /^\w[\w ]*$/.test(strAnswer))
    {
    // open new window to dictionary.com
    }
    // (else do nothing)

    Has anyone filed a bug for this?

  11. h3h
    Member
    Posted 9 years ago #

  12. h3h
    Member
    Posted 9 years ago #

    Can anyone assign this bug? It's a rather simple fix that could be checked in without much worry.

  13. h3h
    Member
    Posted 9 years ago #

    Nevermind. Checked in.

  14. h3h
    Member
    Posted 9 years ago #

    Added another patch to the bug to make the regex less restrictive.

  15. vkaryl
    Member
    Posted 9 years ago #

    This is apparently fixed in the 1.5.1 upgrade.

Topic Closed

This topic has been closed to new replies.

About this Topic