froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.3k stars 672 forks source link

Keyboard shortcuts throw error if plugin isn't added to toolbar #4015

Open felskov opened 4 years ago

felskov commented 4 years ago

If a plugin is bundled with the library but not applied in the toolbar of an editor instance, then the keyboard shortcuts are still registerred. If the user attempts to use these shortcuts, an exception is thrown because the plugin isn't available inside the editor (I think)

Expected behavior.

No runtime exceptions are thrown, either the keyboard shortcut is silently ignored or it's applied even though the button isn't available in the toolbar.

Actual behavior.

An error is thrown.

Steps to reproduce the problem.
  1. https://jsfiddle.net/hvjc5687/
  2. Use a shortcut to a plugin that isn't applied, for instance quote (Cmd+')
  3. Check the console, an error will be thrown, for instance "Uncaught TypeError: Cannot read property 'quote' of undefined"
Editor version.

3.2.1

OS.

MacOS 10.15.5

Browser.

Chrome Version 84.0.4147.135 (Official Build) (64-bit)

poddarkhushbu07 commented 3 years ago

I am also facing the same issue for insert image.

CTRL+P gives an error in console when the image plugin is not added

polyfills-es2015.bfa5d6ce9c115085c04d.js:1 Uncaught TypeError: Cannot read property 'popups' of undefined