1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | require('slate');
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | function indentLines(opts, change,
|
13 | // Indent to add
|
14 | indent) {
|
15 | var value = change.value;
|
16 | var document = value.document,
|
17 | selection = value.selection;
|
18 |
|
19 | var lines = document.getBlocksAtRange(selection).filter(function (node) {
|
20 | return node.type === opts.lineType;
|
21 | });
|
22 |
|
23 | return lines.reduce(function (c, line) {
|
24 |
|
25 | var text = line.nodes.first();
|
26 | return c.insertTextByKey(text.key, 0, indent);
|
27 | }, change);
|
28 | }
|
29 | exports.default = indentLines; |
\ | No newline at end of file |