Skip to content

Commit

Permalink
Improve keyboard docs (slab#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomsbg authored and jhchen committed Apr 16, 2018
1 parent df1d4e4 commit 6ae0875
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/docs/modules/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Some bindings are essential to preventing dangerous browser defaults, such as th

Adding a binding with `quill.keyboard.addBinding` will not run before Quill's because the defaults bindings will have been added by that point.

Pass the `bindings` option to the keyboard module, as an object of handler names to binding config objects. Each binding config must contain `key` and `handler` options, and may optionally include any of the `context` options.

```javascript
var bindings = {
// This will overwrite the default binding also named 'tab'
Expand All @@ -183,9 +185,7 @@ var bindings = {

list: {
key: 'backspace',
context: {
format: ['list']
},
format: ['list'],
handler: function(range, context) {
if (context.offset === 0) {
// When backspace on the first character of a list,
Expand Down

0 comments on commit 6ae0875

Please sign in to comment.