Genesis-Visual-Hook-Guide icon indicating copy to clipboard operation
Genesis-Visual-Hook-Guide copied to clipboard

Change div element containing action name to input element for easier selecting and copying

Open salcode opened this issue 8 years ago • 3 comments

@srikat has suggest some interesting ideas with using an input field instead of a div, which makes it easier to copy the hook name.

Additionally, he suggested using JavaScript to select the entire hook name when the name is clicked.

As a proof of concept, he shared something like

printf( '<input class="genesis_hook" type="text" onclick="jQuery(this).select();" value="%s" />', $current_action );

Notes Regarding Final Implementation

  • the CSS will need to be modified (tests are showing a horizontal scroll bar but this can be fixed)
  • ultimately, using plain JavaScript over jQuery seems preferable ( probably not necessary but it feels tidier for a final version 😀 )

salcode avatar Apr 05 '17 19:04 salcode

I've created a simplified version of this plugin which displays all Genesis hooks dynamically, thanks to @salcode's code.

https://github.com/srikat/Genesis-Simple-Hook-Guide

srikat avatar Apr 06 '17 09:04 srikat

@srikat I generally like your changes. My only note here is I think there is a lot of value in having a canonical version of this plugin.

@christophercochran I apologize for the flurry of activity. We all have found so much value in this plugin and appreciate your creating and sharing it.

salcode avatar Apr 06 '17 14:04 salcode

@salcode @srikat This is a very interesting idea. I actually never thought too much of this, cause usually a double click (due to names containing underscores) will auto select the entire hook.

My only concern is depending on themes and their own styles, the input form could become disjointed without a lot of overrides to maintain a cohesive style.

Also, @salcode No need to apologize! I love all this discussion and ideas.

christophercochran avatar Apr 08 '17 17:04 christophercochran