Map keys control+s to save command on forms#55
Map keys control+s to save command on forms#55C-Lodder merged 5 commits intojoomla:masterfrom dgrammatiko:control-s
Conversation
|
Could u please test on windows @DGT41. Just tested and it's not working |
| * | ||
| * @return string JavaScript command string | ||
| * | ||
| * @since 3.0 |
There was a problem hiding this comment.
3.0 ? Should this not be __DEPLOY_VERSION__ or 4.0?
|
Doesn't work for me on macbook either |
|
For mac is command+s By the way which view did you try? (article edit) |
|
yes i did that (george here) - it tried to save html contents of the page. i did also read your js :P |
media/system/js/core.js
Outdated
| // Initiate the listener for the combo key | ||
| document.addEventListener( 'DOMContentLoaded', function() { | ||
| if (Joomla.getOptions( 'keySave' ) ) { | ||
| Joomla.keysave( Joomla.getOptions( 'keySave' ).task ); |
There was a problem hiding this comment.
can you insert a console.log(Joomla.getOptions( 'keySave' ).task); before this line?
what it is in the console?
media/system/js/core.js
Outdated
| if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { | ||
| e.preventDefault(); | ||
| Joomla.submitbutton.call(button) | ||
| } |
There was a problem hiding this comment.
Joomla.submitbutton(button);
@C-Lodder try with the above code
|
Ok I know the issue now. You can't be focused on the editor when using This only happens with TinyMCE. |
media/system/js/core.js
Outdated
| */ | ||
| Joomla.keysave = function ( button ) { | ||
| document.addEventListener("keydown", function(e) { | ||
| if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { |
There was a problem hiding this comment.
add a console.log(''pressed: ' + e.keyCode + ' and ' + e.ctrlKey );
What happens when you press keys?
There was a problem hiding this comment.
or try
if (String.fromCharCode(e.which).toLowerCase() == 's' && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {There was a problem hiding this comment.
British keyboards, I guess your s is mapped to some other keyCode 😄
|
Tiny mce loads in an iframe so i guess the iframe doesn't load the keybindings (george) |
|
Ahh, crap, I didn;t try it with focus in tiny window (?) |
|
xD |
layouts/joomla/toolbar/apply.php
Outdated
| } | ||
| else | ||
| { | ||
| JHtml::_('behavior.core'); |
There was a problem hiding this comment.
behaviour core is being loaded in the if and the else can we just load it outside the if and then remove the else?
|
Go for it then :) |
|
@DGT41 - Forget the research, already solved it:
This is the only bit of code you need, so you can revert all the other changes you've made. |
|
The only problem is that |
|
last commit:
NOTE: if you haven't change anything in the editor area (no new text, etc) the save will not initiate! With this ctrl+s works on all editors that comes with Joomla |
|
All working now :) |
Pull Request for Issue # .
Summary of Changes
Testing Instructions
Documentation Changes Required