@pie-element/ebsr 6.6.3-next.411 → 6.6.3-next.412
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/node_modules/immutable/LICENSE +21 -0
- package/configure/node_modules/immutable/README.md +657 -0
- package/configure/node_modules/immutable/dist/immutable-nonambient.d.ts +5607 -0
- package/configure/node_modules/immutable/dist/immutable.d.ts +5611 -0
- package/configure/node_modules/immutable/dist/immutable.es.js +5893 -0
- package/configure/node_modules/immutable/dist/immutable.js +5948 -0
- package/configure/node_modules/immutable/dist/immutable.js.flow +2340 -0
- package/configure/node_modules/immutable/dist/immutable.min.js +55 -0
- package/configure/node_modules/immutable/package.json +41 -0
- package/configure/node_modules/slate-edit-list/CHANGELOG.md +124 -0
- package/configure/node_modules/slate-edit-list/LICENSE +201 -0
- package/configure/node_modules/slate-edit-list/README.md +159 -0
- package/configure/node_modules/slate-edit-list/dist/changes/decreaseItemDepth.js +73 -0
- package/configure/node_modules/slate-edit-list/dist/changes/decreaseItemDepth.js.flow +88 -0
- package/configure/node_modules/slate-edit-list/dist/changes/increaseItemDepth.js +70 -0
- package/configure/node_modules/slate-edit-list/dist/changes/increaseItemDepth.js.flow +77 -0
- package/configure/node_modules/slate-edit-list/dist/changes/index.js +34 -0
- package/configure/node_modules/slate-edit-list/dist/changes/index.js.flow +13 -0
- package/configure/node_modules/slate-edit-list/dist/changes/splitListItem.js +27 -0
- package/configure/node_modules/slate-edit-list/dist/changes/splitListItem.js.flow +26 -0
- package/configure/node_modules/slate-edit-list/dist/changes/unwrapList.js +52 -0
- package/configure/node_modules/slate-edit-list/dist/changes/unwrapList.js.flow +46 -0
- package/configure/node_modules/slate-edit-list/dist/changes/wrapInList.js +67 -0
- package/configure/node_modules/slate-edit-list/dist/changes/wrapInList.js.flow +67 -0
- package/configure/node_modules/slate-edit-list/dist/core.js +80 -0
- package/configure/node_modules/slate-edit-list/dist/core.js.flow +76 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/index.js +24 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/index.js.flow +5 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onBackspace.js +45 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onBackspace.js.flow +44 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onEnter.js +54 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onEnter.js.flow +54 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onTab.js +39 -0
- package/configure/node_modules/slate-edit-list/dist/handlers/onTab.js.flow +34 -0
- package/configure/node_modules/slate-edit-list/dist/index.js +58 -0
- package/configure/node_modules/slate-edit-list/dist/index.js.flow +45 -0
- package/configure/node_modules/slate-edit-list/dist/options.js +34 -0
- package/configure/node_modules/slate-edit-list/dist/options.js.flow +26 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getCurrentItem.js +24 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getCurrentItem.js.flow +20 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getCurrentList.js +31 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getCurrentList.js.flow +21 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getItemDepth.js +34 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getItemDepth.js.flow +24 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getItemsAtRange.js +60 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getItemsAtRange.js.flow +51 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getListForItem.js +25 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getListForItem.js.flow +16 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getPreviousItem.js +39 -0
- package/configure/node_modules/slate-edit-list/dist/utils/getPreviousItem.js.flow +29 -0
- package/configure/node_modules/slate-edit-list/dist/utils/index.js +49 -0
- package/configure/node_modules/slate-edit-list/dist/utils/index.js.flow +19 -0
- package/configure/node_modules/slate-edit-list/dist/utils/isList.js +15 -0
- package/configure/node_modules/slate-edit-list/dist/utils/isList.js.flow +13 -0
- package/configure/node_modules/slate-edit-list/dist/utils/isSelectionInList.js +22 -0
- package/configure/node_modules/slate-edit-list/dist/utils/isSelectionInList.js.flow +14 -0
- package/configure/node_modules/slate-edit-list/dist/validation/index.js +19 -0
- package/configure/node_modules/slate-edit-list/dist/validation/index.js.flow +4 -0
- package/configure/node_modules/slate-edit-list/dist/validation/schema.js +83 -0
- package/configure/node_modules/slate-edit-list/dist/validation/schema.js.flow +81 -0
- package/configure/node_modules/slate-edit-list/dist/validation/validateNode.js +61 -0
- package/configure/node_modules/slate-edit-list/dist/validation/validateNode.js.flow +61 -0
- package/configure/node_modules/slate-edit-list/package.json +67 -0
- package/configure/node_modules/slate-edit-table/CHANGELOG.md +192 -0
- package/configure/node_modules/slate-edit-table/LICENSE +201 -0
- package/configure/node_modules/slate-edit-table/README.md +269 -0
- package/configure/node_modules/slate-edit-table/dist/changes/clearCell.js +29 -0
- package/configure/node_modules/slate-edit-table/dist/changes/clearCell.js.flow +26 -0
- package/configure/node_modules/slate-edit-table/dist/changes/index.js +69 -0
- package/configure/node_modules/slate-edit-table/dist/changes/index.js.flow +27 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertColumn.js +43 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertColumn.js.flow +46 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertRow.js +36 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertRow.js.flow +35 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertTable.js +29 -0
- package/configure/node_modules/slate-edit-table/dist/changes/insertTable.js.flow +27 -0
- package/configure/node_modules/slate-edit-table/dist/changes/moveSelection.js +32 -0
- package/configure/node_modules/slate-edit-table/dist/changes/moveSelection.js.flow +31 -0
- package/configure/node_modules/slate-edit-table/dist/changes/moveSelectionBy.js +84 -0
- package/configure/node_modules/slate-edit-table/dist/changes/moveSelectionBy.js.flow +80 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeColumn.js +36 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeColumn.js.flow +28 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeColumnByKey.js +52 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeColumnByKey.js.flow +40 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeRow.js +36 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeRow.js.flow +27 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeRowByKey.js +41 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeRowByKey.js.flow +30 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeTable.js +26 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeTable.js.flow +17 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeTableByKey.js +56 -0
- package/configure/node_modules/slate-edit-table/dist/changes/removeTableByKey.js.flow +54 -0
- package/configure/node_modules/slate-edit-table/dist/core.js +88 -0
- package/configure/node_modules/slate-edit-table/dist/core.js.flow +94 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/index.js +39 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/index.js.flow +8 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onBackspace.js +82 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onBackspace.js.flow +87 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onEnter.js +34 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onEnter.js.flow +37 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onKeyDown.js +71 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onKeyDown.js.flow +56 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onModEnter.js +35 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onModEnter.js.flow +38 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onTab.js +56 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onTab.js.flow +51 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onUpDown.js +38 -0
- package/configure/node_modules/slate-edit-table/dist/handlers/onUpDown.js.flow +41 -0
- package/configure/node_modules/slate-edit-table/dist/index.js +36 -0
- package/configure/node_modules/slate-edit-table/dist/index.js.flow +27 -0
- package/configure/node_modules/slate-edit-table/dist/options.js +61 -0
- package/configure/node_modules/slate-edit-table/dist/options.js.flow +42 -0
- package/configure/node_modules/slate-edit-table/dist/utils/TablePosition.js +306 -0
- package/configure/node_modules/slate-edit-table/dist/utils/TablePosition.js.flow +211 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createCell.js +30 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createCell.js.flow +26 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createRow.js +30 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createRow.js.flow +28 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createTable.js +30 -0
- package/configure/node_modules/slate-edit-table/dist/utils/createTable.js.flow +33 -0
- package/configure/node_modules/slate-edit-table/dist/utils/forEachCells.js +21 -0
- package/configure/node_modules/slate-edit-table/dist/utils/forEachCells.js.flow +22 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtColumn.js +22 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtColumn.js.flow +19 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtRow.js +20 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtRow.js.flow +19 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getPosition.js +24 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getPosition.js.flow +19 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getPositionByKey.js +26 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getPositionByKey.js.flow +21 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getRow.js +24 -0
- package/configure/node_modules/slate-edit-table/dist/utils/getRow.js.flow +19 -0
- package/configure/node_modules/slate-edit-table/dist/utils/index.js +64 -0
- package/configure/node_modules/slate-edit-table/dist/utils/index.js.flow +25 -0
- package/configure/node_modules/slate-edit-table/dist/utils/isSelectionInTable.js +34 -0
- package/configure/node_modules/slate-edit-table/dist/utils/isSelectionInTable.js.flow +27 -0
- package/configure/node_modules/slate-edit-table/dist/utils/isSelectionOutOfTable.js +30 -0
- package/configure/node_modules/slate-edit-table/dist/utils/isSelectionOutOfTable.js.flow +23 -0
- package/configure/node_modules/slate-edit-table/dist/validation/index.js +19 -0
- package/configure/node_modules/slate-edit-table/dist/validation/index.js.flow +4 -0
- package/configure/node_modules/slate-edit-table/dist/validation/schema.js +101 -0
- package/configure/node_modules/slate-edit-table/dist/validation/schema.js.flow +98 -0
- package/configure/node_modules/slate-edit-table/dist/validation/validateNode.js +56 -0
- package/configure/node_modules/slate-edit-table/dist/validation/validateNode.js.flow +49 -0
- package/configure/node_modules/slate-edit-table/package.json +69 -0
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Run the given function against each cells of the table
|
|
11
|
+
*/
|
|
12
|
+
function forEachCells(opts,
|
|
13
|
+
// The table
|
|
14
|
+
table, fn) {
|
|
15
|
+
return table.nodes.forEach(function (row, rowIndex) {
|
|
16
|
+
return row.nodes.forEach(function (cell, columnIndex) {
|
|
17
|
+
return fn(cell, rowIndex, columnIndex);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.default = forEachCells;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Block } from 'slate';
|
|
3
|
+
|
|
4
|
+
import type Options from '../options';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Run the given function against each cells of the table
|
|
8
|
+
*/
|
|
9
|
+
function forEachCells(
|
|
10
|
+
opts: Options,
|
|
11
|
+
// The table
|
|
12
|
+
table: Block,
|
|
13
|
+
fn: (cell: Block, row: number, column: number) => any
|
|
14
|
+
): void {
|
|
15
|
+
return table.nodes.forEach((row, rowIndex) =>
|
|
16
|
+
row.nodes.forEach((cell, columnIndex) =>
|
|
17
|
+
fn(cell, rowIndex, columnIndex)
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default forEachCells;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
require('immutable');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the list of cells at the given column index
|
|
13
|
+
*/
|
|
14
|
+
function getCellsAtColumn(opts,
|
|
15
|
+
// The table
|
|
16
|
+
table, columnIndex) {
|
|
17
|
+
return table.nodes.map(function (row) {
|
|
18
|
+
return row.nodes.get(columnIndex);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.default = getCellsAtColumn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Block } from 'slate';
|
|
3
|
+
import { type List } from 'immutable';
|
|
4
|
+
|
|
5
|
+
import type Options from '../options';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the list of cells at the given column index
|
|
9
|
+
*/
|
|
10
|
+
function getCellsAtColumn(
|
|
11
|
+
opts: Options,
|
|
12
|
+
// The table
|
|
13
|
+
table: Block,
|
|
14
|
+
columnIndex: number
|
|
15
|
+
): List<Block> {
|
|
16
|
+
return table.nodes.map(row => row.nodes.get(columnIndex));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default getCellsAtColumn;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
require('immutable');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the list of cells at the given row index
|
|
13
|
+
*/
|
|
14
|
+
function getCellsAtRow(opts,
|
|
15
|
+
// The table
|
|
16
|
+
table, rowIndex) {
|
|
17
|
+
return table.nodes.get(rowIndex).nodes;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.default = getCellsAtRow;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Block } from 'slate';
|
|
3
|
+
import { type List } from 'immutable';
|
|
4
|
+
|
|
5
|
+
import type Options from '../options';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the list of cells at the given row index
|
|
9
|
+
*/
|
|
10
|
+
function getCellsAtRow(
|
|
11
|
+
opts: Options,
|
|
12
|
+
// The table
|
|
13
|
+
table: Block,
|
|
14
|
+
rowIndex: number
|
|
15
|
+
): List<Block> {
|
|
16
|
+
return table.nodes.get(rowIndex).nodes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default getCellsAtRow;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
var _TablePosition = require('./TablePosition');
|
|
10
|
+
|
|
11
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The position of the selection start block, in the current table
|
|
17
|
+
*/
|
|
18
|
+
function getPosition(opts,
|
|
19
|
+
// The current value
|
|
20
|
+
value) {
|
|
21
|
+
return _TablePosition2.default.create(opts, value.document, value.startKey);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.default = getPosition;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Value } from 'slate';
|
|
3
|
+
|
|
4
|
+
import type Options from '../options';
|
|
5
|
+
|
|
6
|
+
import TablePosition from './TablePosition';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The position of the selection start block, in the current table
|
|
10
|
+
*/
|
|
11
|
+
function getPosition(
|
|
12
|
+
opts: Options,
|
|
13
|
+
// The current value
|
|
14
|
+
value: Value
|
|
15
|
+
): TablePosition {
|
|
16
|
+
return TablePosition.create(opts, value.document, value.startKey);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default getPosition;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
var _TablePosition = require('./TablePosition');
|
|
10
|
+
|
|
11
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* The position of a particular node, in the current table
|
|
17
|
+
*/
|
|
18
|
+
function getPositionByKey(opts,
|
|
19
|
+
// The current value
|
|
20
|
+
containerNode,
|
|
21
|
+
// Key of the node in desired position
|
|
22
|
+
key) {
|
|
23
|
+
return _TablePosition2.default.create(opts, containerNode, key);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.default = getPositionByKey;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Node } from 'slate';
|
|
3
|
+
|
|
4
|
+
import type Options from '../options';
|
|
5
|
+
|
|
6
|
+
import TablePosition from './TablePosition';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* The position of a particular node, in the current table
|
|
10
|
+
*/
|
|
11
|
+
function getPositionByKey(
|
|
12
|
+
opts: Options,
|
|
13
|
+
// The current value
|
|
14
|
+
containerNode: Node,
|
|
15
|
+
// Key of the node in desired position
|
|
16
|
+
key: string
|
|
17
|
+
): TablePosition {
|
|
18
|
+
return TablePosition.create(opts, containerNode, key);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default getPositionByKey;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
require('slate');
|
|
8
|
+
|
|
9
|
+
var _TablePosition = require('./TablePosition');
|
|
10
|
+
|
|
11
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The position of the selection start block, in the current table
|
|
17
|
+
*/
|
|
18
|
+
function getPosition(opts,
|
|
19
|
+
// The current value
|
|
20
|
+
value) {
|
|
21
|
+
return _TablePosition2.default.create(opts, value.document, value.startKey);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.default = getPosition;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { type Value } from 'slate';
|
|
3
|
+
|
|
4
|
+
import type Options from '../options';
|
|
5
|
+
|
|
6
|
+
import TablePosition from './TablePosition';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The position of the selection start block, in the current table
|
|
10
|
+
*/
|
|
11
|
+
function getPosition(
|
|
12
|
+
opts: Options,
|
|
13
|
+
// The current value
|
|
14
|
+
value: Value
|
|
15
|
+
): TablePosition {
|
|
16
|
+
return TablePosition.create(opts, value.document, value.startKey);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default getPosition;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createTable = exports.createRow = exports.createCell = exports.TablePosition = exports.isSelectionOutOfTable = exports.isSelectionInTable = exports.getCellsAtColumn = exports.getCellsAtRow = exports.forEachCells = exports.getPositionByKey = exports.getPosition = undefined;
|
|
7
|
+
|
|
8
|
+
var _createCell = require('./createCell');
|
|
9
|
+
|
|
10
|
+
var _createCell2 = _interopRequireDefault(_createCell);
|
|
11
|
+
|
|
12
|
+
var _createRow = require('./createRow');
|
|
13
|
+
|
|
14
|
+
var _createRow2 = _interopRequireDefault(_createRow);
|
|
15
|
+
|
|
16
|
+
var _createTable = require('./createTable');
|
|
17
|
+
|
|
18
|
+
var _createTable2 = _interopRequireDefault(_createTable);
|
|
19
|
+
|
|
20
|
+
var _getPosition = require('./getPosition');
|
|
21
|
+
|
|
22
|
+
var _getPosition2 = _interopRequireDefault(_getPosition);
|
|
23
|
+
|
|
24
|
+
var _getPositionByKey = require('./getPositionByKey');
|
|
25
|
+
|
|
26
|
+
var _getPositionByKey2 = _interopRequireDefault(_getPositionByKey);
|
|
27
|
+
|
|
28
|
+
var _isSelectionInTable = require('./isSelectionInTable');
|
|
29
|
+
|
|
30
|
+
var _isSelectionInTable2 = _interopRequireDefault(_isSelectionInTable);
|
|
31
|
+
|
|
32
|
+
var _isSelectionOutOfTable = require('./isSelectionOutOfTable');
|
|
33
|
+
|
|
34
|
+
var _isSelectionOutOfTable2 = _interopRequireDefault(_isSelectionOutOfTable);
|
|
35
|
+
|
|
36
|
+
var _TablePosition = require('./TablePosition');
|
|
37
|
+
|
|
38
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
39
|
+
|
|
40
|
+
var _forEachCells = require('./forEachCells');
|
|
41
|
+
|
|
42
|
+
var _forEachCells2 = _interopRequireDefault(_forEachCells);
|
|
43
|
+
|
|
44
|
+
var _getCellsAtRow = require('./getCellsAtRow');
|
|
45
|
+
|
|
46
|
+
var _getCellsAtRow2 = _interopRequireDefault(_getCellsAtRow);
|
|
47
|
+
|
|
48
|
+
var _getCellsAtColumn = require('./getCellsAtColumn');
|
|
49
|
+
|
|
50
|
+
var _getCellsAtColumn2 = _interopRequireDefault(_getCellsAtColumn);
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
+
|
|
54
|
+
exports.getPosition = _getPosition2.default;
|
|
55
|
+
exports.getPositionByKey = _getPositionByKey2.default;
|
|
56
|
+
exports.forEachCells = _forEachCells2.default;
|
|
57
|
+
exports.getCellsAtRow = _getCellsAtRow2.default;
|
|
58
|
+
exports.getCellsAtColumn = _getCellsAtColumn2.default;
|
|
59
|
+
exports.isSelectionInTable = _isSelectionInTable2.default;
|
|
60
|
+
exports.isSelectionOutOfTable = _isSelectionOutOfTable2.default;
|
|
61
|
+
exports.TablePosition = _TablePosition2.default;
|
|
62
|
+
exports.createCell = _createCell2.default;
|
|
63
|
+
exports.createRow = _createRow2.default;
|
|
64
|
+
exports.createTable = _createTable2.default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import createCell from './createCell';
|
|
2
|
+
import createRow from './createRow';
|
|
3
|
+
import createTable from './createTable';
|
|
4
|
+
import getPosition from './getPosition';
|
|
5
|
+
import getPositionByKey from './getPositionByKey';
|
|
6
|
+
import isSelectionInTable from './isSelectionInTable';
|
|
7
|
+
import isSelectionOutOfTable from './isSelectionOutOfTable';
|
|
8
|
+
import TablePosition from './TablePosition';
|
|
9
|
+
import forEachCells from './forEachCells';
|
|
10
|
+
import getCellsAtRow from './getCellsAtRow';
|
|
11
|
+
import getCellsAtColumn from './getCellsAtColumn';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
getPosition,
|
|
15
|
+
getPositionByKey,
|
|
16
|
+
forEachCells,
|
|
17
|
+
getCellsAtRow,
|
|
18
|
+
getCellsAtColumn,
|
|
19
|
+
isSelectionInTable,
|
|
20
|
+
isSelectionOutOfTable,
|
|
21
|
+
TablePosition,
|
|
22
|
+
createCell,
|
|
23
|
+
createRow,
|
|
24
|
+
createTable
|
|
25
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _TablePosition = require('./TablePosition');
|
|
8
|
+
|
|
9
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Is the selection in a table
|
|
15
|
+
*/
|
|
16
|
+
function isSelectionInTable(opts, value) {
|
|
17
|
+
if (!value.selection.startKey) return false;
|
|
18
|
+
|
|
19
|
+
var startKey = value.startKey,
|
|
20
|
+
endKey = value.endKey;
|
|
21
|
+
|
|
22
|
+
var startPosition = _TablePosition2.default.create(opts, value.document, startKey);
|
|
23
|
+
var endPosition = _TablePosition2.default.create(opts, value.document, endKey);
|
|
24
|
+
|
|
25
|
+
// Only handle events in tables
|
|
26
|
+
if (!startPosition.isInTable() || !endPosition.isInTable()) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Inside the same table
|
|
31
|
+
return startPosition.table === endPosition.table;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.default = isSelectionInTable;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import type { Value } from 'slate';
|
|
4
|
+
|
|
5
|
+
import TablePosition from './TablePosition';
|
|
6
|
+
import type Options from '../options';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Is the selection in a table
|
|
10
|
+
*/
|
|
11
|
+
function isSelectionInTable(opts: Options, value: Value): boolean {
|
|
12
|
+
if (!value.selection.startKey) return false;
|
|
13
|
+
|
|
14
|
+
const { startKey, endKey } = value;
|
|
15
|
+
const startPosition = TablePosition.create(opts, value.document, startKey);
|
|
16
|
+
const endPosition = TablePosition.create(opts, value.document, endKey);
|
|
17
|
+
|
|
18
|
+
// Only handle events in tables
|
|
19
|
+
if (!startPosition.isInTable() || !endPosition.isInTable()) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Inside the same table
|
|
24
|
+
return startPosition.table === endPosition.table;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default isSelectionInTable;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _TablePosition = require('./TablePosition');
|
|
8
|
+
|
|
9
|
+
var _TablePosition2 = _interopRequireDefault(_TablePosition);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Are the selection start and end outside a table.
|
|
15
|
+
*/
|
|
16
|
+
function isSelectionOutOfTable(opts, value) {
|
|
17
|
+
if (!value.selection.startKey) return false;
|
|
18
|
+
|
|
19
|
+
var startKey = value.startKey,
|
|
20
|
+
endKey = value.endKey;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var startPosition = _TablePosition2.default.create(opts, value.document, startKey);
|
|
24
|
+
var endPosition = _TablePosition2.default.create(opts, value.document, endKey);
|
|
25
|
+
|
|
26
|
+
// Only handle events in tables
|
|
27
|
+
return !startPosition.isInTable() && !endPosition.isInTable();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.default = isSelectionOutOfTable;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import type { Value } from 'slate';
|
|
4
|
+
|
|
5
|
+
import TablePosition from './TablePosition';
|
|
6
|
+
import type Options from '../options';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Are the selection start and end outside a table.
|
|
10
|
+
*/
|
|
11
|
+
function isSelectionOutOfTable(opts: Options, value: Value): boolean {
|
|
12
|
+
if (!value.selection.startKey) return false;
|
|
13
|
+
|
|
14
|
+
const { startKey, endKey } = value;
|
|
15
|
+
|
|
16
|
+
const startPosition = TablePosition.create(opts, value.document, startKey);
|
|
17
|
+
const endPosition = TablePosition.create(opts, value.document, endKey);
|
|
18
|
+
|
|
19
|
+
// Only handle events in tables
|
|
20
|
+
return !startPosition.isInTable() && !endPosition.isInTable();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default isSelectionOutOfTable;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateNode = exports.schema = undefined;
|
|
7
|
+
|
|
8
|
+
var _schema = require('./schema');
|
|
9
|
+
|
|
10
|
+
var _schema2 = _interopRequireDefault(_schema);
|
|
11
|
+
|
|
12
|
+
var _validateNode = require('./validateNode');
|
|
13
|
+
|
|
14
|
+
var _validateNode2 = _interopRequireDefault(_validateNode);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
exports.schema = _schema2.default;
|
|
19
|
+
exports.validateNode = _validateNode2.default;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _slate = require('slate');
|
|
8
|
+
|
|
9
|
+
var _slateSchemaViolations = require('slate-schema-violations');
|
|
10
|
+
|
|
11
|
+
var _utils = require('../utils');
|
|
12
|
+
|
|
13
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Returns a schema definition for the plugin
|
|
17
|
+
*/
|
|
18
|
+
function schema(opts) {
|
|
19
|
+
var _blocks;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
blocks: (_blocks = {}, _defineProperty(_blocks, opts.typeTable, {
|
|
23
|
+
nodes: [{ types: [opts.typeRow] }]
|
|
24
|
+
}), _defineProperty(_blocks, opts.typeRow, {
|
|
25
|
+
nodes: [{ types: [opts.typeCell] }],
|
|
26
|
+
parent: { types: [opts.typeTable] },
|
|
27
|
+
normalize: function normalize(change, violation, context) {
|
|
28
|
+
switch (violation) {
|
|
29
|
+
case _slateSchemaViolations.CHILD_TYPE_INVALID:
|
|
30
|
+
return onlyCellsInRow(opts, change, context);
|
|
31
|
+
case _slateSchemaViolations.PARENT_TYPE_INVALID:
|
|
32
|
+
return rowOnlyInTable(opts, change, context);
|
|
33
|
+
default:
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}), _defineProperty(_blocks, opts.typeCell, {
|
|
38
|
+
nodes: [{ objects: ['block'] }],
|
|
39
|
+
parent: { types: [opts.typeRow] },
|
|
40
|
+
normalize: function normalize(change, violation, context) {
|
|
41
|
+
switch (violation) {
|
|
42
|
+
case _slateSchemaViolations.CHILD_OBJECT_INVALID:
|
|
43
|
+
return onlyBlocksInCell(opts, change, context);
|
|
44
|
+
case _slateSchemaViolations.PARENT_TYPE_INVALID:
|
|
45
|
+
return cellOnlyInRow(opts, change, context);
|
|
46
|
+
default:
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}), _blocks)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* A row's children must be cells.
|
|
56
|
+
* If they're not then we wrap them within a cell.
|
|
57
|
+
*/
|
|
58
|
+
function onlyCellsInRow(opts, change, context) {
|
|
59
|
+
var cell = (0, _utils.createCell)(opts, []);
|
|
60
|
+
var index = context.node.nodes.findIndex(function (child) {
|
|
61
|
+
return child.key === context.child.key;
|
|
62
|
+
});
|
|
63
|
+
change.insertNodeByKey(context.node.key, index, cell, { normalize: false });
|
|
64
|
+
change.moveNodeByKey(context.child.key, cell.key, 0, { normalize: false });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* Rows can't live outside a table, if one is found then we wrap it within a table.
|
|
69
|
+
*/
|
|
70
|
+
function rowOnlyInTable(opts, change, context) {
|
|
71
|
+
return change.wrapBlockByKey(context.node.key, opts.typeTable);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* A cell's children must be "block"s.
|
|
76
|
+
* If they're not then we wrap them within a block with a type of opts.typeContent
|
|
77
|
+
*/
|
|
78
|
+
function onlyBlocksInCell(opts, change, context) {
|
|
79
|
+
var block = _slate.Block.create({
|
|
80
|
+
type: opts.typeContent
|
|
81
|
+
});
|
|
82
|
+
change.insertNodeByKey(context.node.key, 0, block, { normalize: false });
|
|
83
|
+
|
|
84
|
+
var inlines = context.node.nodes.filter(function (node) {
|
|
85
|
+
return node.object !== 'block';
|
|
86
|
+
});
|
|
87
|
+
inlines.forEach(function (inline, index) {
|
|
88
|
+
change.moveNodeByKey(inline.key, block.key, index, {
|
|
89
|
+
normalize: false
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* Cells can't live outside a row, if one is found then we wrap it within a row.
|
|
96
|
+
*/
|
|
97
|
+
function cellOnlyInRow(opts, change, context) {
|
|
98
|
+
return change.wrapBlockByKey(context.node.key, opts.typeRow);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
exports.default = schema;
|