1 | 'use strict';
|
2 |
|
3 | var getCurrentIndent = require('./getCurrentIndent');
|
4 | var indentLines = require('./changes/indentLines');
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function onTab(event, data, change, opts) {
|
11 | var state = change.state;
|
12 |
|
13 | event.preventDefault();
|
14 | event.stopPropagation();
|
15 |
|
16 | var isCollapsed = state.isCollapsed;
|
17 |
|
18 | var indent = getCurrentIndent(opts, state);
|
19 |
|
20 |
|
21 | if (isCollapsed) {
|
22 | return change.insertText(indent).focus();
|
23 | }
|
24 |
|
25 |
|
26 | return indentLines(opts, change, indent);
|
27 | }
|
28 |
|
29 | module.exports = onTab; |
\ | No newline at end of file |