Jump to content

Admin Hot Keys


Soma
 Share

Recommended Posts

Ryan, first time I hear about this. Never had something else bound to Alt other than special chars. And if it's a issue it's there to change for the user. I could change it to ctrl+p which would be print. See where I'm going? :)

Thanks for the feedback Michael. I wasn't really thinking about getting it to work, because it's not broken, it's by intention and something to avoid problems. I think on save yes, as this would be the one making sense.

There's "esc" mapped to close dialogs, but it doesn't work on input focus to you have to shift+tab then hit "esc". Also clicking outside will close it.

You can navigation the tree with tabs and enter to open branches. I'm not sure I want to go this far anyway.

Something like a overlay for the shortcuts would be nice. Still this is basic module to originally give page save shortcuts but turned out much bigger. Also it's global and not on a user basis, and checks to hide templates and fields for editors are still on the plan.

Link to comment
Share on other sites

Very nice module, Soma. What do you think about adding a shortcut to view an overlay with shortcuts cheat sheet? Or even a link to click on somewhere in admin interface, maybe next to profile/logout?

Also maybe some snippets from here to navigate between next/previous items will come in handy to enhance your great module.

Link to comment
Share on other sites

I came late to this, but it's a great idea! Thanks Soma, Will try it right away!

EDIT: on linux i will have to change all the combinations, Same problem as in windows of course...

Link to comment
Share on other sites

  • 8 months later...

Hi!

Ctrl+S saves the page but also opens the browser's "save dialog".

Is it normal, just as ctrl+f4 and other standard shortcuts, or am I doing something wrong?

Actually Ctrl+S is one of several of the little MODX features that I'm miss so much.
 
upd: w7, chrome, FF. PW 2.3
Link to comment
Share on other sites

You can set your own hotkey is the modules settings. I know windows uses ctrl+s is, so you have to use something else.

It's not easy to decide easy hotkeys that work on all platforms and browsers so it is configurable, backdraw is ideally it would also need to be configured per user and not as simple to do as it is now.

It's appreciated if someone likes to take the challenge, I'm happy to collaborate.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

For some reason module throws error:

Error: 	Call to a member function add() on a non-object (line 79 of /var/www/public_html/site/modules/AdminHotKeys/AdminHotKeys.module)

Any idea why this is happening?

I've unistalled module on public site and errors were gone, but when I downloaded files back to local, I got this same error - even when module was unistalled. I got site up and running by doing fresh install with mysql dump from ProcessExportProfile module.

Link to comment
Share on other sites

According to your error this code fails

$this->config->scripts->add($this->config->urls->AdminHotKeys . "jquery.hotkeys.js?v={$version}");

Strange ad it makes absolutely no sense. There's nothing wrong here and it's a common code used in many places in ProcessWire and I have no idea why it would fail there. I tested to make sure it works in all PW versions.

The error says that $this->config->scripts isn't an object, but then PW admin wouldn't work at all, and I see no indication AdminHotKeys screws that up. What PW version do you have installed and what PHP version, any other 3party modules?

Even if a module is uninstalled it will get parsed by php and any error will show. If you want to get rid of a module you ahve to remove it completely.

Link to comment
Share on other sites

Actually we do have a compiler molude which uses $config->scripts and $config->styles for fileset arrays. Basicly we override both arrays on frontend (would explain why $this->config->scripts isn't object anymore), but AdminHotKeys shouldn't do anythig there, am I right?

PW version is latest public 2.3.0 and other installed third party plugins are:

https://github.com/BlowbackDesign/emo

https://github.com/niklaka/ProcessSelectorTest

Plus Ryans:

https://github.com/ryancramerdesign/ImportPagesCSV

https://github.com/ryancramerdesign/ProcessExportProfile

Link to comment
Share on other sites

Ah you get that error on front-end! Yeah then it's because you overwrite $config->scripts. Yeah the module does also get init'd on front-end as all autoload module does, but the hooks also get executed.

I just updated the module now to not add the hooks when on front-end. 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Ctrl+S saves the page but also opens the browser's "save dialog".

Is it normal, just as ctrl+f4 and other standard shortcuts, or am I doing something wrong?

There are long pages in my project, and I'm tired to scroll up/down to save the page.
So I've installed this module again and added this little fellow - "return false" "e.preventDefault()" to the function savePage in AdminHotKeys.js and browser doesn't fire "save dialog box" any more on Ctrl+S.
if($('button[id*="submit"]').length > 0){
	function savePage(e){ $('button[id*="submit"]').trigger('click'); e.preventDefault();};
	$(document).bind('keydown', hkconf.hk_save, savePage);
}

Soma, thx again 4 the module.

upd: fellow changed %)

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

Soma, can you fix version value in the code?

008 result 0.

Thanks!

Ah thanks for mention. It this strange thing with versions when being 008 it threats it as octal number, although when on version 0.0.7, it shows that an update 0.0.8 is available (shows it correct) but after updating it displays 0.0.0. :/ Ryan? :)

Edit: I corrected this with 008 changed to 8.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

It should work fine in 2.5. Just haven't come to test So haven't marked as 2.5 in directory. If you try and it works let me know. I think some update for various admin pages shortcuts needs to get revised but other than that it should be fine.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

Does not properly work with 3.0 - shortcuts for module etc. add "undefined" to the end of the url, page search does not work as well. Page save works…

edit:

Dug into js and found hardcoced selectors… With the new Admin Theme it did not work anymore, had to replace #topnav with #pw-masthead – then it works. I'll attached a file that should work for both versions.

edit 2:

Attached file with fix and some more improvements (like variables moved out of global scope, etc.)

AdminHotKeys.js

edit 3:

The the last file did not yet work with edit-page. This one works with edit page (more like a goto any file…) I have changed the ajax Request to resamble the search field in the upper right of WP3 — not sure if that's the way to go, but it works. Don't know if it also works with PW < 3

AdminHotKeys-3.js

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...