For example, if only the Bold and Italic buttons are enabled, users can still use shortcuts like Ctrl+U to underline text, or Ctrl+L to make a link.

I would like to limit the formatting options to the enabled buttons, to avoid for example underlined text, which I think should be reserved for links.

Wysiwyg 6.x-2.4 and CKEditor 3.6.1

Comments

twod’s picture

Title: Shortcuts work, even though buttons are not enabled » Disable keyboard shortcuts
Category: Bug report » Support request
Issue summary: View changes
Status: Active » Closed (fixed)

Apologies for the extremely long wait. I simply did not see this issue until now.

The shortcuts in CKEditor (3) are handled by the keystrokes plugin, which has two settings: keystrokes and blockedKeystrokes.
I'm planning to expand the profile editing GUI with plugin settings later, but until then you can implement hook_wysiwyg_editor_settings_alter() and override these settings yourself.

Example:

function mymodule_wysiwyg_editor_settings_alter(&$settings, $context) {
  $ctrl = 1000; // Ctrl key
  if ($context['profile']->editor == 'ckeditor') {
    $settings['blockedKeystrokes'] = array(
        $ctrl + 76, // L (link)
        $ctrl + 85, // U (underline)
    );
  }
}
ressa’s picture

Thanks! I am guessing hook_wysiwyg_editor_settings_alter() will also work with the CKEditor module?

twod’s picture

No it won't. That hook is only invoked by Wysiwyg module and CKEditor module is a separate project. They may have a similar hook now though, I haven't checked.

ressa’s picture

Ok, thanks for clarifying.