1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | require('slate');
|
8 |
|
9 | var _utils = require('../utils');
|
10 |
|
11 | var _changes = require('../changes');
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function onTab(opts, event, change, editor) {
|
18 | var value = change.value;
|
19 |
|
20 | event.preventDefault();
|
21 | event.stopPropagation();
|
22 |
|
23 | var isCollapsed = value.isCollapsed;
|
24 |
|
25 | var indent = (0, _utils.getCurrentIndent)(opts, value);
|
26 |
|
27 |
|
28 | if (isCollapsed) {
|
29 | return change.insertText(indent).focus();
|
30 | }
|
31 |
|
32 |
|
33 | return (0, _changes.indentLines)(opts, change, indent);
|
34 | }
|
35 | exports.default = onTab; |
\ | No newline at end of file |