WordPress.org

Support

Support » Requests and Feedback » Keyboard shortcuts selected text in the post edi

Keyboard shortcuts selected text in the post edi

  • 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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;
    }</pre>
    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);
    sel.select();
    }</pre>
    and that did the trick for me! Honestly IE has horrible support for this type of code, so be understanding! 😉

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

    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. =)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keyboard shortcuts selected text in the post edi’ is closed to new replies.
Skip to toolbar