Map Command Enter to behave the same way as CTRL Enter while editing a cell

Posted by: adisa.craig on 18 April 2019, 1:36 am EST

  • Posted 18 April 2019, 1:36 am EST

    Currently while editing a cell the user can press CTRL + Enter to go to a newline, I would like the same behavior to occur when the user presses COMMAND + Enter on a Mac.

    How would I make this happen?
  • Marked as Answer

    Replied 21 April 2019, 7:14 pm EST


    To add additional key combinations that behave the same as ctrl+enter, we could handle keydown event and trigger the ctrl+enter event manually when required.
    Please refer to the following code snippet and let us know if you face any issues:
    spread.bind(GC.Spread.Sheets.Events.EditorStatusChanged, function(e, info){
    if(info.newStatus == GC.Spread.Sheets.EditorStatus.edit || GC.Spread.Sheets.EditorStatus.enter){
    var editor = spread.getHost().querySelector('[gcuielement="gcEditingInput"]');
    editor.addEventListener('keypress', function(e){
    if(e.keyCode == 13 && e.metaKey){
    var kb = new KeyboardEvent('keydown', {
    ctrlKey: true,
    keyCode: 13
    // keyboard event is not supported
    }, true);

  • Replied 23 April 2019, 5:23 am EST

    Thanks the above worked, just had to change the event listener to 'keydown' instead of 'keypress'
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels