This is a migrated thread and some comments may be shown as answers.

Firefox issue OnClientCommandExecuting

1 Answer 6 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Hiram
Top achievements
Rank 1
Hiram asked on 20 Nov 2015, 05:51 PM

I have a problem with firefox, I'm using this event(OnClientCommandExecuting) to cancel some(not all) shortcuts and works perfectly with chrome, when i try with firefox works very well with the shorcuts, except for the Shift+Enter  when i press this key combination in firefox the event is not even fired, could you help me please?

 

function OnClientCommandExecuting(editor, args)
{
     var liTag = editor.getSelectedElement();
     var commandName = args.get_commandName();
 
     .....
}

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 23 Nov 2015, 10:48 AM
Hi Hiram,

Shift+Enter executes a command only in Chrome and Safari. In Firefox and IE, the browser itself handles the Shift+Enter shortcut and adds a br tag in the content. 

In this case you can handle the situation with two possible options:
  • Handling the onkeydown DOM event of the content area, capture the shortcut and execute the logic needed;

  • or Using the ShortcutManager object to unify the command to work in all browsers:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientCommandExecuting="OnClientCommandExecuting" OnClientLoad="OnClientLoad">
    </telerik:RadEditor>
     
    <script>
        function OnClientLoad(editor, args) {
            editor.get_shortCutManager().addShortCut("ShiftEnterSafari", "Shift+Enter");
        }
     
        function OnClientCommandExecuting(editor, args) {
            console.log("CommandName: " + args.get_commandName());
        }
    </script>


Regards,

Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
Hiram
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or