Keyboard shortcuts + selected text in the post edi (4 posts)

  1. Anonymous
    Posted 12 years ago #

    Would it be a much work to allow the keyboard shortcuts in the post editor (e.g. alt+i, alt+b, etc.) to work on text selections?
    For example, it would be nice if I could select some text, press alt+i, and have that text surrounded automatically by and tags.

  2. Stevarino
    Posted 12 years ago #

    it works in mozilla. :)
    But firing up IE shows that you're right, it doesn't work. It shouldn't be that hard, an old project of mine was just that.
    You need to change the "wp-admin/quicktags.js" file (you can do that from the template screen by typing that into the edit box). Look for this block (a notepad find might help):
    <pre>if (sel.text.length > 0) {
    sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
    Change that to:
    <pre>if (sel.text.length > 0) {
    tag = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
    sel.text = tag;
    sel.moveStart('character', -tag.length);
    and that did the trick for me! Honestly IE has horrible support for this type of code, so be understanding! ;)

  3. Stevarino
    Posted 12 years ago #

    actually disregard that. it won't hurt anything, but it doesn't solve the problem.... What is going on here?

  4. Anonymous
    Posted 12 years ago #

    Ah, ok. It's good to know that it's supposed to work.
    Curiously, the buttons work fine with selected text, but the keyboard shortcuts don't.
    In the meantime, I'll use Mozilla Firefox. =)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.